Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/compiler/compile/nodes/Element.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,10 @@ function get_namespace(parent: Element, element: Element, explicit_namespace: st
: null);
}

if (svg.test(element.name.toLowerCase())) return namespaces.svg;
if (parent_element.name.toLowerCase() === 'foreignobject') return null;
if (parent_element.namespace != namespaces.foreign) {
if (svg.test(element.name.toLowerCase())) return namespaces.svg;
if (parent_element.name.toLowerCase() === 'foreignobject') return null;
}

return parent_element.namespace;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
// Test support for the `foreign` namespace preserving attribute case.
// including ensuring that svg named elements don't interfere

export default {
html: `
<page horizontalAlignment="center">
<button textWrap="true" text="button">
<button textWrap="true" text="button"></button>
<text wordWrap="true"></text>
</page>
`,
options: {
Expand All @@ -16,5 +18,6 @@ export default {
const attr = sel => target.querySelector(sel).attributes[0].name;
assert.equal(attr('page'), 'horizontalAlignment');
assert.equal(attr('button'), 'textWrap');
assert.equal(attr('text'), 'wordWrap');
}
};
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<page horizontalAlignment="center">
<button textWrap="true" text="button">
<button textWrap="true" text="button"/>
<text wordWrap="true" />
</page>