From bf3bf3c926aa72e3fb3e5693ec6d1954635e9f03 Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Tue, 29 Nov 2016 11:33:03 -0500 Subject: [PATCH] dont use property names with SVG elements --- .../attributes/addElementAttributes.js | 2 +- test/compiler/svg-attributes/_config.js | 18 ++++++++++++++++++ test/compiler/svg-attributes/main.html | 5 +++++ 3 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 test/compiler/svg-attributes/_config.js create mode 100644 test/compiler/svg-attributes/main.html diff --git a/compiler/generate/visitors/attributes/addElementAttributes.js b/compiler/generate/visitors/attributes/addElementAttributes.js index d50d8173b6..b7aa5c4056 100644 --- a/compiler/generate/visitors/attributes/addElementAttributes.js +++ b/compiler/generate/visitors/attributes/addElementAttributes.js @@ -5,7 +5,7 @@ import deindent from '../../utils/deindent.js'; export default function addElementAttributes ( generator, node, local ) { node.attributes.forEach( attribute => { if ( attribute.type === 'Attribute' ) { - let metadata = attributeLookup[ attribute.name ]; + let metadata = generator.current.namespace ? null : attributeLookup[ attribute.name ]; if ( metadata && metadata.appliesTo && !~metadata.appliesTo.indexOf( node.name ) ) metadata = null; let dynamic = false; diff --git a/test/compiler/svg-attributes/_config.js b/test/compiler/svg-attributes/_config.js new file mode 100644 index 0000000000..84aecc7b9f --- /dev/null +++ b/test/compiler/svg-attributes/_config.js @@ -0,0 +1,18 @@ +// Hmm, another JSDOM quirk +export default { + skip: true, + + html: ` + + + + + + `, + + test ( assert, component, target ) { + const circle = target.querySelector( 'circle' ); + assert.equal( circle.getAttribute( 'class' ), 'red' ); + component.teardown(); + } +}; diff --git a/test/compiler/svg-attributes/main.html b/test/compiler/svg-attributes/main.html new file mode 100644 index 0000000000..81a6552a96 --- /dev/null +++ b/test/compiler/svg-attributes/main.html @@ -0,0 +1,5 @@ + + + + +