Skip to content

Commit f91ba51

Browse files
committed
Fix creation of debugging comment for elements without children
1 parent 5290b1d commit f91ba51

File tree

4 files changed

+13
-1
lines changed

4 files changed

+13
-1
lines changed

src/compile/render-dom/wrappers/shared/create_debugging_comment.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export default function create_debugging_comment(
1616
let d;
1717

1818
if (node.type === 'InlineComponent' || node.type === 'Element') {
19-
d = node.children[0].start;
19+
d = node.children.length ? node.children[0].start : node.start;
2020
while (source[d - 1] !== '>') d -= 1;
2121
} else {
2222
d = node.expression ? node.expression.node.end : c;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<div>
2+
<slot name="slot1" />
3+
</div>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export default {
2+
html: `<div><input slot="slot1"></div>`
3+
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<script>
2+
import Nested from "./Nested.svelte";
3+
</script>
4+
<Nested>
5+
<input slot="slot1">
6+
</Nested>

0 commit comments

Comments
 (0)