diff --git a/src/compiler/compile/nodes/EventHandler.ts b/src/compiler/compile/nodes/EventHandler.ts index 110542d0b8b8..e7aa0e34d300 100644 --- a/src/compiler/compile/nodes/EventHandler.ts +++ b/src/compiler/compile/nodes/EventHandler.ts @@ -1,7 +1,6 @@ import Node from './shared/Node'; import Expression from './shared/Expression'; import Component from '../Component'; -import { sanitize } from '../../utils/names'; import { Identifier } from 'estree'; export default class EventHandler extends Node { @@ -42,8 +41,6 @@ export default class EventHandler extends Node { } } } - } else { - this.handler_name = component.get_unique_name(`${sanitize(this.name)}_handler`); } } diff --git a/src/compiler/compile/render_dom/Block.ts b/src/compiler/compile/render_dom/Block.ts index f5c4281710fa..544041459c43 100644 --- a/src/compiler/compile/render_dom/Block.ts +++ b/src/compiler/compile/render_dom/Block.ts @@ -52,6 +52,7 @@ export default class Block { claim: Array; hydrate: Array; mount: Array; + bubble: Array; measure: Array; fix: Array; animate: Array; @@ -100,6 +101,7 @@ export default class Block { claim: [], hydrate: [], mount: [], + bubble: [], measure: [], fix: [], animate: [], @@ -292,9 +294,39 @@ export default class Block { }`; } + if (this.chunks.bubble.length === 0) { + properties.bubble = noop; + } else { + const mounted: Identifier = { + type: 'Identifier', + name: '#mounted' + }; + this.add_variable(mounted, x`false`); + const bubble_fns: Identifier = { + type: 'Identifier', + name: '#bubble_fns' + }; + this.add_variable(bubble_fns, x`[]`); + + properties.bubble = x`function #bubble(type, callback) { + const local_dispose = []; + const fn = () => { + ${this.chunks.bubble} + #dispose.push(...local_dispose); + } + if (${mounted}) fn() + else ${bubble_fns}.push(fn); + return () => @run_all(local_dispose); + }`; + this.chunks.mount.push(b` + ${mounted} = true; + @run_all(${bubble_fns}); + `); + } + if (this.chunks.mount.length === 0) { properties.mount = noop; - } else if (this.event_listeners.length === 0) { + } else if (this.event_listeners.length === 0 && this.chunks.bubble.length === 0) { properties.mount = x`function #mount(#target, anchor) { ${this.chunks.mount} }`; @@ -378,6 +410,7 @@ export default class Block { l: ${properties.claim}, h: ${properties.hydrate}, m: ${properties.mount}, + b: ${properties.bubble}, p: ${properties.update}, r: ${properties.measure}, f: ${properties.fix}, @@ -428,6 +461,7 @@ export default class Block { this.chunks.hydrate.length > 0 || this.chunks.claim.length > 0 || this.chunks.mount.length > 0 || + this.chunks.bubble.length > 0 || this.chunks.update.length > 0 || this.chunks.destroy.length > 0 || this.has_animation; @@ -451,7 +485,7 @@ export default class Block { } render_listeners(chunk: string = '') { - if (this.event_listeners.length > 0) { + if (this.chunks.bubble.length > 0 || this.event_listeners.length > 0) { const dispose: Identifier = { type: 'Identifier', name: `#dispose${chunk}` @@ -459,7 +493,18 @@ export default class Block { this.add_variable(dispose); - if (this.event_listeners.length === 1) { + if (this.chunks.bubble.length > 0 || this.event_listeners.length > 1) { + this.chunks.mount.push(b` + if (#remount) @run_all(${dispose}); + ${dispose} = [ + ${this.event_listeners.length > 0 ? this.event_listeners : ''} + ]; + `); + + this.chunks.destroy.push( + b`@run_all(${dispose});` + ); + } else { this.chunks.mount.push( b` if (#remount) ${dispose}(); @@ -470,18 +515,7 @@ export default class Block { this.chunks.destroy.push( b`${dispose}();` ); - } else { - this.chunks.mount.push(b` - if (#remount) @run_all(${dispose}); - ${dispose} = [ - ${this.event_listeners} - ]; - `); - - this.chunks.destroy.push( - b`@run_all(${dispose});` - ); } } } -} \ No newline at end of file +} diff --git a/src/compiler/compile/render_dom/wrappers/Element/EventHandler.ts b/src/compiler/compile/render_dom/wrappers/Element/EventHandler.ts index 157e186ea6eb..20ec317b3ac6 100644 --- a/src/compiler/compile/render_dom/wrappers/Element/EventHandler.ts +++ b/src/compiler/compile/render_dom/wrappers/Element/EventHandler.ts @@ -14,20 +14,10 @@ export default class EventHandlerWrapper { constructor(node: EventHandler, parent: Wrapper) { this.node = node; this.parent = parent; - - if (!node.expression) { - this.parent.renderer.add_to_context(node.handler_name.name); - - this.parent.renderer.component.partly_hoisted.push(b` - function ${node.handler_name.name}(event) { - @bubble($$self, event); - } - `); - } } get_snippet(block) { - const snippet = this.node.expression ? this.node.expression.manipulate(block) : block.renderer.reference(this.node.handler_name); + const snippet = this.node.expression.manipulate(block); if (this.node.reassigned) { block.maintain_context = true; @@ -37,6 +27,15 @@ export default class EventHandlerWrapper { } render(block: Block, target: string | Expression) { + if (!this.node.expression) { + if (this.node.name === "*") + block.chunks.bubble.push(b`local_dispose.push(@listen(${target}, type, callback))`); + else + block.chunks.bubble.push(b`if (type === "${this.node.name}") local_dispose.push(@listen(${target}, "${this.node.name}", callback));`); + + return; + } + let snippet = this.get_snippet(block); if (this.node.modifiers.has('preventDefault')) snippet = x`@prevent_default(${snippet})`; diff --git a/src/compiler/compile/render_dom/wrappers/InlineComponent/index.ts b/src/compiler/compile/render_dom/wrappers/InlineComponent/index.ts index 4b1e787cbe92..902491a17c8e 100644 --- a/src/compiler/compile/render_dom/wrappers/InlineComponent/index.ts +++ b/src/compiler/compile/render_dom/wrappers/InlineComponent/index.ts @@ -391,13 +391,24 @@ export default class InlineComponentWrapper extends Wrapper { return b`@binding_callbacks.push(() => @bind(${this.var}, '${binding.name}', ${id}));`; }); - const munged_handlers = this.node.handlers.map(handler => { - const event_handler = new EventHandler(handler, this); - let snippet = event_handler.get_snippet(block); - if (handler.modifiers.has('once')) snippet = x`@once(${snippet})`; - - return b`${name}.$on("${handler.name}", ${snippet});`; - }); + const munged_handlers = this.node.handlers + .filter(handler => { + if (handler.expression) return true; + + if (handler.name === "*") + block.chunks.bubble.push(b`local_dispose.push(${name}.$on(type, callback))`); + else + block.chunks.bubble.push(b`if (type === "${handler.name}") local_dispose.push(${name}.$on("${handler.name}", callback));`); + + return false; + }) + .map(handler => { + const event_handler = new EventHandler(handler, this); + let snippet = event_handler.get_snippet(block); + if (handler.modifiers.has('once')) snippet = x`@once(${snippet})`; + + return b`${name}.$on("${handler.name}", ${snippet});`; + }); if (this.node.name === 'svelte:component') { const switch_value = block.get_unique_name('switch_value'); diff --git a/src/runtime/internal/Component.ts b/src/runtime/internal/Component.ts index 7d2a92fa1bce..bf834771d1e0 100644 --- a/src/runtime/internal/Component.ts +++ b/src/runtime/internal/Component.ts @@ -11,6 +11,7 @@ interface Fragment { /* claim */ l: (nodes: any) => void; /* hydrate */ h: () => void; /* mount */ m: (target: HTMLElement, anchor: any) => void; + /* bubble */ b: (type: string, callback: Function) => Function; /* update */ p: (ctx: any, dirty: any) => void; /* measure */ r: () => void; /* fix */ f: () => void; @@ -215,10 +216,12 @@ export class SvelteComponent { } $on(type, callback) { + const dispose = this.$$.fragment && this.$$.fragment.b(type, callback) || noop; const callbacks = (this.$$.callbacks[type] || (this.$$.callbacks[type] = [])); callbacks.push(callback); return () => { + dispose(); const index = callbacks.indexOf(callback); if (index !== -1) callbacks.splice(index, 1); }; diff --git a/test/js/samples/action-custom-event-handler/expected.js b/test/js/samples/action-custom-event-handler/expected.js index aa2941f404c8..6581e1df768b 100644 --- a/test/js/samples/action-custom-event-handler/expected.js +++ b/test/js/samples/action-custom-event-handler/expected.js @@ -26,6 +26,7 @@ function create_fragment(ctx) { if (remount) dispose(); dispose = action_destroyer(foo_action = foo.call(null, button, /*foo_function*/ ctx[1])); }, + b: noop, p(ctx, [dirty]) { if (foo_action && is_function(foo_action.update) && dirty & /*bar*/ 1) foo_action.update.call(null, /*foo_function*/ ctx[1]); }, diff --git a/test/js/samples/action/expected.js b/test/js/samples/action/expected.js index 1b3f5cc94583..a9880ce54b6c 100644 --- a/test/js/samples/action/expected.js +++ b/test/js/samples/action/expected.js @@ -27,6 +27,7 @@ function create_fragment(ctx) { if (remount) dispose(); dispose = action_destroyer(link_action = link.call(null, a)); }, + b: noop, p: noop, i: noop, o: noop, diff --git a/test/js/samples/bind-online/expected.js b/test/js/samples/bind-online/expected.js index fa955e4fd59b..0fd83af42033 100644 --- a/test/js/samples/bind-online/expected.js +++ b/test/js/samples/bind-online/expected.js @@ -23,6 +23,7 @@ function create_fragment(ctx) { listen(window, "offline", /*onlinestatuschanged*/ ctx[1]) ]; }, + b: noop, p: noop, i: noop, o: noop, diff --git a/test/js/samples/bind-open/expected.js b/test/js/samples/bind-open/expected.js index 77b68f1b27fc..689edf89521c 100644 --- a/test/js/samples/bind-open/expected.js +++ b/test/js/samples/bind-open/expected.js @@ -27,6 +27,7 @@ function create_fragment(ctx) { if (remount) dispose(); dispose = listen(details, "toggle", /*details_toggle_handler*/ ctx[1]); }, + b: noop, p(ctx, [dirty]) { if (dirty & /*open*/ 1) { details.open = /*open*/ ctx[0]; diff --git a/test/js/samples/bind-width-height/expected.js b/test/js/samples/bind-width-height/expected.js index 5c1888b7db02..a50d32be9570 100644 --- a/test/js/samples/bind-width-height/expected.js +++ b/test/js/samples/bind-width-height/expected.js @@ -25,6 +25,7 @@ function create_fragment(ctx) { insert(target, div, anchor); div_resize_listener = add_resize_listener(div, /*div_elementresize_handler*/ ctx[2].bind(div)); }, + b: noop, p: noop, i: noop, o: noop, diff --git a/test/js/samples/bindings-readonly-order/expected.js b/test/js/samples/bindings-readonly-order/expected.js index 00e8a5bf00cc..26f1b265ea09 100644 --- a/test/js/samples/bindings-readonly-order/expected.js +++ b/test/js/samples/bindings-readonly-order/expected.js @@ -38,6 +38,7 @@ function create_fragment(ctx) { listen(input1, "change", /*input1_change_handler*/ ctx[2]) ]; }, + b: noop, p: noop, i: noop, o: noop, diff --git a/test/js/samples/capture-inject-dev-only/expected.js b/test/js/samples/capture-inject-dev-only/expected.js index 3e355e149186..a16f3b0241d4 100644 --- a/test/js/samples/capture-inject-dev-only/expected.js +++ b/test/js/samples/capture-inject-dev-only/expected.js @@ -38,6 +38,7 @@ function create_fragment(ctx) { if (remount) dispose(); dispose = listen(input, "input", /*input_input_handler*/ ctx[1]); }, + b: noop, p(ctx, [dirty]) { if (dirty & /*foo*/ 1) set_data(t0, /*foo*/ ctx[0]); diff --git a/test/js/samples/capture-inject-state/expected.js b/test/js/samples/capture-inject-state/expected.js index cd719ac5d25f..2dcca26c5045 100644 --- a/test/js/samples/capture-inject-state/expected.js +++ b/test/js/samples/capture-inject-state/expected.js @@ -67,6 +67,7 @@ function create_fragment(ctx) { append_dev(p, t9); append_dev(p, t10); }, + b: noop, p: function update(ctx, [dirty]) { if (dirty & /*prop*/ 1) set_data_dev(t0, /*prop*/ ctx[0]); if (dirty & /*realName*/ 2) set_data_dev(t2, /*realName*/ ctx[1]); diff --git a/test/js/samples/collapses-text-around-comments/expected.js b/test/js/samples/collapses-text-around-comments/expected.js index 6fef0f9490d8..f4bac286d4a0 100644 --- a/test/js/samples/collapses-text-around-comments/expected.js +++ b/test/js/samples/collapses-text-around-comments/expected.js @@ -34,6 +34,7 @@ function create_fragment(ctx) { insert(target, p, anchor); append(p, t); }, + b: noop, p(ctx, [dirty]) { if (dirty & /*foo*/ 1) set_data(t, /*foo*/ ctx[0]); }, diff --git a/test/js/samples/component-static-array/expected.js b/test/js/samples/component-static-array/expected.js index 44e8dbfe330f..35f4e6025cc8 100644 --- a/test/js/samples/component-static-array/expected.js +++ b/test/js/samples/component-static-array/expected.js @@ -23,6 +23,7 @@ function create_fragment(ctx) { mount_component(nested, target, anchor); current = true; }, + b: noop, p: noop, i(local) { if (current) return; diff --git a/test/js/samples/component-static-immutable/expected.js b/test/js/samples/component-static-immutable/expected.js index a7dd8128fa94..7d94b82833f8 100644 --- a/test/js/samples/component-static-immutable/expected.js +++ b/test/js/samples/component-static-immutable/expected.js @@ -23,6 +23,7 @@ function create_fragment(ctx) { mount_component(nested, target, anchor); current = true; }, + b: noop, p: noop, i(local) { if (current) return; diff --git a/test/js/samples/component-static-immutable2/expected.js b/test/js/samples/component-static-immutable2/expected.js index a7dd8128fa94..7d94b82833f8 100644 --- a/test/js/samples/component-static-immutable2/expected.js +++ b/test/js/samples/component-static-immutable2/expected.js @@ -23,6 +23,7 @@ function create_fragment(ctx) { mount_component(nested, target, anchor); current = true; }, + b: noop, p: noop, i(local) { if (current) return; diff --git a/test/js/samples/component-static-var/expected.js b/test/js/samples/component-static-var/expected.js index c032a0636d42..dc9712961d5d 100644 --- a/test/js/samples/component-static-var/expected.js +++ b/test/js/samples/component-static-var/expected.js @@ -9,6 +9,7 @@ import { insert, listen, mount_component, + noop, safe_not_equal, set_input_value, space, @@ -47,6 +48,7 @@ function create_fragment(ctx) { if (remount) dispose(); dispose = listen(input, "input", /*input_input_handler*/ ctx[1]); }, + b: noop, p(ctx, [dirty]) { const bar_changes = {}; if (dirty & /*z*/ 1) bar_changes.x = /*z*/ ctx[0]; diff --git a/test/js/samples/component-static/expected.js b/test/js/samples/component-static/expected.js index 26c63f550b65..492f3000553e 100644 --- a/test/js/samples/component-static/expected.js +++ b/test/js/samples/component-static/expected.js @@ -23,6 +23,7 @@ function create_fragment(ctx) { mount_component(nested, target, anchor); current = true; }, + b: noop, p: noop, i(local) { if (current) return; diff --git a/test/js/samples/component-store-access-invalidate/expected.js b/test/js/samples/component-store-access-invalidate/expected.js index 4c7bfd7009c3..c35821325ea2 100644 --- a/test/js/samples/component-store-access-invalidate/expected.js +++ b/test/js/samples/component-store-access-invalidate/expected.js @@ -28,6 +28,7 @@ function create_fragment(ctx) { insert(target, h1, anchor); append(h1, t); }, + b: noop, p(ctx, [dirty]) { if (dirty & /*$foo*/ 1) set_data(t, /*$foo*/ ctx[0]); }, diff --git a/test/js/samples/component-store-reassign-invalidate/expected.js b/test/js/samples/component-store-reassign-invalidate/expected.js index b33047d8f377..89ac1ccdb245 100644 --- a/test/js/samples/component-store-reassign-invalidate/expected.js +++ b/test/js/samples/component-store-reassign-invalidate/expected.js @@ -40,6 +40,7 @@ function create_fragment(ctx) { if (remount) dispose(); dispose = listen(button, "click", /*click_handler*/ ctx[2]); }, + b: noop, p(ctx, [dirty]) { if (dirty & /*$foo*/ 2) set_data(t0, /*$foo*/ ctx[1]); }, diff --git a/test/js/samples/css-media-query/expected.js b/test/js/samples/css-media-query/expected.js index f4776700599d..8dd51fa5d91e 100644 --- a/test/js/samples/css-media-query/expected.js +++ b/test/js/samples/css-media-query/expected.js @@ -29,6 +29,7 @@ function create_fragment(ctx) { m(target, anchor) { insert(target, div, anchor); }, + b: noop, p: noop, i: noop, o: noop, diff --git a/test/js/samples/css-shadow-dom-keyframes/expected.js b/test/js/samples/css-shadow-dom-keyframes/expected.js index a0a0ebe0211b..a11d1522f03e 100644 --- a/test/js/samples/css-shadow-dom-keyframes/expected.js +++ b/test/js/samples/css-shadow-dom-keyframes/expected.js @@ -21,6 +21,7 @@ function create_fragment(ctx) { m(target, anchor) { insert(target, div, anchor); }, + b: noop, p: noop, i: noop, o: noop, diff --git a/test/js/samples/data-attribute/expected.js b/test/js/samples/data-attribute/expected.js index 49ad2f2626ba..09916bc213b6 100644 --- a/test/js/samples/data-attribute/expected.js +++ b/test/js/samples/data-attribute/expected.js @@ -29,6 +29,7 @@ function create_fragment(ctx) { insert(target, t, anchor); insert(target, div1, anchor); }, + b: noop, p(ctx, [dirty]) { if (dirty & /*bar*/ 1) { attr(div1, "data-foo", /*bar*/ ctx[0]); diff --git a/test/js/samples/debug-empty/expected.js b/test/js/samples/debug-empty/expected.js index dd142adb26b2..0fa95aefcbf9 100644 --- a/test/js/samples/debug-empty/expected.js +++ b/test/js/samples/debug-empty/expected.js @@ -45,6 +45,7 @@ function create_fragment(ctx) { append_dev(h1, t2); insert_dev(target, t3, anchor); }, + b: noop, p: function update(ctx, [dirty]) { if (dirty & /*name*/ 1) set_data_dev(t1, /*name*/ ctx[0]); debugger; 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 977702b99f5c..c24120ba0755 100644 --- a/test/js/samples/debug-foo-bar-baz-things/expected.js +++ b/test/js/samples/debug-foo-bar-baz-things/expected.js @@ -55,6 +55,7 @@ function create_each_block(ctx) { append_dev(span, t0); insert_dev(target, t1, anchor); }, + b: noop, p: function update(ctx, dirty) { if (dirty & /*things*/ 1 && t0_value !== (t0_value = /*thing*/ ctx[4].name + "")) set_data_dev(t0, t0_value); @@ -122,6 +123,7 @@ function create_fragment(ctx) { append_dev(p, t1); append_dev(p, t2); }, + b: noop, p: function update(ctx, [dirty]) { if (dirty & /*things*/ 1) { each_value = /*things*/ ctx[0]; diff --git a/test/js/samples/debug-foo/expected.js b/test/js/samples/debug-foo/expected.js index fe62ff77bfb1..9a87dbec97dd 100644 --- a/test/js/samples/debug-foo/expected.js +++ b/test/js/samples/debug-foo/expected.js @@ -52,6 +52,7 @@ function create_each_block(ctx) { append_dev(span, t0); insert_dev(target, t1, anchor); }, + b: noop, p: function update(ctx, dirty) { if (dirty & /*things*/ 1 && t0_value !== (t0_value = /*thing*/ ctx[2].name + "")) set_data_dev(t0, t0_value); @@ -116,6 +117,7 @@ function create_fragment(ctx) { append_dev(p, t1); append_dev(p, t2); }, + b: noop, p: function update(ctx, [dirty]) { if (dirty & /*things*/ 1) { each_value = /*things*/ ctx[0]; diff --git a/test/js/samples/debug-hoisted/expected.js b/test/js/samples/debug-hoisted/expected.js index 0e634297f08f..82ac923ea9bc 100644 --- a/test/js/samples/debug-hoisted/expected.js +++ b/test/js/samples/debug-hoisted/expected.js @@ -24,6 +24,7 @@ function create_fragment(ctx) { throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option"); }, m: noop, + b: noop, p: function update(ctx, [dirty]) { if (dirty & /*obj, kobzol*/ 3) { const obj = /*obj*/ ctx[0]; diff --git a/test/js/samples/debug-no-dependencies/expected.js b/test/js/samples/debug-no-dependencies/expected.js index 76068e8cf464..259fd5c13fe6 100644 --- a/test/js/samples/debug-no-dependencies/expected.js +++ b/test/js/samples/debug-no-dependencies/expected.js @@ -45,6 +45,7 @@ function create_each_block(ctx) { insert_dev(target, t0, anchor); insert_dev(target, t1, anchor); }, + b: noop, p: noop, d: function destroy(detaching) { if (detaching) detach_dev(t0); @@ -91,6 +92,7 @@ function create_fragment(ctx) { insert_dev(target, each_1_anchor, anchor); }, + b: noop, p: function update(ctx, [dirty]) { if (dirty & /*things*/ 0) { each_value = things; diff --git a/test/js/samples/deconflict-builtins/expected.js b/test/js/samples/deconflict-builtins/expected.js index fb98844ef7a9..a49f24fa87f2 100644 --- a/test/js/samples/deconflict-builtins/expected.js +++ b/test/js/samples/deconflict-builtins/expected.js @@ -35,6 +35,7 @@ function create_each_block(ctx) { insert(target, span, anchor); append(span, t); }, + b: noop, p(ctx, dirty) { if (dirty & /*createElement*/ 1 && t_value !== (t_value = /*node*/ ctx[1] + "")) set_data(t, t_value); }, @@ -68,6 +69,7 @@ function create_fragment(ctx) { insert(target, each_1_anchor, anchor); }, + b: noop, p(ctx, [dirty]) { if (dirty & /*createElement*/ 1) { each_value = /*createElement*/ ctx[0]; 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 0a50e2cd970a..c185df73db93 100644 --- a/test/js/samples/dev-warning-missing-data-computed/expected.js +++ b/test/js/samples/dev-warning-missing-data-computed/expected.js @@ -42,6 +42,7 @@ function create_fragment(ctx) { append_dev(p, t1); append_dev(p, t2); }, + b: noop, p: function update(ctx, [dirty]) { if (dirty & /*foo*/ 1 && t0_value !== (t0_value = Math.max(0, /*foo*/ ctx[0]) + "")) set_data_dev(t0, t0_value); if (dirty & /*bar*/ 2) set_data_dev(t2, /*bar*/ ctx[1]); diff --git a/test/js/samples/dont-invalidate-this/expected.js b/test/js/samples/dont-invalidate-this/expected.js index ba9e7152d75c..6f2539c28aa5 100644 --- a/test/js/samples/dont-invalidate-this/expected.js +++ b/test/js/samples/dont-invalidate-this/expected.js @@ -23,6 +23,7 @@ function create_fragment(ctx) { if (remount) dispose(); dispose = listen(input, "input", make_uppercase); }, + b: noop, p: noop, i: noop, o: noop, diff --git a/test/js/samples/dynamic-import/expected.js b/test/js/samples/dynamic-import/expected.js index 4394e7d8a996..ba8797e5bceb 100644 --- a/test/js/samples/dynamic-import/expected.js +++ b/test/js/samples/dynamic-import/expected.js @@ -25,6 +25,7 @@ function create_fragment(ctx) { mount_component(lazyload, target, anchor); current = true; }, + b: noop, p: noop, i(local) { if (current) return; diff --git a/test/js/samples/each-block-array-literal/expected.js b/test/js/samples/each-block-array-literal/expected.js index 10d835cf7805..3f9ac8b8f462 100644 --- a/test/js/samples/each-block-array-literal/expected.js +++ b/test/js/samples/each-block-array-literal/expected.js @@ -35,6 +35,7 @@ function create_each_block(ctx) { insert(target, span, anchor); append(span, t); }, + b: noop, p(ctx, dirty) { if (dirty & /*a, b, c, d, e*/ 31 && t_value !== (t_value = /*num*/ ctx[5] + "")) set_data(t, t_value); }, @@ -68,6 +69,7 @@ function create_fragment(ctx) { insert(target, each_1_anchor, anchor); }, + b: noop, p(ctx, [dirty]) { if (dirty & /*a, b, c, d, e*/ 31) { each_value = [/*a*/ ctx[0], /*b*/ ctx[1], /*c*/ ctx[2], /*d*/ ctx[3], /*e*/ ctx[4]]; diff --git a/test/js/samples/each-block-changed-check/expected.js b/test/js/samples/each-block-changed-check/expected.js index 5d88032b8794..be86bb268b35 100644 --- a/test/js/samples/each-block-changed-check/expected.js +++ b/test/js/samples/each-block-changed-check/expected.js @@ -69,6 +69,7 @@ function create_each_block(ctx) { append(div, t6); html_tag.m(div); }, + b: noop, p(ctx, dirty) { if (dirty & /*comments*/ 1 && t2_value !== (t2_value = /*comment*/ ctx[4].author + "")) set_data(t2, t2_value); if (dirty & /*elapsed, comments, time*/ 7 && t4_value !== (t4_value = /*elapsed*/ ctx[1](/*comment*/ ctx[4].time, /*time*/ ctx[2]) + "")) set_data(t4, t4_value); @@ -110,6 +111,7 @@ function create_fragment(ctx) { insert(target, p, anchor); append(p, t1); }, + b: noop, p(ctx, [dirty]) { if (dirty & /*comments, elapsed, time*/ 7) { each_value = /*comments*/ ctx[0]; diff --git a/test/js/samples/each-block-keyed-animated/expected.js b/test/js/samples/each-block-keyed-animated/expected.js index 7fb81c27a226..3ace4736debb 100644 --- a/test/js/samples/each-block-keyed-animated/expected.js +++ b/test/js/samples/each-block-keyed-animated/expected.js @@ -43,6 +43,7 @@ function create_each_block(key_1, ctx) { insert(target, div, anchor); append(div, t); }, + b: noop, p(ctx, dirty) { if (dirty & /*things*/ 1 && t_value !== (t_value = /*thing*/ ctx[1].name + "")) set_data(t, t_value); }, @@ -91,6 +92,7 @@ function create_fragment(ctx) { insert(target, each_1_anchor, anchor); }, + b: noop, p(ctx, [dirty]) { if (dirty & /*things*/ 1) { const each_value = /*things*/ ctx[0]; diff --git a/test/js/samples/each-block-keyed/expected.js b/test/js/samples/each-block-keyed/expected.js index ad8c074e99f8..981a444f705e 100644 --- a/test/js/samples/each-block-keyed/expected.js +++ b/test/js/samples/each-block-keyed/expected.js @@ -39,6 +39,7 @@ function create_each_block(key_1, ctx) { insert(target, div, anchor); append(div, t); }, + b: noop, p(ctx, dirty) { if (dirty & /*things*/ 1 && t_value !== (t_value = /*thing*/ ctx[1].name + "")) set_data(t, t_value); }, @@ -76,6 +77,7 @@ function create_fragment(ctx) { insert(target, each_1_anchor, anchor); }, + b: noop, p(ctx, [dirty]) { if (dirty & /*things*/ 1) { const each_value = /*things*/ ctx[0]; diff --git a/test/js/samples/event-handler-dynamic/expected.js b/test/js/samples/event-handler-dynamic/expected.js index d8f5710023a6..295ef86bf891 100644 --- a/test/js/samples/event-handler-dynamic/expected.js +++ b/test/js/samples/event-handler-dynamic/expected.js @@ -63,6 +63,7 @@ function create_fragment(ctx) { }) ]; }, + b: noop, p(new_ctx, [dirty]) { ctx = new_ctx; if (dirty & /*number*/ 2) set_data(t4, /*number*/ ctx[1]); diff --git a/test/js/samples/event-handler-no-passive/expected.js b/test/js/samples/event-handler-no-passive/expected.js index 8bf2de769371..afa346991eb2 100644 --- a/test/js/samples/event-handler-no-passive/expected.js +++ b/test/js/samples/event-handler-no-passive/expected.js @@ -26,6 +26,7 @@ function create_fragment(ctx) { if (remount) dispose(); dispose = listen(a, "touchstart", touchstart_handler); }, + b: noop, p: noop, i: noop, o: noop, diff --git a/test/js/samples/event-modifiers/expected.js b/test/js/samples/event-modifiers/expected.js index 2eca5f29b89c..36f6dbd0d490 100644 --- a/test/js/samples/event-modifiers/expected.js +++ b/test/js/samples/event-modifiers/expected.js @@ -52,6 +52,7 @@ function create_fragment(ctx) { listen(div, "touchstart", handleTouchstart, { passive: true }) ]; }, + b: noop, p: noop, i: noop, o: noop, diff --git a/test/js/samples/head-no-whitespace/expected.js b/test/js/samples/head-no-whitespace/expected.js index 444bad3fd48a..0af137fe1806 100644 --- a/test/js/samples/head-no-whitespace/expected.js +++ b/test/js/samples/head-no-whitespace/expected.js @@ -27,6 +27,7 @@ function create_fragment(ctx) { append(document.head, meta0); append(document.head, meta1); }, + b: noop, p: noop, i: noop, o: noop, diff --git a/test/js/samples/hoisted-const/expected.js b/test/js/samples/hoisted-const/expected.js index 2842b547516e..2821dc5189eb 100644 --- a/test/js/samples/hoisted-const/expected.js +++ b/test/js/samples/hoisted-const/expected.js @@ -20,6 +20,7 @@ function create_fragment(ctx) { m(target, anchor) { insert(target, b, anchor); }, + b: noop, p: noop, i: noop, o: noop, diff --git a/test/js/samples/hoisted-let/expected.js b/test/js/samples/hoisted-let/expected.js index 285b12411835..c927e7c9ae5a 100644 --- a/test/js/samples/hoisted-let/expected.js +++ b/test/js/samples/hoisted-let/expected.js @@ -20,6 +20,7 @@ function create_fragment(ctx) { m(target, anchor) { insert(target, b, anchor); }, + b: noop, p: noop, i: noop, o: noop, diff --git a/test/js/samples/hydrated-void-element/expected.js b/test/js/samples/hydrated-void-element/expected.js index e53d16d9250e..ce34ab135a76 100644 --- a/test/js/samples/hydrated-void-element/expected.js +++ b/test/js/samples/hydrated-void-element/expected.js @@ -43,6 +43,7 @@ function create_fragment(ctx) { insert(target, t, anchor); insert(target, div, anchor); }, + b: noop, p: noop, i: noop, o: noop, diff --git a/test/js/samples/if-block-complex/expected.js b/test/js/samples/if-block-complex/expected.js index a8244de8b02d..45f51cf0bbf6 100644 --- a/test/js/samples/if-block-complex/expected.js +++ b/test/js/samples/if-block-complex/expected.js @@ -22,6 +22,7 @@ function create_if_block(ctx) { m(target, anchor) { insert(target, div, anchor); }, + b: noop, d(detaching) { if (detaching) detach(div); } @@ -42,6 +43,7 @@ function create_fragment(ctx) { if (if_block) if_block.m(target, anchor); insert(target, if_block_anchor, anchor); }, + b: noop, p: noop, i: noop, o: noop, diff --git a/test/js/samples/if-block-no-update/expected.js b/test/js/samples/if-block-no-update/expected.js index f225c221bfe3..fb90fcb89ee3 100644 --- a/test/js/samples/if-block-no-update/expected.js +++ b/test/js/samples/if-block-no-update/expected.js @@ -21,6 +21,7 @@ function create_else_block(ctx) { m(target, anchor) { insert(target, p, anchor); }, + b: noop, d(detaching) { if (detaching) detach(p); } @@ -39,6 +40,7 @@ function create_if_block(ctx) { m(target, anchor) { insert(target, p, anchor); }, + b: noop, d(detaching) { if (detaching) detach(p); } @@ -65,6 +67,7 @@ function create_fragment(ctx) { if_block.m(target, anchor); insert(target, if_block_anchor, anchor); }, + b: noop, p(ctx, [dirty]) { if (current_block_type !== (current_block_type = select_block_type(ctx, dirty))) { if_block.d(1); diff --git a/test/js/samples/if-block-simple/expected.js b/test/js/samples/if-block-simple/expected.js index b9fad863e2c0..2cea95253693 100644 --- a/test/js/samples/if-block-simple/expected.js +++ b/test/js/samples/if-block-simple/expected.js @@ -21,6 +21,7 @@ function create_if_block(ctx) { m(target, anchor) { insert(target, p, anchor); }, + b: noop, d(detaching) { if (detaching) detach(p); } @@ -40,6 +41,7 @@ function create_fragment(ctx) { if (if_block) if_block.m(target, anchor); insert(target, if_block_anchor, anchor); }, + b: noop, p(ctx, [dirty]) { if (/*foo*/ ctx[0]) { if (!if_block) { diff --git a/test/js/samples/inline-style-optimized-multiple/expected.js b/test/js/samples/inline-style-optimized-multiple/expected.js index 84a38abd7bbe..dc69120cdd90 100644 --- a/test/js/samples/inline-style-optimized-multiple/expected.js +++ b/test/js/samples/inline-style-optimized-multiple/expected.js @@ -22,6 +22,7 @@ function create_fragment(ctx) { m(target, anchor) { insert(target, div, anchor); }, + b: noop, p(ctx, [dirty]) { if (dirty & /*color*/ 1) { set_style(div, "color", /*color*/ ctx[0]); diff --git a/test/js/samples/inline-style-optimized-url/expected.js b/test/js/samples/inline-style-optimized-url/expected.js index 77870348a572..5df7b26dcf7a 100644 --- a/test/js/samples/inline-style-optimized-url/expected.js +++ b/test/js/samples/inline-style-optimized-url/expected.js @@ -21,6 +21,7 @@ function create_fragment(ctx) { m(target, anchor) { insert(target, div, anchor); }, + b: noop, p(ctx, [dirty]) { if (dirty & /*data*/ 1) { set_style(div, "background", "url(data:image/png;base64," + /*data*/ ctx[0] + ")"); diff --git a/test/js/samples/inline-style-optimized/expected.js b/test/js/samples/inline-style-optimized/expected.js index 5bef284f0946..f057261f4a07 100644 --- a/test/js/samples/inline-style-optimized/expected.js +++ b/test/js/samples/inline-style-optimized/expected.js @@ -21,6 +21,7 @@ function create_fragment(ctx) { m(target, anchor) { insert(target, div, anchor); }, + b: noop, p(ctx, [dirty]) { if (dirty & /*color*/ 1) { set_style(div, "color", /*color*/ ctx[0]); diff --git a/test/js/samples/inline-style-unoptimized/expected.js b/test/js/samples/inline-style-unoptimized/expected.js index fdff685eade2..1e12a46a7c6f 100644 --- a/test/js/samples/inline-style-unoptimized/expected.js +++ b/test/js/samples/inline-style-unoptimized/expected.js @@ -30,6 +30,7 @@ function create_fragment(ctx) { insert(target, t, anchor); insert(target, div1, anchor); }, + b: noop, p(ctx, [dirty]) { if (dirty & /*style*/ 1) { attr(div0, "style", /*style*/ ctx[0]); diff --git a/test/js/samples/inline-style-without-updates/expected.js b/test/js/samples/inline-style-without-updates/expected.js index 375896f259ea..b4bb8faab7ba 100644 --- a/test/js/samples/inline-style-without-updates/expected.js +++ b/test/js/samples/inline-style-without-updates/expected.js @@ -21,6 +21,7 @@ function create_fragment(ctx) { m(target, anchor) { insert(target, div, anchor); }, + b: noop, p: noop, i: noop, o: noop, diff --git a/test/js/samples/input-files/expected.js b/test/js/samples/input-files/expected.js index 1c1e57fc9b24..7e49a6761e67 100644 --- a/test/js/samples/input-files/expected.js +++ b/test/js/samples/input-files/expected.js @@ -26,6 +26,7 @@ function create_fragment(ctx) { if (remount) dispose(); dispose = listen(input, "change", /*input_change_handler*/ ctx[1]); }, + b: noop, p: noop, i: noop, o: noop, diff --git a/test/js/samples/input-no-initial-value/expected.js b/test/js/samples/input-no-initial-value/expected.js index f72daa22a302..fffc6944c72d 100644 --- a/test/js/samples/input-no-initial-value/expected.js +++ b/test/js/samples/input-no-initial-value/expected.js @@ -45,6 +45,7 @@ function create_fragment(ctx) { listen(form, "submit", /*handleSubmit*/ ctx[1]) ]; }, + b: noop, p(ctx, [dirty]) { if (dirty & /*test*/ 1 && input.value !== /*test*/ ctx[0]) { set_input_value(input, /*test*/ ctx[0]); diff --git a/test/js/samples/input-range/expected.js b/test/js/samples/input-range/expected.js index 17a806544907..5390b8ff5784 100644 --- a/test/js/samples/input-range/expected.js +++ b/test/js/samples/input-range/expected.js @@ -33,6 +33,7 @@ function create_fragment(ctx) { listen(input, "input", /*input_change_input_handler*/ ctx[1]) ]; }, + b: noop, p(ctx, [dirty]) { if (dirty & /*value*/ 1) { set_input_value(input, /*value*/ ctx[0]); diff --git a/test/js/samples/input-value/expected.js b/test/js/samples/input-value/expected.js index 31be2895ac0d..1cb7776aeea1 100644 --- a/test/js/samples/input-value/expected.js +++ b/test/js/samples/input-value/expected.js @@ -40,6 +40,7 @@ function create_fragment(ctx) { if (remount) dispose(); dispose = listen(input, "input", /*onInput*/ ctx[1]); }, + b: noop, p(ctx, [dirty]) { if (dirty & /*name*/ 1 && input.value !== /*name*/ ctx[0]) { input.value = /*name*/ ctx[0]; diff --git a/test/js/samples/input-without-blowback-guard/expected.js b/test/js/samples/input-without-blowback-guard/expected.js index 1e379032f3a1..535c014efd31 100644 --- a/test/js/samples/input-without-blowback-guard/expected.js +++ b/test/js/samples/input-without-blowback-guard/expected.js @@ -26,6 +26,7 @@ function create_fragment(ctx) { if (remount) dispose(); dispose = listen(input, "change", /*input_change_handler*/ ctx[1]); }, + b: noop, p(ctx, [dirty]) { if (dirty & /*foo*/ 1) { input.checked = /*foo*/ ctx[0]; 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 f45e52aebd3b..8b1721e3040d 100644 --- a/test/js/samples/instrumentation-script-if-no-block/expected.js +++ b/test/js/samples/instrumentation-script-if-no-block/expected.js @@ -40,6 +40,7 @@ function create_fragment(ctx) { if (remount) dispose(); dispose = listen(button, "click", /*foo*/ ctx[1]); }, + b: noop, p(ctx, [dirty]) { if (dirty & /*x*/ 1) set_data(t3, /*x*/ ctx[0]); }, diff --git a/test/js/samples/instrumentation-script-main-block/expected.js b/test/js/samples/instrumentation-script-main-block/expected.js index bc809246028b..86cc404ac835 100644 --- a/test/js/samples/instrumentation-script-main-block/expected.js +++ b/test/js/samples/instrumentation-script-main-block/expected.js @@ -28,6 +28,7 @@ function create_fragment(ctx) { append(p, t0); append(p, t1); }, + b: noop, p(ctx, [dirty]) { if (dirty & /*x*/ 1) set_data(t1, /*x*/ ctx[0]); }, 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 9fe964097829..c099dbdad476 100644 --- a/test/js/samples/instrumentation-script-x-equals-x/expected.js +++ b/test/js/samples/instrumentation-script-x-equals-x/expected.js @@ -41,6 +41,7 @@ function create_fragment(ctx) { if (remount) dispose(); dispose = listen(button, "click", /*foo*/ ctx[1]); }, + b: noop, p(ctx, [dirty]) { if (dirty & /*things*/ 1 && t3_value !== (t3_value = /*things*/ ctx[0].length + "")) set_data(t3, t3_value); }, 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 6f3bea4010fc..39d967568fca 100644 --- a/test/js/samples/instrumentation-template-if-no-block/expected.js +++ b/test/js/samples/instrumentation-template-if-no-block/expected.js @@ -40,6 +40,7 @@ function create_fragment(ctx) { if (remount) dispose(); dispose = listen(button, "click", /*click_handler*/ ctx[1]); }, + b: noop, p(ctx, [dirty]) { if (dirty & /*x*/ 1) set_data(t3, /*x*/ ctx[0]); }, 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 ed095353bd53..98a79f525b87 100644 --- a/test/js/samples/instrumentation-template-x-equals-x/expected.js +++ b/test/js/samples/instrumentation-template-x-equals-x/expected.js @@ -41,6 +41,7 @@ function create_fragment(ctx) { if (remount) dispose(); dispose = listen(button, "click", /*click_handler*/ ctx[1]); }, + b: noop, p(ctx, [dirty]) { if (dirty & /*things*/ 1 && t3_value !== (t3_value = /*things*/ ctx[0].length + "")) set_data(t3, t3_value); }, diff --git a/test/js/samples/legacy-input-type/expected.js b/test/js/samples/legacy-input-type/expected.js index 2b76a485225a..47614f4ae861 100644 --- a/test/js/samples/legacy-input-type/expected.js +++ b/test/js/samples/legacy-input-type/expected.js @@ -21,6 +21,7 @@ function create_fragment(ctx) { m(target, anchor) { insert(target, input, anchor); }, + b: noop, p: noop, i: noop, o: noop, diff --git a/test/js/samples/loop-protect/expected.js b/test/js/samples/loop-protect/expected.js index c52d9df437e5..18ee868234ba 100644 --- a/test/js/samples/loop-protect/expected.js +++ b/test/js/samples/loop-protect/expected.js @@ -33,6 +33,7 @@ function create_fragment(ctx) { insert_dev(target, div, anchor); /*div_binding*/ ctx[1](div); }, + b: noop, p: noop, i: noop, o: noop, diff --git a/test/js/samples/media-bindings/expected.js b/test/js/samples/media-bindings/expected.js index e58d32cf294d..d5b452e88e45 100644 --- a/test/js/samples/media-bindings/expected.js +++ b/test/js/samples/media-bindings/expected.js @@ -69,6 +69,7 @@ function create_fragment(ctx) { listen(audio, "ended", /*audio_ended_handler*/ ctx[18]) ]; }, + b: noop, p(ctx, [dirty]) { if (!audio_updating && dirty & /*currentTime*/ 8 && !isNaN(/*currentTime*/ ctx[3])) { audio.currentTime = /*currentTime*/ ctx[3]; diff --git a/test/js/samples/non-imported-component/expected.js b/test/js/samples/non-imported-component/expected.js index 2784fd17acb3..085ee84d7035 100644 --- a/test/js/samples/non-imported-component/expected.js +++ b/test/js/samples/non-imported-component/expected.js @@ -34,6 +34,7 @@ function create_fragment(ctx) { mount_component(nonimported, target, anchor); current = true; }, + b: noop, p: noop, i(local) { if (current) return; diff --git a/test/js/samples/non-mutable-reference/expected.js b/test/js/samples/non-mutable-reference/expected.js index 93f2145a2e65..afe3279ea9f5 100644 --- a/test/js/samples/non-mutable-reference/expected.js +++ b/test/js/samples/non-mutable-reference/expected.js @@ -20,6 +20,7 @@ function create_fragment(ctx) { m(target, anchor) { insert(target, h1, anchor); }, + b: noop, p: noop, i: noop, o: noop, diff --git a/test/js/samples/select-dynamic-value/expected.js b/test/js/samples/select-dynamic-value/expected.js index a93a47bd3ac4..5065207e5c12 100644 --- a/test/js/samples/select-dynamic-value/expected.js +++ b/test/js/samples/select-dynamic-value/expected.js @@ -43,6 +43,7 @@ function create_fragment(ctx) { } } }, + b: noop, p(ctx, [dirty]) { if (dirty & /*current*/ 1 && select_value_value !== (select_value_value = /*current*/ ctx[0])) { for (var i = 0; i < select.options.length; i += 1) { diff --git a/test/js/samples/src-attribute-check/expected.js b/test/js/samples/src-attribute-check/expected.js index e03b3a6ba7ee..3846a4e6480c 100644 --- a/test/js/samples/src-attribute-check/expected.js +++ b/test/js/samples/src-attribute-check/expected.js @@ -44,6 +44,7 @@ function create_fragment(ctx) { insert(target, t, anchor); insert(target, img1, anchor); }, + b: noop, p(ctx, [dirty]) { if (dirty & /*url*/ 1 && img0.src !== (img0_src_value = /*url*/ ctx[0])) { attr(img0, "src", img0_src_value); diff --git a/test/js/samples/svg-title/expected.js b/test/js/samples/svg-title/expected.js index cd7ae3b55152..b32f3f3b0e15 100644 --- a/test/js/samples/svg-title/expected.js +++ b/test/js/samples/svg-title/expected.js @@ -27,6 +27,7 @@ function create_fragment(ctx) { append(svg, title); append(title, t); }, + b: noop, p: noop, i: noop, o: noop, diff --git a/test/js/samples/title/expected.js b/test/js/samples/title/expected.js index d4e7e1a58491..3a47efa50fd8 100644 --- a/test/js/samples/title/expected.js +++ b/test/js/samples/title/expected.js @@ -8,6 +8,7 @@ function create_fragment(ctx) { return { c: noop, m: noop, + b: noop, p(ctx, [dirty]) { if (dirty & /*custom*/ 1 && title_value !== (title_value = "a " + /*custom*/ ctx[0] + " title")) { document.title = title_value; diff --git a/test/js/samples/transition-local/expected.js b/test/js/samples/transition-local/expected.js index a5d3b6318fe5..c6359421a64f 100644 --- a/test/js/samples/transition-local/expected.js +++ b/test/js/samples/transition-local/expected.js @@ -26,6 +26,7 @@ function create_if_block(ctx) { if (if_block) if_block.m(target, anchor); insert(target, if_block_anchor, anchor); }, + b: noop, p(ctx, dirty) { if (/*y*/ ctx[1]) { if (!if_block) { @@ -61,6 +62,7 @@ function create_if_block_1(ctx) { m(target, anchor) { insert(target, div, anchor); }, + b: noop, i(local) { if (local) { if (!div_intro) { @@ -91,6 +93,7 @@ function create_fragment(ctx) { if (if_block) if_block.m(target, anchor); insert(target, if_block_anchor, anchor); }, + b: noop, p(ctx, [dirty]) { if (/*x*/ ctx[0]) { if (if_block) { diff --git a/test/js/samples/transition-repeated-outro/expected.js b/test/js/samples/transition-repeated-outro/expected.js index 6f071328a491..0b12a266c2d1 100644 --- a/test/js/samples/transition-repeated-outro/expected.js +++ b/test/js/samples/transition-repeated-outro/expected.js @@ -9,6 +9,7 @@ import { group_outros, init, insert, + noop, safe_not_equal, transition_in, transition_out @@ -30,6 +31,7 @@ function create_if_block(ctx) { insert(target, div, anchor); current = true; }, + b: noop, i(local) { if (current) return; if (div_outro) div_outro.end(1); @@ -61,6 +63,7 @@ function create_fragment(ctx) { insert(target, if_block_anchor, anchor); current = true; }, + b: noop, p(ctx, [dirty]) { if (/*num*/ ctx[0] < 5) { if (!if_block) { diff --git a/test/js/samples/unchanged-expression/expected.js b/test/js/samples/unchanged-expression/expected.js index 673d5b6abc8d..26fd817ac3bf 100644 --- a/test/js/samples/unchanged-expression/expected.js +++ b/test/js/samples/unchanged-expression/expected.js @@ -56,6 +56,7 @@ function create_fragment(ctx) { append(p3, t8); append(p3, t9); }, + b: noop, p(ctx, [dirty]) { if (dirty & /*world3*/ 1) set_data(t9, /*world3*/ ctx[0]); }, diff --git a/test/js/samples/unreferenced-state-not-invalidated/expected.js b/test/js/samples/unreferenced-state-not-invalidated/expected.js index b10ea815b966..3f483e994e41 100644 --- a/test/js/samples/unreferenced-state-not-invalidated/expected.js +++ b/test/js/samples/unreferenced-state-not-invalidated/expected.js @@ -27,6 +27,7 @@ function create_fragment(ctx) { insert(target, p, anchor); append(p, t); }, + b: noop, p(ctx, [dirty]) { if (dirty & /*y*/ 1) set_data(t, /*y*/ ctx[0]); }, diff --git a/test/js/samples/use-elements-as-anchors/expected.js b/test/js/samples/use-elements-as-anchors/expected.js index 52635e9b7878..9ac095e28dbf 100644 --- a/test/js/samples/use-elements-as-anchors/expected.js +++ b/test/js/samples/use-elements-as-anchors/expected.js @@ -23,6 +23,7 @@ function create_if_block_4(ctx) { m(target, anchor) { insert(target, p, anchor); }, + b: noop, d(detaching) { if (detaching) detach(p); } @@ -41,6 +42,7 @@ function create_if_block_3(ctx) { m(target, anchor) { insert(target, p, anchor); }, + b: noop, d(detaching) { if (detaching) detach(p); } @@ -59,6 +61,7 @@ function create_if_block_2(ctx) { m(target, anchor) { insert(target, p, anchor); }, + b: noop, d(detaching) { if (detaching) detach(p); } @@ -77,6 +80,7 @@ function create_if_block_1(ctx) { m(target, anchor) { insert(target, p, anchor); }, + b: noop, d(detaching) { if (detaching) detach(p); } @@ -95,6 +99,7 @@ function create_if_block(ctx) { m(target, anchor) { insert(target, p, anchor); }, + b: noop, d(detaching) { if (detaching) detach(p); } @@ -155,6 +160,7 @@ function create_fragment(ctx) { if (if_block4) if_block4.m(target, anchor); insert(target, if_block4_anchor, anchor); }, + b: noop, p(ctx, [dirty]) { if (/*a*/ ctx[0]) { if (!if_block0) { diff --git a/test/js/samples/video-bindings/expected.js b/test/js/samples/video-bindings/expected.js index 3cad17b34d3e..993dc2c7d464 100644 --- a/test/js/samples/video-bindings/expected.js +++ b/test/js/samples/video-bindings/expected.js @@ -48,6 +48,7 @@ function create_fragment(ctx) { listen(video, "resize", /*video_resize_handler*/ ctx[5]) ]; }, + b: noop, p(ctx, [dirty]) { if (!video_updating && dirty & /*currentTime*/ 1 && !isNaN(/*currentTime*/ ctx[0])) { video.currentTime = /*currentTime*/ ctx[0]; diff --git a/test/js/samples/window-binding-online/expected.js b/test/js/samples/window-binding-online/expected.js index fa955e4fd59b..0fd83af42033 100644 --- a/test/js/samples/window-binding-online/expected.js +++ b/test/js/samples/window-binding-online/expected.js @@ -23,6 +23,7 @@ function create_fragment(ctx) { listen(window, "offline", /*onlinestatuschanged*/ ctx[1]) ]; }, + b: noop, p: noop, i: noop, o: noop, diff --git a/test/js/samples/window-binding-scroll/expected.js b/test/js/samples/window-binding-scroll/expected.js index 30723cc142fc..c15d9d9db66d 100644 --- a/test/js/samples/window-binding-scroll/expected.js +++ b/test/js/samples/window-binding-scroll/expected.js @@ -47,6 +47,7 @@ function create_fragment(ctx) { /*onwindowscroll*/ ctx[1](); }); }, + b: noop, p(ctx, [dirty]) { if (dirty & /*y*/ 1 && !scrolling) { scrolling = true; diff --git a/test/runtime/samples/event-handler-bubble-all-component/Widget.svelte b/test/runtime/samples/event-handler-bubble-all-component/Widget.svelte new file mode 100644 index 000000000000..cde03db92bd6 --- /dev/null +++ b/test/runtime/samples/event-handler-bubble-all-component/Widget.svelte @@ -0,0 +1,7 @@ + + + \ No newline at end of file diff --git a/test/runtime/samples/event-handler-bubble-all-component/_config.js b/test/runtime/samples/event-handler-bubble-all-component/_config.js new file mode 100644 index 000000000000..22704cf1c33c --- /dev/null +++ b/test/runtime/samples/event-handler-bubble-all-component/_config.js @@ -0,0 +1,18 @@ +export default { + html: ` + + `, + + test({ assert, component, target, window }) { + const button = target.querySelector('button'); + const event = new window.MouseEvent('click'); + + let answer; + component.$on('foo', event => { + answer = event.detail.answer; + }); + + button.dispatchEvent(event); + assert.equal(answer, 42); + } +}; diff --git a/test/runtime/samples/event-handler-bubble-all-component/main.svelte b/test/runtime/samples/event-handler-bubble-all-component/main.svelte new file mode 100644 index 000000000000..7baecd2bde88 --- /dev/null +++ b/test/runtime/samples/event-handler-bubble-all-component/main.svelte @@ -0,0 +1,5 @@ + + + diff --git a/test/runtime/samples/event-handler-bubble-all/Button.svelte b/test/runtime/samples/event-handler-bubble-all/Button.svelte new file mode 100644 index 000000000000..63012962222d --- /dev/null +++ b/test/runtime/samples/event-handler-bubble-all/Button.svelte @@ -0,0 +1 @@ + diff --git a/test/runtime/samples/event-handler-bubble-all/_config.js b/test/runtime/samples/event-handler-bubble-all/_config.js new file mode 100644 index 000000000000..3a5ac7a18b83 --- /dev/null +++ b/test/runtime/samples/event-handler-bubble-all/_config.js @@ -0,0 +1,21 @@ +export default { + html: ` + + `, + + async test({ assert, component, target, window }) { + const button = target.querySelector('button'); + const event = new window.MouseEvent('click'); + + await button.dispatchEvent(event); + assert.htmlEqual(target.innerHTML, ` + +

hello!

+ `); + + await button.dispatchEvent(event); + assert.htmlEqual(target.innerHTML, ` + + `); + } +}; diff --git a/test/runtime/samples/event-handler-bubble-all/main.svelte b/test/runtime/samples/event-handler-bubble-all/main.svelte new file mode 100644 index 000000000000..5c0c5e4e6da6 --- /dev/null +++ b/test/runtime/samples/event-handler-bubble-all/main.svelte @@ -0,0 +1,11 @@ + + + + +{#if visible} +

hello!

+{/if}