diff --git a/src/generators/dom/visitors/attributes/addElementAttributes.js b/src/generators/dom/visitors/attributes/addElementAttributes.js
index c6009ff2e8..c91d369b6d 100644
--- a/src/generators/dom/visitors/attributes/addElementAttributes.js
+++ b/src/generators/dom/visitors/attributes/addElementAttributes.js
@@ -64,15 +64,21 @@ export default function addElementAttributes ( generator, node, local ) {
// static attributes
result = JSON.stringify( value.data );
+ let addAttribute = false;
if ( name === 'xmlns' ) {
// special case
// TODO this attribute must be static – enforce at compile time
local.namespace = value.data;
+ addAttribute = true;
} else if ( propertyName ) {
local.init.addLine(
`${local.name}.${propertyName} = ${result};`
);
} else {
+ addAttribute = true;
+ }
+
+ if ( addAttribute ) {
generator.uses[ helper ] = true;
local.init.addLine(
`${helper}( ${local.name}, '${name}', ${result} );`
diff --git a/test/generator/svg-xmlns/_config.js b/test/generator/svg-xmlns/_config.js
index 37d94a1609..a3ab702eaf 100644
--- a/test/generator/svg-xmlns/_config.js
+++ b/test/generator/svg-xmlns/_config.js
@@ -6,7 +6,7 @@ export default {
height: 100
},
- html: ``,
+ html: ``,
test ( assert, component, target ) {
const svg = target.querySelector( 'svg' );
@@ -16,6 +16,6 @@ export default {
assert.equal( rect.namespaceURI, 'http://www.w3.org/2000/svg' );
component.set({ width: 150, height: 50 });
- assert.equal( target.innerHTML, `` );
+ assert.equal( target.innerHTML, `` );
}
};