Skip to content

Commit 32c0acc

Browse files
authored
fix: Continue traversing a non-self-closing element's children (#12175)
* add failing test * continue to traverse children of `Element` types * fix test * changeset
1 parent 508d7c0 commit 32c0acc

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

.changeset/smart-donkeys-destroy.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'svelte-migrate': patch
3+
---
4+
5+
fix: continue traversing the children of non-self-closing elements

packages/migrate/migrations/self-closing-tags/migrate.js

+1
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ export async function remove_self_closing_tags({ preprocess, parse }, source) {
164164
SVGElements.includes(node.name) ||
165165
!/^[a-z0-9_-]+$/.test(node.name)
166166
) {
167+
next();
167168
return;
168169
}
169170

packages/migrate/migrations/self-closing-tags/migrate.spec.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ const tests = {
2020
'<svelte:options namespace="foreign" /><foo />': '<svelte:options namespace="foreign" /><foo />',
2121
'<script>console.log("<div />")</script>': '<script>console.log("<div />")</script>',
2222
'<script lang="ts">let a: string = ""</script><div />':
23-
'<script lang="ts">let a: string = ""</script><div></div>'
23+
'<script lang="ts">let a: string = ""</script><div></div>',
24+
'<div><i/></div>': '<div><i></i></div>'
2425
};
2526

2627
for (const input in tests) {

0 commit comments

Comments
 (0)