Merge pull request #241 from sveltejs/gh-233

dont use properties when setting <svg> element attributes
pull/242/head
Rich Harris 8 years ago committed by GitHub
commit 5755334322

@ -6,7 +6,7 @@ import flattenReference from '../../../../utils/flattenReference.js';
export default function addElementAttributes ( generator, node, local ) {
node.attributes.forEach( attribute => {
if ( attribute.type === 'Attribute' ) {
let metadata = generator.current.namespace ? null : attributeLookup[ attribute.name ];
let metadata = local.namespace ? null : attributeLookup[ attribute.name ];
if ( metadata && metadata.appliesTo && !~metadata.appliesTo.indexOf( node.name ) ) metadata = null;
let dynamic = false;

@ -0,0 +1,14 @@
// this looks like another JSDOM quirk — svg.className = 'foo' behaves
// differently from browsers. So this test succeeds even when it should fail
export default {
html: `<svg class='foo'></svg>`,
test ( assert, component, target ) {
const svg = target.querySelector( 'svg' );
assert.equal( svg.namespaceURI, 'http://www.w3.org/2000/svg' );
assert.equal( svg.getAttribute( 'class' ), 'foo' );
component.teardown();
}
};

@ -0,0 +1 @@
<svg class='foo'></svg>

After

Width:  |  Height:  |  Size: 24 B

Loading…
Cancel
Save