mirror of https://github.com/sveltejs/svelte
[fix] static svelte:element not replaced with tag in production mode (#7938)
* [fix] static svelte:element not replaced with tag in production mode * [fix] static svelte:element not replaced with tag in production mode * add optimization of static <svelte:element> and fix a bug Co-authored-by: Yuichiro Yamashita <xydybaseball@gmail.com>pull/7790/head
parent
de6821a1de
commit
f84c00edb9
@ -1,3 +1,7 @@
|
|||||||
<svelte:element this="svg" xmlns="http://www.w3.org/2000/svg">
|
<script>
|
||||||
<svelte:element this="path" xmlns="http://www.w3.org/2000/svg"></svelte:element>
|
const tag = { svg: 'svg', path: 'path' };
|
||||||
</svelte:element>
|
</script>
|
||||||
|
|
||||||
|
<svelte:element this={tag.svg} xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<svelte:element this={tag.path} xmlns="http://www.w3.org/2000/svg" />
|
||||||
|
</svelte:element>
|
||||||
|
@ -0,0 +1,13 @@
|
|||||||
|
export default {
|
||||||
|
html: `
|
||||||
|
<div>
|
||||||
|
<p></p>
|
||||||
|
</div>
|
||||||
|
`,
|
||||||
|
|
||||||
|
test({ assert, target }) {
|
||||||
|
const p = target.querySelector('p');
|
||||||
|
|
||||||
|
assert.notEqual(p, undefined);
|
||||||
|
}
|
||||||
|
};
|
@ -0,0 +1,3 @@
|
|||||||
|
<div>
|
||||||
|
<svelte:element this="p" />
|
||||||
|
</div>
|
@ -0,0 +1,13 @@
|
|||||||
|
export default {
|
||||||
|
html: `
|
||||||
|
<div>
|
||||||
|
<p></p>
|
||||||
|
</div>
|
||||||
|
`,
|
||||||
|
|
||||||
|
test({ assert, target }) {
|
||||||
|
const p = target.querySelector('p');
|
||||||
|
|
||||||
|
assert.notEqual(p, undefined);
|
||||||
|
}
|
||||||
|
};
|
@ -0,0 +1,7 @@
|
|||||||
|
<script>
|
||||||
|
const p = 'p';
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<svelte:element this={p} />
|
||||||
|
</div>
|
Loading…
Reference in new issue