html-element-extended
Advanced tools
Comparing version 0.1.1 to 0.1.2
@@ -0,1 +1,2 @@ | ||
* 0.1.2 support boolAttributes (for discover on frugal-iot) | ||
* 0.1.1 Fixed an issue with boolean parameters not showing boolean false | ||
@@ -2,0 +3,0 @@ * 0.1.0 Split out qrelementextended and videoelementextended as own repos and modules |
@@ -111,3 +111,4 @@ /* Summary | ||
function toBool(value) { | ||
return ["true", "TRUE", 1, "1", true].includes(value); | ||
// The "" may or may not be correct, when used as a webcomponent <foo-bar discover> will pass a value of "", unclear if there is any existing example where empty string is presumed false | ||
return ["true", "TRUE", 1, "1", true, ""].includes(value); | ||
} | ||
@@ -204,2 +205,4 @@ // Standardish routing to allow nesting Elements inside JS | ||
static get floatAttributes() { return []; } | ||
// Overriddden to add new boolean attributes | ||
static get boolAttributes() { return []; } | ||
// Override this to return an array of (string) attributes passed | ||
@@ -230,3 +233,6 @@ static get observedAttributes() { return []; } | ||
} // Fine if value is already an int | ||
if ((name === 'visible') && (newValue === 'false')) newValue = false; | ||
if (this.constructor.boolAttributes.includes(name)) { | ||
newValue = toBool(newValue); | ||
} | ||
if ((name === 'visible') && (newValue === 'false')) newValue = false; // TODO find where used and create boolAttributes | ||
this.state[name] = newValue; | ||
@@ -233,0 +239,0 @@ } |
@@ -29,3 +29,3 @@ { | ||
"type": "module", | ||
"version": "0.1.1" | ||
"version": "0.1.2" | ||
} |
57604
342