|
@@ -25,17 +25,17 @@ export function handleAttributeBindingDirective(component, el, attrName, express
|
|
|
// If we are explicitly binding a string to the :value, set the string,
|
|
|
// If the value is a boolean, leave it alone, it will be set to "on"
|
|
|
// automatically.
|
|
|
- if (typeof value === 'string' && attrType === 'bind') {
|
|
|
- el.value = value
|
|
|
+ if (typeof value !== 'boolean' && ! [null, undefined].includes(value) && attrType === 'bind') {
|
|
|
+ el.value = String(value)
|
|
|
} else if (attrType !== 'bind') {
|
|
|
- if (Array.isArray(value)) {
|
|
|
- // I'm purposely not using Array.includes here because it's
|
|
|
- // strict, and because of Numeric/String mis-casting, I
|
|
|
- // want the "includes" to be "fuzzy".
|
|
|
- el.checked = value.some(val => val == el.value)
|
|
|
- } else {
|
|
|
- el.checked = !! value
|
|
|
- }
|
|
|
+ if (Array.isArray(value)) {
|
|
|
+ // I'm purposely not using Array.includes here because it's
|
|
|
+ // strict, and because of Numeric/String mis-casting, I
|
|
|
+ // want the "includes" to be "fuzzy".
|
|
|
+ el.checked = value.some(val => val == el.value)
|
|
|
+ } else {
|
|
|
+ el.checked = !!value
|
|
|
+ }
|
|
|
}
|
|
|
} else if (el.tagName === 'SELECT') {
|
|
|
updateSelect(el, value)
|
|
@@ -78,7 +78,7 @@ export function handleAttributeBindingDirective(component, el, attrName, express
|
|
|
}
|
|
|
|
|
|
function setIfChanged(el, attrName, value) {
|
|
|
- if (el.getAttribute(attrName) != value){
|
|
|
+ if (el.getAttribute(attrName) != value) {
|
|
|
el.setAttribute(attrName, value)
|
|
|
}
|
|
|
}
|