diff --git a/src/generators/dom/visitors/attributes/binding/index.js b/src/generators/dom/visitors/attributes/binding/index.js index a546d2fa97..5c5f15f729 100644 --- a/src/generators/dom/visitors/attributes/binding/index.js +++ b/src/generators/dom/visitors/attributes/binding/index.js @@ -102,7 +102,7 @@ export default function createBinding ( generator, node, attribute, current, loc } ` ); } else { - const updateElement = `${local.name}.${attribute.name} = ${contextual ? attribute.value : `root.${attribute.value}`}`; + const updateElement = `${local.name}.${attribute.name} = ${contextual ? attribute.value : `typeof root.${attribute.value} == 'undefined' ? '' : root.${attribute.value}`}`; generator.uses.addEventListener = true; generator.uses.removeEventListener = true;