-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: ensure if block paths retain correct template namespacing (#14685)
* fix: ensure if block paths retain correct template namespacing * add tests * address feedback * address feedback * simplify --------- Co-authored-by: Rich Harris <[email protected]>
- Loading branch information
1 parent
780041a
commit 2e0dcd7
Showing
5 changed files
with
52 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'svelte': patch | ||
--- | ||
|
||
fix: ensure if block paths retain correct template namespacing |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
packages/svelte/tests/runtime-runes/samples/svg-namespace-if-block/Child.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
|
||
{#if true} | ||
<g> | ||
<rect x="20" y="10" width="50" height="50" fill="yellow"/> | ||
</g> | ||
{:else} | ||
<div>lol</div> | ||
{/if} |
14 changes: 14 additions & 0 deletions
14
packages/svelte/tests/runtime-runes/samples/svg-namespace-if-block/_config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { test, ok } from '../../test'; | ||
|
||
export default test({ | ||
html: `<svg height="200px" viewBox="0 0 100 100" width="200px"><g><rect fill="yellow" height="50" width="50" x="20" y="10"></rect></g></svg>`, | ||
test({ assert, target }) { | ||
const g = target.querySelector('g'); | ||
const rect = target.querySelector('rect'); | ||
ok(g); | ||
ok(rect); | ||
|
||
assert.equal(g.namespaceURI, 'http://www.w3.org/2000/svg'); | ||
assert.equal(rect.namespaceURI, 'http://www.w3.org/2000/svg'); | ||
} | ||
}); |
7 changes: 7 additions & 0 deletions
7
packages/svelte/tests/runtime-runes/samples/svg-namespace-if-block/main.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<script> | ||
import Child from "./Child.svelte"; | ||
</script> | ||
|
||
<svg viewBox="0 0 100 100" width="200px" height="200px"> | ||
<Child /> | ||
</svg> |