diff --git a/src/generators/dom/index.ts b/src/generators/dom/index.ts
index 487006ad53..3a21e356f5 100644
--- a/src/generators/dom/index.ts
+++ b/src/generators/dom/index.ts
@@ -97,6 +97,9 @@ export default function dom(
parsed.html.build();
const { block } = parsed.html;
+ // prevent fragment being created twice (#1063)
+ if (options.customElement) block.builders.create.addLine(`this.c = @noop;`);
+
generator.stylesheet.warnOnUnusedSelectors(options.onwarn);
const builder = new CodeBuilder();
diff --git a/test/custom-elements/index.js b/test/custom-elements/index.js
index 917261ddec..a3287b5d10 100644
--- a/test/custom-elements/index.js
+++ b/test/custom-elements/index.js
@@ -19,6 +19,10 @@ describe('custom-elements', function() {
const nightmare = new Nightmare({ show: false });
+ nightmare.on('console', (type, ...args) => {
+ console[type](...args);
+ });
+
let svelte;
let server;
let bundle;
diff --git a/test/custom-elements/samples/nested/Counter.html b/test/custom-elements/samples/nested/Counter.html
new file mode 100644
index 0000000000..fa6132f0f5
--- /dev/null
+++ b/test/custom-elements/samples/nested/Counter.html
@@ -0,0 +1,13 @@
+
+
+
\ No newline at end of file
diff --git a/test/custom-elements/samples/nested/main.html b/test/custom-elements/samples/nested/main.html
new file mode 100644
index 0000000000..3be7e91177
--- /dev/null
+++ b/test/custom-elements/samples/nested/main.html
@@ -0,0 +1,12 @@
+
clicked {{count}} times
+ + \ No newline at end of file diff --git a/test/custom-elements/samples/nested/test.js b/test/custom-elements/samples/nested/test.js new file mode 100644 index 0000000000..b9303f1e26 --- /dev/null +++ b/test/custom-elements/samples/nested/test.js @@ -0,0 +1,17 @@ +import * as assert from 'assert'; +import './main.html'; + +export default function (target) { + target.innerHTML = '