diff --git a/src/compiler/compile/render_dom/index.ts b/src/compiler/compile/render_dom/index.ts index e749af6729..d79af2ea75 100644 --- a/src/compiler/compile/render_dom/index.ts +++ b/src/compiler/compile/render_dom/index.ts @@ -288,7 +288,7 @@ export default function dom( const has_create_fragment = component.compile_options.dev || block.has_content(); if (has_create_fragment) { body.push(b` - function create_fragment(#ctx) { + function create_fragment(root, #ctx) { ${block.get_contents()} } `); diff --git a/src/compiler/compile/render_dom/wrappers/InlineComponent/index.ts b/src/compiler/compile/render_dom/wrappers/InlineComponent/index.ts index 2ea149a848..ad85883d2b 100644 --- a/src/compiler/compile/render_dom/wrappers/InlineComponent/index.ts +++ b/src/compiler/compile/render_dom/wrappers/InlineComponent/index.ts @@ -191,6 +191,7 @@ export default class InlineComponentWrapper extends Wrapper { // will complain that options.target is missing. This would // work better if components had separate public and private // APIs + component_opts.properties.push(p`root`); component_opts.properties.push(p`$$inline: true`); } diff --git a/src/runtime/internal/Component.ts b/src/runtime/internal/Component.ts index 0d1d65cbdc..f58d0971d8 100644 --- a/src/runtime/internal/Component.ts +++ b/src/runtime/internal/Component.ts @@ -149,7 +149,7 @@ export function init(component, options, instance, create_fragment, not_equal, p run_all($$.before_update); // `false` as a special case of no DOM component - $$.fragment = create_fragment ? create_fragment($$.ctx) : false; + $$.fragment = create_fragment ? create_fragment(options.target || options.root, $$.ctx) : false; if (options.target) { if (options.hydrate) { diff --git a/src/runtime/internal/dom.ts b/src/runtime/internal/dom.ts index 31a12adc01..48ab9264b8 100644 --- a/src/runtime/internal/dom.ts +++ b/src/runtime/internal/dom.ts @@ -110,17 +110,17 @@ function init_hydrate(target: NodeEx) { const anchor = j < lis.length ? lis[j] : null; target.insertBefore(toMove[i], anchor); } -let appendStylesTo: Element; +} export function append_styles( - { target }, + { target, root }, styleSheetId: string, styles: string, styleId: string = `svelte-${styleSheetId}-style` ) { - if (target) appendStylesTo = get_root_for_node(target); + const appendStylesTo = get_root_for_node(target || root); - if (!appendStylesTo.querySelector('#' + styleId)) { + if (!appendStylesTo?.querySelector('#' + styleId)) { const style = element('style'); style.id = styleId; style.textContent = styles; @@ -129,12 +129,14 @@ export function append_styles( } function get_root_for_node(node: Node) { + if (!node) return document.head; + const root = (node.getRootNode ? node.getRootNode() : node.ownerDocument); // check for getRootNode because IE is still supported return ((root as ShadowRoot).host ? root : (root as Document).head) as Element; } -export function append_empty_stylesheet() { - return appendStylesTo.appendChild(element('style') as HTMLStyleElement); +export function append_empty_stylesheet(node: Node) { + return get_root_for_node(node).appendChild(element('style') as HTMLStyleElement); } export function append(target: NodeEx, node: NodeEx) { diff --git a/src/runtime/internal/style_manager.ts b/src/runtime/internal/style_manager.ts index 4e16bdb3cf..c088af9dac 100644 --- a/src/runtime/internal/style_manager.ts +++ b/src/runtime/internal/style_manager.ts @@ -31,7 +31,7 @@ export function create_rule(node: Element & ElementCSSInlineStyle, a: number, b: const name = `__svelte_${hash(rule)}_${uid}`; const doc = node.ownerDocument as ExtendedDoc; active_docs.add(doc); - const stylesheet = doc.__svelte_stylesheet || (doc.__svelte_stylesheet = append_empty_stylesheet().sheet as CSSStyleSheet); + const stylesheet = doc.__svelte_stylesheet || (doc.__svelte_stylesheet = append_empty_stylesheet(node).sheet as CSSStyleSheet); const current_rules = doc.__svelte_rules || (doc.__svelte_rules = {}); if (!current_rules[name]) { diff --git a/test/js/samples/action-custom-event-handler/expected.js b/test/js/samples/action-custom-event-handler/expected.js index 51656290d6..d777cffd00 100644 --- a/test/js/samples/action-custom-event-handler/expected.js +++ b/test/js/samples/action-custom-event-handler/expected.js @@ -11,7 +11,7 @@ import { safe_not_equal } from "svelte/internal"; -function create_fragment(ctx) { +function create_fragment(root, ctx) { let button; let foo_action; let mounted; @@ -48,7 +48,7 @@ function handleFoo(bar) { } function foo(node, callback) { - + } // code goes here function instance($$self, $$props, $$invalidate) { diff --git a/test/js/samples/action/expected.js b/test/js/samples/action/expected.js index d52960bddd..d563784332 100644 --- a/test/js/samples/action/expected.js +++ b/test/js/samples/action/expected.js @@ -11,7 +11,7 @@ import { safe_not_equal } from "svelte/internal"; -function create_fragment(ctx) { +function create_fragment(root, ctx) { let a; let link_action; let mounted; diff --git a/test/js/samples/bind-online/expected.js b/test/js/samples/bind-online/expected.js index 887195bce1..0d064399b4 100644 --- a/test/js/samples/bind-online/expected.js +++ b/test/js/samples/bind-online/expected.js @@ -9,7 +9,7 @@ import { safe_not_equal } from "svelte/internal"; -function create_fragment(ctx) { +function create_fragment(root, ctx) { let mounted; let dispose; add_render_callback(/*onlinestatuschanged*/ ctx[1]); diff --git a/test/js/samples/bind-open/expected.js b/test/js/samples/bind-open/expected.js index 56ff302845..cb7dc2c888 100644 --- a/test/js/samples/bind-open/expected.js +++ b/test/js/samples/bind-open/expected.js @@ -10,7 +10,7 @@ import { safe_not_equal } from "svelte/internal"; -function create_fragment(ctx) { +function create_fragment(root, ctx) { let details; let mounted; let dispose; diff --git a/test/js/samples/bind-width-height/expected.js b/test/js/samples/bind-width-height/expected.js index f23c20b683..76a49fb5ce 100644 --- a/test/js/samples/bind-width-height/expected.js +++ b/test/js/samples/bind-width-height/expected.js @@ -11,7 +11,7 @@ import { safe_not_equal } from "svelte/internal"; -function create_fragment(ctx) { +function create_fragment(root, ctx) { let div; let div_resize_listener; diff --git a/test/js/samples/bindings-readonly-order/expected.js b/test/js/samples/bindings-readonly-order/expected.js index 78a71dcd84..630210368b 100644 --- a/test/js/samples/bindings-readonly-order/expected.js +++ b/test/js/samples/bindings-readonly-order/expected.js @@ -13,7 +13,7 @@ import { space } from "svelte/internal"; -function create_fragment(ctx) { +function create_fragment(root, ctx) { let input0; let t; let input1; diff --git a/test/js/samples/capture-inject-dev-only/expected.js b/test/js/samples/capture-inject-dev-only/expected.js index a87693dd9e..18e9d97016 100644 --- a/test/js/samples/capture-inject-dev-only/expected.js +++ b/test/js/samples/capture-inject-dev-only/expected.js @@ -15,7 +15,7 @@ import { text } from "svelte/internal"; -function create_fragment(ctx) { +function create_fragment(root, ctx) { let p; let t0; let t1; diff --git a/test/js/samples/capture-inject-state/expected.js b/test/js/samples/capture-inject-state/expected.js index 6485526bd4..0bfa2a4db4 100644 --- a/test/js/samples/capture-inject-state/expected.js +++ b/test/js/samples/capture-inject-state/expected.js @@ -20,7 +20,7 @@ import { const file = undefined; -function create_fragment(ctx) { +function create_fragment(root, ctx) { let p; let t0; let t1; diff --git a/test/js/samples/collapses-text-around-comments/expected.js b/test/js/samples/collapses-text-around-comments/expected.js index e3e000094f..e50442771b 100644 --- a/test/js/samples/collapses-text-around-comments/expected.js +++ b/test/js/samples/collapses-text-around-comments/expected.js @@ -18,7 +18,7 @@ function add_css(options) { append_styles(options, "1a7i8ec", "p.svelte-1a7i8ec{color:red}"); } -function create_fragment(ctx) { +function create_fragment(root, ctx) { let p; let t; diff --git a/test/js/samples/component-static-array/expected.js b/test/js/samples/component-static-array/expected.js index 0ecb0f32ba..dfac6acde3 100644 --- a/test/js/samples/component-static-array/expected.js +++ b/test/js/samples/component-static-array/expected.js @@ -11,7 +11,7 @@ import { transition_out } from "svelte/internal"; -function create_fragment(ctx) { +function create_fragment(root, ctx) { let nested; let current; nested = new /*Nested*/ ctx[0]({ props: { foo: [1, 2, 3] } }); diff --git a/test/js/samples/component-static-immutable/expected.js b/test/js/samples/component-static-immutable/expected.js index b0c4165413..594c063b85 100644 --- a/test/js/samples/component-static-immutable/expected.js +++ b/test/js/samples/component-static-immutable/expected.js @@ -11,7 +11,7 @@ import { transition_out } from "svelte/internal"; -function create_fragment(ctx) { +function create_fragment(root, ctx) { let nested; let current; nested = new /*Nested*/ ctx[0]({ props: { foo: "bar" } }); diff --git a/test/js/samples/component-static-immutable2/expected.js b/test/js/samples/component-static-immutable2/expected.js index b0c4165413..594c063b85 100644 --- a/test/js/samples/component-static-immutable2/expected.js +++ b/test/js/samples/component-static-immutable2/expected.js @@ -11,7 +11,7 @@ import { transition_out } from "svelte/internal"; -function create_fragment(ctx) { +function create_fragment(root, ctx) { let nested; let current; nested = new /*Nested*/ ctx[0]({ props: { foo: "bar" } }); diff --git a/test/js/samples/component-static-var/expected.js b/test/js/samples/component-static-var/expected.js index 2cd5ed386f..9cef35aa3b 100644 --- a/test/js/samples/component-static-var/expected.js +++ b/test/js/samples/component-static-var/expected.js @@ -19,7 +19,7 @@ import { import Foo from "./Foo.svelte"; import Bar from "./Bar.svelte"; -function create_fragment(ctx) { +function create_fragment(root, ctx) { let foo; let t0; let bar; diff --git a/test/js/samples/component-static/expected.js b/test/js/samples/component-static/expected.js index 186f6350e6..2876b5a9d1 100644 --- a/test/js/samples/component-static/expected.js +++ b/test/js/samples/component-static/expected.js @@ -11,7 +11,7 @@ import { transition_out } from "svelte/internal"; -function create_fragment(ctx) { +function create_fragment(root, ctx) { let nested; let current; nested = new /*Nested*/ ctx[0]({ props: { foo: "bar" } }); diff --git a/test/js/samples/component-store-access-invalidate/expected.js b/test/js/samples/component-store-access-invalidate/expected.js index 4c7bfd7009..e9437067f3 100644 --- a/test/js/samples/component-store-access-invalidate/expected.js +++ b/test/js/samples/component-store-access-invalidate/expected.js @@ -15,7 +15,7 @@ import { import { writable } from "svelte/store"; -function create_fragment(ctx) { +function create_fragment(root, ctx) { let h1; let t; diff --git a/test/js/samples/component-store-reassign-invalidate/expected.js b/test/js/samples/component-store-reassign-invalidate/expected.js index 0cf555bf0d..224ff613ac 100644 --- a/test/js/samples/component-store-reassign-invalidate/expected.js +++ b/test/js/samples/component-store-reassign-invalidate/expected.js @@ -17,7 +17,7 @@ import { import { writable } from "svelte/store"; -function create_fragment(ctx) { +function create_fragment(root, ctx) { let h1; let t0; let t1; diff --git a/test/js/samples/css-media-query/expected.js b/test/js/samples/css-media-query/expected.js index 749c692aa1..d3dfaca9c3 100644 --- a/test/js/samples/css-media-query/expected.js +++ b/test/js/samples/css-media-query/expected.js @@ -15,7 +15,7 @@ function add_css(options) { append_styles(options, "1slhpfn", "@media(min-width: 1px){div.svelte-1slhpfn{color:red}}"); } -function create_fragment(ctx) { +function create_fragment(root, ctx) { let div; return { diff --git a/test/js/samples/css-shadow-dom-keyframes/expected.js b/test/js/samples/css-shadow-dom-keyframes/expected.js index 4d188201eb..4db714dedc 100644 --- a/test/js/samples/css-shadow-dom-keyframes/expected.js +++ b/test/js/samples/css-shadow-dom-keyframes/expected.js @@ -10,7 +10,7 @@ import { safe_not_equal } from "svelte/internal"; -function create_fragment(ctx) { +function create_fragment(root, ctx) { let div; return { diff --git a/test/js/samples/data-attribute/expected.js b/test/js/samples/data-attribute/expected.js index 8c30e6f6db..97c4faf65b 100644 --- a/test/js/samples/data-attribute/expected.js +++ b/test/js/samples/data-attribute/expected.js @@ -11,7 +11,7 @@ import { space } from "svelte/internal"; -function create_fragment(ctx) { +function create_fragment(root, ctx) { let div0; let t; let div1; diff --git a/test/js/samples/debug-empty/expected.js b/test/js/samples/debug-empty/expected.js index c18eb8699c..2a0445663e 100644 --- a/test/js/samples/debug-empty/expected.js +++ b/test/js/samples/debug-empty/expected.js @@ -18,7 +18,7 @@ import { const file = undefined; -function create_fragment(ctx) { +function create_fragment(root, ctx) { let h1; let t0; let t1; diff --git a/test/js/samples/debug-foo-bar-baz-things/expected.js b/test/js/samples/debug-foo-bar-baz-things/expected.js index 12a04b438b..a5e7af3cea 100644 --- a/test/js/samples/debug-foo-bar-baz-things/expected.js +++ b/test/js/samples/debug-foo-bar-baz-things/expected.js @@ -84,7 +84,7 @@ function create_each_block(ctx) { return block; } -function create_fragment(ctx) { +function create_fragment(root, ctx) { let t0; let p; let t1; diff --git a/test/js/samples/debug-foo/expected.js b/test/js/samples/debug-foo/expected.js index 029d525883..3e16d354e4 100644 --- a/test/js/samples/debug-foo/expected.js +++ b/test/js/samples/debug-foo/expected.js @@ -78,7 +78,7 @@ function create_each_block(ctx) { return block; } -function create_fragment(ctx) { +function create_fragment(root, ctx) { let t0; let p; let t1; diff --git a/test/js/samples/debug-hoisted/expected.js b/test/js/samples/debug-hoisted/expected.js index 8dbd718404..984c4e649c 100644 --- a/test/js/samples/debug-hoisted/expected.js +++ b/test/js/samples/debug-hoisted/expected.js @@ -10,7 +10,7 @@ import { const file = undefined; -function create_fragment(ctx) { +function create_fragment(root, ctx) { const block = { c: function create() { { diff --git a/test/js/samples/debug-no-dependencies/expected.js b/test/js/samples/debug-no-dependencies/expected.js index 29e518d9b1..8b56922bad 100644 --- a/test/js/samples/debug-no-dependencies/expected.js +++ b/test/js/samples/debug-no-dependencies/expected.js @@ -63,7 +63,7 @@ function create_each_block(ctx) { return block; } -function create_fragment(ctx) { +function create_fragment(root, ctx) { let each_1_anchor; let each_value = things; validate_each_argument(each_value); diff --git a/test/js/samples/deconflict-builtins/expected.js b/test/js/samples/deconflict-builtins/expected.js index 6bc60194aa..e4a86534a2 100644 --- a/test/js/samples/deconflict-builtins/expected.js +++ b/test/js/samples/deconflict-builtins/expected.js @@ -44,7 +44,7 @@ function create_each_block(ctx) { }; } -function create_fragment(ctx) { +function create_fragment(root, ctx) { let each_1_anchor; let each_value = /*createElement*/ ctx[0]; let each_blocks = []; diff --git a/test/js/samples/dev-warning-missing-data-computed/expected.js b/test/js/samples/dev-warning-missing-data-computed/expected.js index a981d88dca..6ec3dcb8f5 100644 --- a/test/js/samples/dev-warning-missing-data-computed/expected.js +++ b/test/js/samples/dev-warning-missing-data-computed/expected.js @@ -18,7 +18,7 @@ import { const file = undefined; -function create_fragment(ctx) { +function create_fragment(root, ctx) { let p; let t0_value = Math.max(0, /*foo*/ ctx[0]) + ""; let t0; diff --git a/test/js/samples/dont-invalidate-this/expected.js b/test/js/samples/dont-invalidate-this/expected.js index 0b155373a1..74cc6b4cae 100644 --- a/test/js/samples/dont-invalidate-this/expected.js +++ b/test/js/samples/dont-invalidate-this/expected.js @@ -10,7 +10,7 @@ import { safe_not_equal } from "svelte/internal"; -function create_fragment(ctx) { +function create_fragment(root, ctx) { let input; let mounted; let dispose; diff --git a/test/js/samples/dynamic-import/expected.js b/test/js/samples/dynamic-import/expected.js index d1085f431b..e1fef0f7f0 100644 --- a/test/js/samples/dynamic-import/expected.js +++ b/test/js/samples/dynamic-import/expected.js @@ -13,7 +13,7 @@ import { import LazyLoad from "./LazyLoad.svelte"; -function create_fragment(ctx) { +function create_fragment(root, ctx) { let lazyload; let current; lazyload = new LazyLoad({ props: { load: func } }); diff --git a/test/js/samples/each-block-array-literal/expected.js b/test/js/samples/each-block-array-literal/expected.js index fe51ac5bc3..7b5775923d 100644 --- a/test/js/samples/each-block-array-literal/expected.js +++ b/test/js/samples/each-block-array-literal/expected.js @@ -44,7 +44,7 @@ function create_each_block(ctx) { }; } -function create_fragment(ctx) { +function create_fragment(root, ctx) { let each_1_anchor; let each_value = [/*a*/ ctx[0], /*b*/ ctx[1], /*c*/ ctx[2], /*d*/ ctx[3], /*e*/ ctx[4]]; let each_blocks = []; diff --git a/test/js/samples/each-block-changed-check/expected.js b/test/js/samples/each-block-changed-check/expected.js index 0020235d44..e3b689c65e 100644 --- a/test/js/samples/each-block-changed-check/expected.js +++ b/test/js/samples/each-block-changed-check/expected.js @@ -81,7 +81,7 @@ function create_each_block(ctx) { }; } -function create_fragment(ctx) { +function create_fragment(root, ctx) { let t0; let p; let t1; diff --git a/test/js/samples/each-block-keyed-animated/expected.js b/test/js/samples/each-block-keyed-animated/expected.js index b48073f5a7..4b05e81785 100644 --- a/test/js/samples/each-block-keyed-animated/expected.js +++ b/test/js/samples/each-block-keyed-animated/expected.js @@ -64,7 +64,7 @@ function create_each_block(key_1, ctx) { }; } -function create_fragment(ctx) { +function create_fragment(root, ctx) { let each_blocks = []; let each_1_lookup = new Map(); let each_1_anchor; diff --git a/test/js/samples/each-block-keyed/expected.js b/test/js/samples/each-block-keyed/expected.js index 7808ed677f..a064e72a13 100644 --- a/test/js/samples/each-block-keyed/expected.js +++ b/test/js/samples/each-block-keyed/expected.js @@ -49,7 +49,7 @@ function create_each_block(key_1, ctx) { }; } -function create_fragment(ctx) { +function create_fragment(root, ctx) { let each_blocks = []; let each_1_lookup = new Map(); let each_1_anchor; diff --git a/test/js/samples/event-handler-dynamic/expected.js b/test/js/samples/event-handler-dynamic/expected.js index dacdfe15ac..fb4596bf68 100644 --- a/test/js/samples/event-handler-dynamic/expected.js +++ b/test/js/samples/event-handler-dynamic/expected.js @@ -16,7 +16,7 @@ import { text } from "svelte/internal"; -function create_fragment(ctx) { +function create_fragment(root, ctx) { let p0; let button0; let t1; diff --git a/test/js/samples/event-handler-no-passive/expected.js b/test/js/samples/event-handler-no-passive/expected.js index 4d4b910d4e..bddbf312fc 100644 --- a/test/js/samples/event-handler-no-passive/expected.js +++ b/test/js/samples/event-handler-no-passive/expected.js @@ -11,7 +11,7 @@ import { safe_not_equal } from "svelte/internal"; -function create_fragment(ctx) { +function create_fragment(root, ctx) { let a; let mounted; let dispose; diff --git a/test/js/samples/event-modifiers/expected.js b/test/js/samples/event-modifiers/expected.js index 3901753661..8b9e173abb 100644 --- a/test/js/samples/event-modifiers/expected.js +++ b/test/js/samples/event-modifiers/expected.js @@ -15,7 +15,7 @@ import { stop_propagation } from "svelte/internal"; -function create_fragment(ctx) { +function create_fragment(root, ctx) { let div1; let div0; let t1; @@ -76,11 +76,11 @@ function create_fragment(ctx) { } function handleTouchstart() { - + } // ... function handleClick() { - + } // ... class Component extends SvelteComponent { diff --git a/test/js/samples/head-no-whitespace/expected.js b/test/js/samples/head-no-whitespace/expected.js index 444bad3fd4..da4d343594 100644 --- a/test/js/samples/head-no-whitespace/expected.js +++ b/test/js/samples/head-no-whitespace/expected.js @@ -10,7 +10,7 @@ import { safe_not_equal } from "svelte/internal"; -function create_fragment(ctx) { +function create_fragment(root, ctx) { let meta0; let meta1; diff --git a/test/js/samples/hoisted-const/expected.js b/test/js/samples/hoisted-const/expected.js index 2842b54751..5fe2b917a6 100644 --- a/test/js/samples/hoisted-const/expected.js +++ b/test/js/samples/hoisted-const/expected.js @@ -9,7 +9,7 @@ import { safe_not_equal } from "svelte/internal"; -function create_fragment(ctx) { +function create_fragment(root, ctx) { let b; return { diff --git a/test/js/samples/hoisted-let/expected.js b/test/js/samples/hoisted-let/expected.js index 285b124118..f7532bbb44 100644 --- a/test/js/samples/hoisted-let/expected.js +++ b/test/js/samples/hoisted-let/expected.js @@ -9,7 +9,7 @@ import { safe_not_equal } from "svelte/internal"; -function create_fragment(ctx) { +function create_fragment(root, ctx) { let b; return { diff --git a/test/js/samples/hydrated-void-element/expected.js b/test/js/samples/hydrated-void-element/expected.js index e53d16d925..c219f56328 100644 --- a/test/js/samples/hydrated-void-element/expected.js +++ b/test/js/samples/hydrated-void-element/expected.js @@ -14,7 +14,7 @@ import { space } from "svelte/internal"; -function create_fragment(ctx) { +function create_fragment(root, ctx) { let img; let img_src_value; let t; diff --git a/test/js/samples/if-block-complex/expected.js b/test/js/samples/if-block-complex/expected.js index a8244de8b0..830d7db616 100644 --- a/test/js/samples/if-block-complex/expected.js +++ b/test/js/samples/if-block-complex/expected.js @@ -28,7 +28,7 @@ function create_if_block(ctx) { }; } -function create_fragment(ctx) { +function create_fragment(root, ctx) { let show_if = /*item*/ ctx[0].divider && /*item*/ ctx[0].divider.includes(1); let if_block_anchor; let if_block = show_if && create_if_block(ctx); diff --git a/test/js/samples/if-block-no-update/expected.js b/test/js/samples/if-block-no-update/expected.js index c67b33fa85..8908e819c6 100644 --- a/test/js/samples/if-block-no-update/expected.js +++ b/test/js/samples/if-block-no-update/expected.js @@ -45,7 +45,7 @@ function create_if_block(ctx) { }; } -function create_fragment(ctx) { +function create_fragment(root, ctx) { let if_block_anchor; function select_block_type(ctx, dirty) { diff --git a/test/js/samples/if-block-simple/expected.js b/test/js/samples/if-block-simple/expected.js index 4cdd73cddb..d7582367d6 100644 --- a/test/js/samples/if-block-simple/expected.js +++ b/test/js/samples/if-block-simple/expected.js @@ -27,7 +27,7 @@ function create_if_block(ctx) { }; } -function create_fragment(ctx) { +function create_fragment(root, ctx) { let if_block_anchor; let if_block = /*foo*/ ctx[0] && create_if_block(ctx); @@ -43,7 +43,7 @@ function create_fragment(ctx) { p(ctx, [dirty]) { if (/*foo*/ ctx[0]) { if (if_block) { - + } else { if_block = create_if_block(ctx); if_block.c(); diff --git a/test/js/samples/import-meta/expected.js b/test/js/samples/import-meta/expected.js index ba77398321..52a40c4014 100644 --- a/test/js/samples/import-meta/expected.js +++ b/test/js/samples/import-meta/expected.js @@ -10,7 +10,7 @@ import { text } from "svelte/internal"; -function create_fragment(ctx) { +function create_fragment(root, ctx) { let t0; let t1; let t2_value = import.meta.url + ""; diff --git a/test/js/samples/initial-context/expected.js b/test/js/samples/initial-context/expected.js index 592e2a709e..98642f86c7 100644 --- a/test/js/samples/initial-context/expected.js +++ b/test/js/samples/initial-context/expected.js @@ -10,7 +10,7 @@ import { safe_not_equal } from "svelte/internal"; -function create_fragment(ctx) { +function create_fragment(root, ctx) { let button; let mounted; let dispose; diff --git a/test/js/samples/inline-style-optimized-multiple/expected.js b/test/js/samples/inline-style-optimized-multiple/expected.js index 0a9d0a1e8e..0673c38a81 100644 --- a/test/js/samples/inline-style-optimized-multiple/expected.js +++ b/test/js/samples/inline-style-optimized-multiple/expected.js @@ -10,7 +10,7 @@ import { set_style } from "svelte/internal"; -function create_fragment(ctx) { +function create_fragment(root, ctx) { let div; return { diff --git a/test/js/samples/inline-style-optimized-url/expected.js b/test/js/samples/inline-style-optimized-url/expected.js index 0debb03585..d98c5d4734 100644 --- a/test/js/samples/inline-style-optimized-url/expected.js +++ b/test/js/samples/inline-style-optimized-url/expected.js @@ -10,7 +10,7 @@ import { set_style } from "svelte/internal"; -function create_fragment(ctx) { +function create_fragment(root, ctx) { let div; return { diff --git a/test/js/samples/inline-style-optimized/expected.js b/test/js/samples/inline-style-optimized/expected.js index b7db0f1cf3..ac725d376e 100644 --- a/test/js/samples/inline-style-optimized/expected.js +++ b/test/js/samples/inline-style-optimized/expected.js @@ -10,7 +10,7 @@ import { set_style } from "svelte/internal"; -function create_fragment(ctx) { +function create_fragment(root, ctx) { let div; return { diff --git a/test/js/samples/inline-style-unoptimized/expected.js b/test/js/samples/inline-style-unoptimized/expected.js index 0688f14b9b..8f46142cf1 100644 --- a/test/js/samples/inline-style-unoptimized/expected.js +++ b/test/js/samples/inline-style-unoptimized/expected.js @@ -11,7 +11,7 @@ import { space } from "svelte/internal"; -function create_fragment(ctx) { +function create_fragment(root, ctx) { let div0; let t; let div1; diff --git a/test/js/samples/inline-style-without-updates/expected.js b/test/js/samples/inline-style-without-updates/expected.js index 375896f259..ec620c24a6 100644 --- a/test/js/samples/inline-style-without-updates/expected.js +++ b/test/js/samples/inline-style-without-updates/expected.js @@ -10,7 +10,7 @@ import { set_style } from "svelte/internal"; -function create_fragment(ctx) { +function create_fragment(root, ctx) { let div; return { diff --git a/test/js/samples/input-files/expected.js b/test/js/samples/input-files/expected.js index 8adc7443f5..64785c2dfe 100644 --- a/test/js/samples/input-files/expected.js +++ b/test/js/samples/input-files/expected.js @@ -11,7 +11,7 @@ import { safe_not_equal } from "svelte/internal"; -function create_fragment(ctx) { +function create_fragment(root, ctx) { let input; let mounted; let dispose; diff --git a/test/js/samples/input-no-initial-value/expected.js b/test/js/samples/input-no-initial-value/expected.js index 3354aa3111..15342023ae 100644 --- a/test/js/samples/input-no-initial-value/expected.js +++ b/test/js/samples/input-no-initial-value/expected.js @@ -15,7 +15,7 @@ import { space } from "svelte/internal"; -function create_fragment(ctx) { +function create_fragment(root, ctx) { let form; let input; let t0; diff --git a/test/js/samples/input-range/expected.js b/test/js/samples/input-range/expected.js index a855ca3653..4935e6cd91 100644 --- a/test/js/samples/input-range/expected.js +++ b/test/js/samples/input-range/expected.js @@ -14,7 +14,7 @@ import { to_number } from "svelte/internal"; -function create_fragment(ctx) { +function create_fragment(root, ctx) { let input; let mounted; let dispose; diff --git a/test/js/samples/input-value/expected.js b/test/js/samples/input-value/expected.js index 781a2ae603..d036d1edfe 100644 --- a/test/js/samples/input-value/expected.js +++ b/test/js/samples/input-value/expected.js @@ -14,7 +14,7 @@ import { text } from "svelte/internal"; -function create_fragment(ctx) { +function create_fragment(root, ctx) { let input; let t0; let h1; diff --git a/test/js/samples/input-without-blowback-guard/expected.js b/test/js/samples/input-without-blowback-guard/expected.js index 6c5b215623..cb5af32045 100644 --- a/test/js/samples/input-without-blowback-guard/expected.js +++ b/test/js/samples/input-without-blowback-guard/expected.js @@ -11,7 +11,7 @@ import { safe_not_equal } from "svelte/internal"; -function create_fragment(ctx) { +function create_fragment(root, ctx) { let input; let mounted; let dispose; diff --git a/test/js/samples/instrumentation-script-if-no-block/expected.js b/test/js/samples/instrumentation-script-if-no-block/expected.js index 7f51c64550..bcd7ecfda1 100644 --- a/test/js/samples/instrumentation-script-if-no-block/expected.js +++ b/test/js/samples/instrumentation-script-if-no-block/expected.js @@ -14,7 +14,7 @@ import { text } from "svelte/internal"; -function create_fragment(ctx) { +function create_fragment(root, ctx) { let button; let t1; let p; diff --git a/test/js/samples/instrumentation-script-main-block/expected.js b/test/js/samples/instrumentation-script-main-block/expected.js index a471a50b37..b6e2f9f201 100644 --- a/test/js/samples/instrumentation-script-main-block/expected.js +++ b/test/js/samples/instrumentation-script-main-block/expected.js @@ -12,7 +12,7 @@ import { text } from "svelte/internal"; -function create_fragment(ctx) { +function create_fragment(root, ctx) { let p; let t0; let t1; diff --git a/test/js/samples/instrumentation-script-x-equals-x/expected.js b/test/js/samples/instrumentation-script-x-equals-x/expected.js index ea0d65acb9..73afe3d91a 100644 --- a/test/js/samples/instrumentation-script-x-equals-x/expected.js +++ b/test/js/samples/instrumentation-script-x-equals-x/expected.js @@ -14,7 +14,7 @@ import { text } from "svelte/internal"; -function create_fragment(ctx) { +function create_fragment(root, ctx) { let button; let t1; let p; diff --git a/test/js/samples/instrumentation-template-if-no-block/expected.js b/test/js/samples/instrumentation-template-if-no-block/expected.js index 0c2713a9cc..6fa7239074 100644 --- a/test/js/samples/instrumentation-template-if-no-block/expected.js +++ b/test/js/samples/instrumentation-template-if-no-block/expected.js @@ -14,7 +14,7 @@ import { text } from "svelte/internal"; -function create_fragment(ctx) { +function create_fragment(root, ctx) { let button; let t1; let p; diff --git a/test/js/samples/instrumentation-template-x-equals-x/expected.js b/test/js/samples/instrumentation-template-x-equals-x/expected.js index 55cd310661..0e65e9290e 100644 --- a/test/js/samples/instrumentation-template-x-equals-x/expected.js +++ b/test/js/samples/instrumentation-template-x-equals-x/expected.js @@ -14,7 +14,7 @@ import { text } from "svelte/internal"; -function create_fragment(ctx) { +function create_fragment(root, ctx) { let button; let t1; let p; diff --git a/test/js/samples/legacy-input-type/expected.js b/test/js/samples/legacy-input-type/expected.js index 2b76a48522..7098b140e7 100644 --- a/test/js/samples/legacy-input-type/expected.js +++ b/test/js/samples/legacy-input-type/expected.js @@ -10,7 +10,7 @@ import { set_input_type } from "svelte/internal"; -function create_fragment(ctx) { +function create_fragment(root, ctx) { let input; return { diff --git a/test/js/samples/loop-protect/expected.js b/test/js/samples/loop-protect/expected.js index 26721d6be6..0f7a5db8ba 100644 --- a/test/js/samples/loop-protect/expected.js +++ b/test/js/samples/loop-protect/expected.js @@ -18,7 +18,7 @@ import { const { console: console_1 } = globals; const file = undefined; -function create_fragment(ctx) { +function create_fragment(root, ctx) { let div; const block = { diff --git a/test/js/samples/media-bindings/expected.js b/test/js/samples/media-bindings/expected.js index 867d4a7dad..780912f25b 100644 --- a/test/js/samples/media-bindings/expected.js +++ b/test/js/samples/media-bindings/expected.js @@ -14,7 +14,7 @@ import { time_ranges_to_array } from "svelte/internal"; -function create_fragment(ctx) { +function create_fragment(root, ctx) { let audio; let audio_updating = false; let audio_animationframe; diff --git a/test/js/samples/non-imported-component/expected.js b/test/js/samples/non-imported-component/expected.js index 5a6b8e8bb7..cd2574023f 100644 --- a/test/js/samples/non-imported-component/expected.js +++ b/test/js/samples/non-imported-component/expected.js @@ -16,7 +16,7 @@ import { import Imported from "Imported.svelte"; -function create_fragment(ctx) { +function create_fragment(root, ctx) { let imported; let t; let nonimported; diff --git a/test/js/samples/non-mutable-reference/expected.js b/test/js/samples/non-mutable-reference/expected.js index 93f2145a2e..1e658158f5 100644 --- a/test/js/samples/non-mutable-reference/expected.js +++ b/test/js/samples/non-mutable-reference/expected.js @@ -9,7 +9,7 @@ import { safe_not_equal } from "svelte/internal"; -function create_fragment(ctx) { +function create_fragment(root, ctx) { let h1; return { diff --git a/test/js/samples/optional-chaining/expected.js b/test/js/samples/optional-chaining/expected.js index 8aa94796c1..670bcbb3f3 100644 --- a/test/js/samples/optional-chaining/expected.js +++ b/test/js/samples/optional-chaining/expected.js @@ -17,7 +17,7 @@ import { transition_out } from "svelte/internal"; -function create_fragment(ctx) { +function create_fragment(root, ctx) { let t0_value = /*a*/ ctx[0].normal + ""; let t0; let t1_value = /*b*/ ctx[1]?.optional + ""; diff --git a/test/js/samples/reactive-class-optimized/expected.js b/test/js/samples/reactive-class-optimized/expected.js index b7c2c3a60b..5ea2a21c30 100644 --- a/test/js/samples/reactive-class-optimized/expected.js +++ b/test/js/samples/reactive-class-optimized/expected.js @@ -15,7 +15,7 @@ import { import { reactiveStoreVal, unreactiveExport } from "./store"; -function create_fragment(ctx) { +function create_fragment(root, ctx) { let div0; let t0; let div1; diff --git a/test/js/samples/select-dynamic-value/expected.js b/test/js/samples/select-dynamic-value/expected.js index 8777cd2600..971de67044 100644 --- a/test/js/samples/select-dynamic-value/expected.js +++ b/test/js/samples/select-dynamic-value/expected.js @@ -11,7 +11,7 @@ import { select_option } from "svelte/internal"; -function create_fragment(ctx) { +function create_fragment(root, ctx) { let select; let option0; let option1; diff --git a/test/js/samples/src-attribute-check/expected.js b/test/js/samples/src-attribute-check/expected.js index 93638edfb4..a4aa046476 100644 --- a/test/js/samples/src-attribute-check/expected.js +++ b/test/js/samples/src-attribute-check/expected.js @@ -13,7 +13,7 @@ import { space } from "svelte/internal"; -function create_fragment(ctx) { +function create_fragment(root, ctx) { let img0; let img0_src_value; let t; diff --git a/test/js/samples/svg-title/expected.js b/test/js/samples/svg-title/expected.js index cd7ae3b551..d4b9fcec27 100644 --- a/test/js/samples/svg-title/expected.js +++ b/test/js/samples/svg-title/expected.js @@ -11,7 +11,7 @@ import { text } from "svelte/internal"; -function create_fragment(ctx) { +function create_fragment(root, ctx) { let svg; let title; let t; diff --git a/test/js/samples/title/expected.js b/test/js/samples/title/expected.js index b10f569759..6b967a65d0 100644 --- a/test/js/samples/title/expected.js +++ b/test/js/samples/title/expected.js @@ -1,7 +1,7 @@ /* generated by Svelte vX.Y.Z */ import { SvelteComponent, init, noop, safe_not_equal } from "svelte/internal"; -function create_fragment(ctx) { +function create_fragment(root, ctx) { let title_value; document.title = title_value = "a " + /*custom*/ ctx[0] + " title"; diff --git a/test/js/samples/transition-local/expected.js b/test/js/samples/transition-local/expected.js index ea3d9db3d7..ac958fbc5b 100644 --- a/test/js/samples/transition-local/expected.js +++ b/test/js/samples/transition-local/expected.js @@ -80,7 +80,7 @@ function create_if_block_1(ctx) { }; } -function create_fragment(ctx) { +function create_fragment(root, ctx) { let if_block_anchor; let if_block = /*x*/ ctx[0] && create_if_block(ctx); @@ -117,7 +117,7 @@ function create_fragment(ctx) { } function foo() { - + } function instance($$self, $$props, $$invalidate) { diff --git a/test/js/samples/transition-repeated-outro/expected.js b/test/js/samples/transition-repeated-outro/expected.js index 12483ab91a..c3d4288438 100644 --- a/test/js/samples/transition-repeated-outro/expected.js +++ b/test/js/samples/transition-repeated-outro/expected.js @@ -46,7 +46,7 @@ function create_if_block(ctx) { }; } -function create_fragment(ctx) { +function create_fragment(root, ctx) { let if_block_anchor; let current; let if_block = /*num*/ ctx[0] < 5 && create_if_block(ctx); diff --git a/test/js/samples/unchanged-expression/expected.js b/test/js/samples/unchanged-expression/expected.js index 673d5b6abc..5468533717 100644 --- a/test/js/samples/unchanged-expression/expected.js +++ b/test/js/samples/unchanged-expression/expected.js @@ -13,7 +13,7 @@ import { text } from "svelte/internal"; -function create_fragment(ctx) { +function create_fragment(root, ctx) { let div0; let p0; let t1; diff --git a/test/js/samples/unreferenced-state-not-invalidated/expected.js b/test/js/samples/unreferenced-state-not-invalidated/expected.js index 53044c7ed6..68b2101c91 100644 --- a/test/js/samples/unreferenced-state-not-invalidated/expected.js +++ b/test/js/samples/unreferenced-state-not-invalidated/expected.js @@ -14,7 +14,7 @@ import { import { onMount } from "svelte"; -function create_fragment(ctx) { +function create_fragment(root, ctx) { let p; let t; diff --git a/test/js/samples/use-elements-as-anchors/expected.js b/test/js/samples/use-elements-as-anchors/expected.js index d07411518e..3bc90000c3 100644 --- a/test/js/samples/use-elements-as-anchors/expected.js +++ b/test/js/samples/use-elements-as-anchors/expected.js @@ -101,7 +101,7 @@ function create_if_block(ctx) { }; } -function create_fragment(ctx) { +function create_fragment(root, ctx) { let div; let t0; let p0; @@ -158,7 +158,7 @@ function create_fragment(ctx) { p(ctx, [dirty]) { if (/*a*/ ctx[0]) { if (if_block0) { - + } else { if_block0 = create_if_block_4(ctx); if_block0.c(); @@ -171,7 +171,7 @@ function create_fragment(ctx) { if (/*b*/ ctx[1]) { if (if_block1) { - + } else { if_block1 = create_if_block_3(ctx); if_block1.c(); @@ -184,7 +184,7 @@ function create_fragment(ctx) { if (/*c*/ ctx[2]) { if (if_block2) { - + } else { if_block2 = create_if_block_2(ctx); if_block2.c(); @@ -197,7 +197,7 @@ function create_fragment(ctx) { if (/*d*/ ctx[3]) { if (if_block3) { - + } else { if_block3 = create_if_block_1(ctx); if_block3.c(); @@ -210,7 +210,7 @@ function create_fragment(ctx) { if (/*e*/ ctx[4]) { if (if_block4) { - + } else { if_block4 = create_if_block(ctx); if_block4.c(); diff --git a/test/js/samples/valid-inner-html-for-static-element/expected.js b/test/js/samples/valid-inner-html-for-static-element/expected.js index f1ced27ba4..b7ce927ef1 100644 --- a/test/js/samples/valid-inner-html-for-static-element/expected.js +++ b/test/js/samples/valid-inner-html-for-static-element/expected.js @@ -9,7 +9,7 @@ import { safe_not_equal } from "svelte/internal"; -function create_fragment(ctx) { +function create_fragment(root, ctx) { let div; return { diff --git a/test/js/samples/video-bindings/expected.js b/test/js/samples/video-bindings/expected.js index 8afa670bbb..86fe224402 100644 --- a/test/js/samples/video-bindings/expected.js +++ b/test/js/samples/video-bindings/expected.js @@ -14,7 +14,7 @@ import { safe_not_equal } from "svelte/internal"; -function create_fragment(ctx) { +function create_fragment(root, ctx) { let video; let video_updating = false; let video_animationframe; diff --git a/test/js/samples/window-binding-online/expected.js b/test/js/samples/window-binding-online/expected.js index 887195bce1..0d064399b4 100644 --- a/test/js/samples/window-binding-online/expected.js +++ b/test/js/samples/window-binding-online/expected.js @@ -9,7 +9,7 @@ import { safe_not_equal } from "svelte/internal"; -function create_fragment(ctx) { +function create_fragment(root, ctx) { let mounted; let dispose; add_render_callback(/*onlinestatuschanged*/ ctx[1]); diff --git a/test/js/samples/window-binding-scroll/expected.js b/test/js/samples/window-binding-scroll/expected.js index 09a4d3737d..bcc4482cf9 100644 --- a/test/js/samples/window-binding-scroll/expected.js +++ b/test/js/samples/window-binding-scroll/expected.js @@ -14,7 +14,7 @@ import { text } from "svelte/internal"; -function create_fragment(ctx) { +function create_fragment(root, ctx) { let scrolling = false; let clear_scrolling = () => {