diff --git a/src/compile/render-dom/wrappers/shared/create_debugging_comment.ts b/src/compile/render-dom/wrappers/shared/create_debugging_comment.ts index 55d7b307d3..b32d25c1a4 100644 --- a/src/compile/render-dom/wrappers/shared/create_debugging_comment.ts +++ b/src/compile/render-dom/wrappers/shared/create_debugging_comment.ts @@ -16,7 +16,7 @@ export default function create_debugging_comment( let d; if (node.type === 'InlineComponent' || node.type === 'Element') { - d = node.children[0].start; + d = node.children.length ? node.children[0].start : node.start; while (source[d - 1] !== '>') d -= 1; } else { d = node.expression ? node.expression.node.end : c; diff --git a/test/runtime/samples/component-slot-empty-b/Nested.svelte b/test/runtime/samples/component-slot-empty-b/Nested.svelte new file mode 100644 index 0000000000..008d9e2fbb --- /dev/null +++ b/test/runtime/samples/component-slot-empty-b/Nested.svelte @@ -0,0 +1,3 @@ +
+ +
diff --git a/test/runtime/samples/component-slot-empty-b/_config.js b/test/runtime/samples/component-slot-empty-b/_config.js new file mode 100644 index 0000000000..8c1b13b1d5 --- /dev/null +++ b/test/runtime/samples/component-slot-empty-b/_config.js @@ -0,0 +1,3 @@ +export default { + html: `
` +}; diff --git a/test/runtime/samples/component-slot-empty-b/main.svelte b/test/runtime/samples/component-slot-empty-b/main.svelte new file mode 100644 index 0000000000..f6e2deee9b --- /dev/null +++ b/test/runtime/samples/component-slot-empty-b/main.svelte @@ -0,0 +1,6 @@ + + + +