@expressen/tallahassee
Advanced tools
Comparing version 14.5.0 to 14.6.0
@@ -278,3 +278,4 @@ "use strict"; | ||
getAttribute(name) { | ||
return this.$elm.attr(name); | ||
const value = this.$elm.attr(name); | ||
return value !== undefined ? value : null; | ||
} | ||
@@ -281,0 +282,0 @@ hasAttribute(name) { |
@@ -28,3 +28,3 @@ "use strict"; | ||
const value = this.getAttribute("value"); | ||
if (value === undefined) return ""; | ||
if (value === null) return ""; | ||
return value; | ||
@@ -31,0 +31,0 @@ } |
@@ -7,2 +7,3 @@ "use strict"; | ||
const HTMLInputElement = require("./HTMLInputElement"); | ||
const HTMLSelectElement = require("./HTMLSelectElement"); | ||
@@ -95,2 +96,4 @@ const originSymbol = Symbol.for("origin"); | ||
return el.reportValidity(); | ||
} else if (el instanceof HTMLSelectElement) { | ||
return el.reportValidity(); | ||
} | ||
@@ -97,0 +100,0 @@ return true; |
@@ -11,3 +11,3 @@ "use strict"; | ||
const value = this.getAttribute("alt"); | ||
if (value === undefined) return ""; | ||
if (value === null) return ""; | ||
return value; | ||
@@ -21,3 +21,3 @@ } | ||
const value = this.getAttribute("srcset"); | ||
if (value === undefined) return ""; | ||
if (value === null) return ""; | ||
return value; | ||
@@ -31,3 +31,3 @@ } | ||
const value = this.getAttribute("width"); | ||
if (value === undefined) return 0; | ||
if (value === null) return 0; | ||
return parseInt(value, 10); | ||
@@ -37,5 +37,5 @@ } | ||
const value = this.getAttribute("height"); | ||
if (value === undefined) return 0; | ||
if (value === null) return 0; | ||
return parseInt(value, 10); | ||
} | ||
}; |
@@ -82,3 +82,3 @@ "use strict"; | ||
const value = this.getAttribute("value"); | ||
if (value === undefined) return ""; | ||
if (value === null) return ""; | ||
return value; | ||
@@ -116,3 +116,3 @@ } | ||
const value = this.getAttribute("accept"); | ||
if (value === undefined) return ""; | ||
if (value === null) return ""; | ||
return value; | ||
@@ -119,0 +119,0 @@ } |
@@ -13,3 +13,3 @@ "use strict"; | ||
const parent = this.parentElement; | ||
if (value && !parent.multiple) { | ||
if (value && parent && !parent.multiple) { | ||
for (const opt of this.parentElement.children) { | ||
@@ -26,3 +26,3 @@ if (opt.tagName === "OPTION") { | ||
this._emitter.emit("_insert"); | ||
parent.dispatchEvent(new Event("change", { bubbles: true })); | ||
if (parent) parent.dispatchEvent(new Event("change", { bubbles: true })); | ||
} | ||
@@ -29,0 +29,0 @@ |
@@ -7,3 +7,6 @@ "use strict"; | ||
const HtmlOptionCollection = require("./HTMLOptionsCollection"); | ||
const ValidityState = require("./ValidityState"); | ||
const kValidity = Symbol.for("validity"); | ||
const kValidationMessage = Symbol.for("validation message"); | ||
const kOptions = Symbol.for("options"); | ||
@@ -15,2 +18,5 @@ const kSelectedOptions = Symbol.for("selected options"); | ||
super(...args); | ||
this[kValidationMessage] = ""; | ||
this[kValidity] = new ValidityState(this); | ||
this[kOptions] = new HtmlOptionCollection(this); | ||
@@ -48,2 +54,25 @@ this[kSelectedOptions] = new HTMLCollection(this, "> option", { | ||
} | ||
get validationMessage() { | ||
return this[kValidationMessage]; | ||
} | ||
get validity() { | ||
return this[kValidity]; | ||
} | ||
get willValidate() { | ||
if (this.readOnly) return false; | ||
if (this.disabled) return false; | ||
return this.type !== "hidden"; | ||
} | ||
reportValidity() { | ||
return this.checkValidity(); | ||
} | ||
checkValidity() { | ||
const validity = this[kValidity]; | ||
if (!validity.valid) this.dispatchEvent(new Event("invalid", { bubbles: true })); | ||
return validity.valid; | ||
} | ||
setCustomValidity(...args) { | ||
if (!args.length) throw new TypeError(`Failed to execute 'setCustomValidity' on '${this.constructor.name}': 1 argument required, but only 0 present.`); | ||
this[kValidationMessage] = `${args[0]}`; | ||
} | ||
get selectedIndex() { | ||
@@ -50,0 +79,0 @@ return this.options.selectedIndex; |
@@ -30,3 +30,3 @@ "use strict"; | ||
const value = this.getAttribute("value"); | ||
if (value === undefined) return ""; | ||
if (value === null) return ""; | ||
return value; | ||
@@ -33,0 +33,0 @@ } |
{ | ||
"name": "@expressen/tallahassee", | ||
"version": "14.5.0", | ||
"version": "14.6.0", | ||
"description": "Lightweight client testing framework", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
123644
3805