Fix creation of debugging comment for elements without children

pull/2431/head
Mikhail Korepanov 6 years ago
parent 5290b1d9e2
commit f91ba51fc4

@ -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;

@ -0,0 +1,3 @@
<div>
<slot name="slot1" />
</div>

@ -0,0 +1,3 @@
export default {
html: `<div><input slot="slot1"></div>`
};

@ -0,0 +1,6 @@
<script>
import Nested from "./Nested.svelte";
</script>
<Nested>
<input slot="slot1">
</Nested>
Loading…
Cancel
Save