mirror of https://github.com/sveltejs/svelte
parent
e304445476
commit
ea954759c0
@ -0,0 +1,5 @@
|
||||
---
|
||||
"svelte": patch
|
||||
---
|
||||
|
||||
fix: fall back to component namespace when not statically determinable, add way to tell `<svelte:element>` the namespace at runtime
|
||||
@ -0,0 +1,10 @@
|
||||
import { test } from '../../test';
|
||||
|
||||
export default test({
|
||||
async test({ assert, target }) {
|
||||
assert.equal(target.querySelector('path')?.namespaceURI, 'http://www.w3.org/2000/svg');
|
||||
|
||||
await target.querySelector('button')?.click();
|
||||
assert.equal(target.querySelector('div')?.namespaceURI, 'http://www.w3.org/1999/xhtml');
|
||||
}
|
||||
});
|
||||
@ -0,0 +1,14 @@
|
||||
<script>
|
||||
let tag = $state('path');
|
||||
let xmlns = $state('http://www.w3.org/2000/svg');
|
||||
</script>
|
||||
|
||||
<button onclick={() => {
|
||||
tag = 'div';
|
||||
xmlns = 'http://www.w3.org/1999/xhtml';
|
||||
}}>change</button>
|
||||
|
||||
<!-- wrapper necessary or else jsdom says this is always an xhtml namespace -->
|
||||
<svg>
|
||||
<svelte:element this={tag} xmlns={xmlns} />
|
||||
</svg>
|
||||
Loading…
Reference in new issue