diff --git a/src/generators/dom/index.ts b/src/generators/dom/index.ts index 0e801601cf..cc5a91bbb1 100644 --- a/src/generators/dom/index.ts +++ b/src/generators/dom/index.ts @@ -357,7 +357,6 @@ export default function dom( customElements.define("${generator.tag}", ${name}); `); } else { - // TODO assign non-function-expression methods builder.addBlock(deindent` class ${name} extends @Component { constructor(options) { diff --git a/src/shared/Base.js b/src/shared/Base.js new file mode 100644 index 0000000000..da798091f9 --- /dev/null +++ b/src/shared/Base.js @@ -0,0 +1,46 @@ +import { _differsImmutable } from './utils.js'; + +export function blankObject() { + return Object.create(null); +} + +export class Base { + constructor() { + this._handlers = blankObject(); + } + + fire(eventName, data) { + const handlers = eventName in this._handlers && this._handlers[eventName].slice(); + if (!handlers) return; + + for (let i = 0; i < handlers.length; i += 1) { + const handler = handlers[i]; + + if (!handler.__calling) { + handler.__calling = true; + handler.call(this, data); + handler.__calling = false; + } + } + } + + get() { + return this._state; + } + + on(eventName, handler) { + const handlers = this._handlers[eventName] || (this._handlers[eventName] = []); + handlers.push(handler); + + return { + cancel: function() { + const index = handlers.indexOf(handler); + if (~index) handlers.splice(index, 1); + } + }; + } + + _differs(a, b) { + return _differsImmutable(a, b) || ((a && typeof a === 'object') || typeof a === 'function'); + } +} \ No newline at end of file diff --git a/src/shared/Component.js b/src/shared/Component.js new file mode 100644 index 0000000000..33e6d1360c --- /dev/null +++ b/src/shared/Component.js @@ -0,0 +1,107 @@ +import { Base } from './Base.js'; +import { assign, callAll, noop } from './utils.js'; + +export class Component extends Base { + constructor(options) { + super(); + this._init(options); + } + + destroy(detach) { + this.destroy = noop; + this.fire('destroy'); + this.set = this.get = noop; + + if (detach !== false) this._fragment.u(); + this._fragment.d(); + this._fragment = this._state = null; + } + + set(newState) { + this._set(assign({}, newState)); + if (this.root._lock) return; + this.root._lock = true; + callAll(this.root._beforecreate); + callAll(this.root._oncreate); + callAll(this.root._aftercreate); + this.root._lock = false; + } + + _init(options) { + this._bind = options._bind; + this._slotted = options.slots || {}; + + this.options = options; + this.root = options.root || this; + this.store = this.root.store || options.store; + + if (!options.root) { + this._oncreate = []; + this._beforecreate = []; + this._aftercreate = []; + } + + this.refs = {}; + this.slots = {}; + } + + _set(newState) { + const previous = this._state; + const changed = {}; + let dirty = false; + + for (var key in newState) { + if (this._differs(newState[key], previous[key])) changed[key] = dirty = 1; + } + + if (!dirty) return; + + this._state = assign(assign({}, previous), newState); + this._recompute(changed, this._state); + if (this._bind) this._bind(changed, this._state); + + if (this._fragment) { + this.fire("state", { changed, current: this._state, previous }); + this._fragment.p(changed, this._state); + this.fire("update", { changed, current: this._state, previous }); + } + } + + _mount(target, anchor) { + this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor || null); + } + + _recompute() {} + + _unmount() { + if (this._fragment) this._fragment.u(); + } +} + +export class ComponentDev extends Component { + constructor(options) { + if (!options || (!options.target && !options.root)) { + throw new Error(`'target' is a required option`); + } + + super(options); + } + + destroy(detach) { + super.destroy(detach); + this.destroy = () => { + console.warn('Component was already destroyed'); + }; + } + + set(newState) { + if (typeof newState !== 'object') { + throw new Error(`${this._debugName}.set was called without an object of data key-values to update.`); + } + + this._checkReadOnly(newState); + super.set(newState); + } + + _checkReadOnly() {} +} \ No newline at end of file diff --git a/src/shared/SvelteElement.js b/src/shared/SvelteElement.js new file mode 100644 index 0000000000..185118e6d0 --- /dev/null +++ b/src/shared/SvelteElement.js @@ -0,0 +1,5 @@ +class SvelteElement extends HTMLElement { + constructor(options) { + + } +} \ No newline at end of file diff --git a/src/shared/_build.js b/src/shared/_build.js index 72bd5ab2a8..411e0b74dd 100644 --- a/src/shared/_build.js +++ b/src/shared/_build.js @@ -5,7 +5,7 @@ const acorn = require('acorn'); const declarations = {}; fs.readdirSync(__dirname).forEach(file => { - if (!/^[a-z\-]+\.js$/.test(file)) return; + if (!/^[a-z\-]+\.js$/i.test(file)) return; const source = fs.readFileSync(path.join(__dirname, file), 'utf-8'); const ast = acorn.parse(source, { diff --git a/src/shared/index.js b/src/shared/index.js index 2f50eb2fdc..76655ca030 100644 --- a/src/shared/index.js +++ b/src/shared/index.js @@ -5,177 +5,5 @@ export * from './keyed-each.js'; export * from './spread.js'; export * from './transitions.js'; export * from './utils.js'; - -export function blankObject() { - return Object.create(null); -} - -export class Base { - constructor() { - this._handlers = blankObject(); - } - - fire(eventName, data) { - const handlers = eventName in this._handlers && this._handlers[eventName].slice(); - if (!handlers) return; - - for (let i = 0; i < handlers.length; i += 1) { - const handler = handlers[i]; - - if (!handler.__calling) { - handler.__calling = true; - handler.call(this, data); - handler.__calling = false; - } - } - } - - get() { - return this._state; - } - - on(eventName, handler) { - const handlers = this._handlers[eventName] || (this._handlers[eventName] = []); - handlers.push(handler); - - return { - cancel: function() { - const index = handlers.indexOf(handler); - if (~index) handlers.splice(index, 1); - } - }; - } - - _differs(a, b) { - return _differsImmutable(a, b) || ((a && typeof a === 'object') || typeof a === 'function'); - } -} - -export class Component extends Base { - constructor(options) { - super(); - this._init(options); - } - - destroy(detach) { - this.destroy = noop; - this.fire('destroy'); - this.set = this.get = noop; - - if (detach !== false) this._fragment.u(); - this._fragment.d(); - this._fragment = this._state = null; - } - - set(newState) { - this._set(assign({}, newState)); - if (this.root._lock) return; - this.root._lock = true; - callAll(this.root._beforecreate); - callAll(this.root._oncreate); - callAll(this.root._aftercreate); - this.root._lock = false; - } - - _init(options) { - this._bind = options._bind; - this._slotted = options.slots || {}; - - this.options = options; - this.root = options.root || this; - this.store = this.root.store || options.store; - - if (!options.root) { - this._oncreate = []; - this._beforecreate = []; - this._aftercreate = []; - } - - this.refs = {}; - this.slots = {}; - } - - _set(newState) { - const previous = this._state; - const changed = {}; - let dirty = false; - - for (var key in newState) { - if (this._differs(newState[key], previous[key])) changed[key] = dirty = 1; - } - - if (!dirty) return; - - this._state = assign(assign({}, previous), newState); - this._recompute(changed, this._state); - if (this._bind) this._bind(changed, this._state); - - if (this._fragment) { - this.fire("state", { changed, current: this._state, previous }); - this._fragment.p(changed, this._state); - this.fire("update", { changed, current: this._state, previous }); - } - } - - _mount(target, anchor) { - this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor || null); - } - - _recompute() {} - - _unmount() { - if (this._fragment) this._fragment.u(); - } -} - -export class ComponentDev extends Component { - constructor(options) { - if (!options || (!options.target && !options.root)) { - throw new Error(`'target' is a required option`); - } - - super(options); - } - - destroy(detach) { - super.destroy(detach); - this.destroy = () => { - console.warn('Component was already destroyed'); - }; - } - - set(newState) { - if (typeof newState !== 'object') { - throw new Error(`${this._debugName}.set was called without an object of data key-values to update.`); - } - - this._checkReadOnly(newState); - super.set(newState); - } - - _checkReadOnly() {} -} - -export function _differsImmutable(a, b) { - return a != a ? b == b : a !== b; -} - -export function run(fn) { - fn(); -} - -export function callAll(fns) { - while (fns && fns.length) fns.shift()(); -} - -export function isPromise(value) { - return value && typeof value.then === 'function'; -} - -export var PENDING = {}; -export var SUCCESS = {}; -export var FAILURE = {}; - -export function removeFromStore() { - this.store._remove(this); -} \ No newline at end of file +export * from './Base.js'; +export * from './Component.js'; \ No newline at end of file diff --git a/src/shared/utils.js b/src/shared/utils.js index c9a0f83449..b7496392d0 100644 --- a/src/shared/utils.js +++ b/src/shared/utils.js @@ -4,3 +4,27 @@ export function assign(tar, src) { for (var k in src) tar[k] = src[k]; return tar; } + +export function _differsImmutable(a, b) { + return a != a ? b == b : a !== b; +} + +export function run(fn) { + fn(); +} + +export function callAll(fns) { + while (fns && fns.length) fns.shift()(); +} + +export function isPromise(value) { + return value && typeof value.then === 'function'; +} + +export var PENDING = {}; +export var SUCCESS = {}; +export var FAILURE = {}; + +export function removeFromStore() { + this.store._remove(this); +} \ No newline at end of file diff --git a/test/js/samples/action/expected-bundle.js b/test/js/samples/action/expected-bundle.js index 07149e6d80..140dfd5714 100644 --- a/test/js/samples/action/expected-bundle.js +++ b/test/js/samples/action/expected-bundle.js @@ -5,6 +5,14 @@ function assign(tar, src) { return tar; } +function _differsImmutable(a, b) { + return a != a ? b == b : a !== b; +} + +function callAll(fns) { + while (fns && fns.length) fns.shift()(); +} + function insertNode(node, target, anchor) { target.insertBefore(node, anchor); } @@ -139,14 +147,6 @@ class Component extends Base { } } -function _differsImmutable(a, b) { - return a != a ? b == b : a !== b; -} - -function callAll(fns) { - while (fns && fns.length) fns.shift()(); -} - /* generated by Svelte vX.Y.Z */ function link(node) { diff --git a/test/js/samples/collapses-text-around-comments/expected-bundle.js b/test/js/samples/collapses-text-around-comments/expected-bundle.js index bf9d293129..bea489055f 100644 --- a/test/js/samples/collapses-text-around-comments/expected-bundle.js +++ b/test/js/samples/collapses-text-around-comments/expected-bundle.js @@ -5,6 +5,14 @@ function assign(tar, src) { return tar; } +function _differsImmutable(a, b) { + return a != a ? b == b : a !== b; +} + +function callAll(fns) { + while (fns && fns.length) fns.shift()(); +} + function appendNode(node, target) { target.appendChild(node); } @@ -147,14 +155,6 @@ class Component extends Base { } } -function _differsImmutable(a, b) { - return a != a ? b == b : a !== b; -} - -function callAll(fns) { - while (fns && fns.length) fns.shift()(); -} - /* generated by Svelte vX.Y.Z */ function data() { diff --git a/test/js/samples/component-static-immutable/expected-bundle.js b/test/js/samples/component-static-immutable/expected-bundle.js index 3a11a66a96..b5cc5a367c 100644 --- a/test/js/samples/component-static-immutable/expected-bundle.js +++ b/test/js/samples/component-static-immutable/expected-bundle.js @@ -5,6 +5,14 @@ function assign(tar, src) { return tar; } +function _differsImmutable(a, b) { + return a != a ? b == b : a !== b; +} + +function callAll(fns) { + while (fns && fns.length) fns.shift()(); +} + function blankObject() { return Object.create(null); } @@ -127,14 +135,6 @@ class Component extends Base { } } -function _differsImmutable(a, b) { - return a != a ? b == b : a !== b; -} - -function callAll(fns) { - while (fns && fns.length) fns.shift()(); -} - /* generated by Svelte vX.Y.Z */ var Nested = window.Nested; diff --git a/test/js/samples/component-static-immutable2/expected-bundle.js b/test/js/samples/component-static-immutable2/expected-bundle.js index 3a11a66a96..b5cc5a367c 100644 --- a/test/js/samples/component-static-immutable2/expected-bundle.js +++ b/test/js/samples/component-static-immutable2/expected-bundle.js @@ -5,6 +5,14 @@ function assign(tar, src) { return tar; } +function _differsImmutable(a, b) { + return a != a ? b == b : a !== b; +} + +function callAll(fns) { + while (fns && fns.length) fns.shift()(); +} + function blankObject() { return Object.create(null); } @@ -127,14 +135,6 @@ class Component extends Base { } } -function _differsImmutable(a, b) { - return a != a ? b == b : a !== b; -} - -function callAll(fns) { - while (fns && fns.length) fns.shift()(); -} - /* generated by Svelte vX.Y.Z */ var Nested = window.Nested; diff --git a/test/js/samples/component-static/expected-bundle.js b/test/js/samples/component-static/expected-bundle.js index c7af2ef324..c85beee6a0 100644 --- a/test/js/samples/component-static/expected-bundle.js +++ b/test/js/samples/component-static/expected-bundle.js @@ -5,6 +5,14 @@ function assign(tar, src) { return tar; } +function _differsImmutable(a, b) { + return a != a ? b == b : a !== b; +} + +function callAll(fns) { + while (fns && fns.length) fns.shift()(); +} + function blankObject() { return Object.create(null); } @@ -127,14 +135,6 @@ class Component extends Base { } } -function _differsImmutable(a, b) { - return a != a ? b == b : a !== b; -} - -function callAll(fns) { - while (fns && fns.length) fns.shift()(); -} - /* generated by Svelte vX.Y.Z */ var Nested = window.Nested; diff --git a/test/js/samples/computed-collapsed-if/expected-bundle.js b/test/js/samples/computed-collapsed-if/expected-bundle.js index c99ae4aba4..635830d7b3 100644 --- a/test/js/samples/computed-collapsed-if/expected-bundle.js +++ b/test/js/samples/computed-collapsed-if/expected-bundle.js @@ -5,6 +5,14 @@ function assign(tar, src) { return tar; } +function _differsImmutable(a, b) { + return a != a ? b == b : a !== b; +} + +function callAll(fns) { + while (fns && fns.length) fns.shift()(); +} + function blankObject() { return Object.create(null); } @@ -127,14 +135,6 @@ class Component extends Base { } } -function _differsImmutable(a, b) { - return a != a ? b == b : a !== b; -} - -function callAll(fns) { - while (fns && fns.length) fns.shift()(); -} - /* generated by Svelte vX.Y.Z */ function a({ x }) { diff --git a/test/js/samples/css-media-query/expected-bundle.js b/test/js/samples/css-media-query/expected-bundle.js index 3b8421f7a6..7c31522a9e 100644 --- a/test/js/samples/css-media-query/expected-bundle.js +++ b/test/js/samples/css-media-query/expected-bundle.js @@ -5,6 +5,14 @@ function assign(tar, src) { return tar; } +function _differsImmutable(a, b) { + return a != a ? b == b : a !== b; +} + +function callAll(fns) { + while (fns && fns.length) fns.shift()(); +} + function appendNode(node, target) { target.appendChild(node); } @@ -143,14 +151,6 @@ class Component extends Base { } } -function _differsImmutable(a, b) { - return a != a ? b == b : a !== b; -} - -function callAll(fns) { - while (fns && fns.length) fns.shift()(); -} - /* generated by Svelte vX.Y.Z */ function add_css() { diff --git a/test/js/samples/css-shadow-dom-keyframes/expected-bundle.js b/test/js/samples/css-shadow-dom-keyframes/expected-bundle.js index bb77293d58..c7c4b69fdd 100644 --- a/test/js/samples/css-shadow-dom-keyframes/expected-bundle.js +++ b/test/js/samples/css-shadow-dom-keyframes/expected-bundle.js @@ -5,6 +5,14 @@ function assign(tar, src) { return tar; } +function _differsImmutable(a, b) { + return a != a ? b == b : a !== b; +} + +function callAll(fns) { + while (fns && fns.length) fns.shift()(); +} + function insertNode(node, target, anchor) { target.insertBefore(node, anchor); } @@ -139,14 +147,6 @@ class Component extends Base { } } -function _differsImmutable(a, b) { - return a != a ? b == b : a !== b; -} - -function callAll(fns) { - while (fns && fns.length) fns.shift()(); -} - /* generated by Svelte vX.Y.Z */ function create_main_fragment(component, state) { diff --git a/test/js/samples/deconflict-builtins/expected-bundle.js b/test/js/samples/deconflict-builtins/expected-bundle.js index dc77edef4f..2a03d99c1e 100644 --- a/test/js/samples/deconflict-builtins/expected-bundle.js +++ b/test/js/samples/deconflict-builtins/expected-bundle.js @@ -5,6 +5,14 @@ function assign(tar, src) { return tar; } +function _differsImmutable(a, b) { + return a != a ? b == b : a !== b; +} + +function callAll(fns) { + while (fns && fns.length) fns.shift()(); +} + function appendNode(node, target) { target.appendChild(node); } @@ -157,14 +165,6 @@ class Component extends Base { } } -function _differsImmutable(a, b) { - return a != a ? b == b : a !== b; -} - -function callAll(fns) { - while (fns && fns.length) fns.shift()(); -} - /* generated by Svelte vX.Y.Z */ function create_main_fragment(component, state) { diff --git a/test/js/samples/deconflict-globals/expected-bundle.js b/test/js/samples/deconflict-globals/expected-bundle.js index 8e04976809..aa850ceb1d 100644 --- a/test/js/samples/deconflict-globals/expected-bundle.js +++ b/test/js/samples/deconflict-globals/expected-bundle.js @@ -5,6 +5,14 @@ function assign(tar, src) { return tar; } +function _differsImmutable(a, b) { + return a != a ? b == b : a !== b; +} + +function callAll(fns) { + while (fns && fns.length) fns.shift()(); +} + function blankObject() { return Object.create(null); } @@ -127,14 +135,6 @@ class Component extends Base { } } -function _differsImmutable(a, b) { - return a != a ? b == b : a !== b; -} - -function callAll(fns) { - while (fns && fns.length) fns.shift()(); -} - /* generated by Svelte vX.Y.Z */ function data_1() { diff --git a/test/js/samples/dev-warning-missing-data-computed/expected-bundle.js b/test/js/samples/dev-warning-missing-data-computed/expected-bundle.js index dc041f1e57..cac872e562 100644 --- a/test/js/samples/dev-warning-missing-data-computed/expected-bundle.js +++ b/test/js/samples/dev-warning-missing-data-computed/expected-bundle.js @@ -5,6 +5,14 @@ function assign(tar, src) { return tar; } +function _differsImmutable(a, b) { + return a != a ? b == b : a !== b; +} + +function callAll(fns) { + while (fns && fns.length) fns.shift()(); +} + function appendNode(node, target) { target.appendChild(node); } @@ -175,14 +183,6 @@ class ComponentDev extends Component { _checkReadOnly() {} } -function _differsImmutable(a, b) { - return a != a ? b == b : a !== b; -} - -function callAll(fns) { - while (fns && fns.length) fns.shift()(); -} - /* generated by Svelte vX.Y.Z */ function bar({ foo }) { diff --git a/test/js/samples/do-use-dataset/expected-bundle.js b/test/js/samples/do-use-dataset/expected-bundle.js index 466f905864..7990254667 100644 --- a/test/js/samples/do-use-dataset/expected-bundle.js +++ b/test/js/samples/do-use-dataset/expected-bundle.js @@ -5,6 +5,14 @@ function assign(tar, src) { return tar; } +function _differsImmutable(a, b) { + return a != a ? b == b : a !== b; +} + +function callAll(fns) { + while (fns && fns.length) fns.shift()(); +} + function insertNode(node, target, anchor) { target.insertBefore(node, anchor); } @@ -143,14 +151,6 @@ class Component extends Base { } } -function _differsImmutable(a, b) { - return a != a ? b == b : a !== b; -} - -function callAll(fns) { - while (fns && fns.length) fns.shift()(); -} - /* generated by Svelte vX.Y.Z */ function create_main_fragment(component, state) { diff --git a/test/js/samples/dont-use-dataset-in-legacy/expected-bundle.js b/test/js/samples/dont-use-dataset-in-legacy/expected-bundle.js index 0eae550e58..af509392ad 100644 --- a/test/js/samples/dont-use-dataset-in-legacy/expected-bundle.js +++ b/test/js/samples/dont-use-dataset-in-legacy/expected-bundle.js @@ -5,6 +5,14 @@ function assign(tar, src) { return tar; } +function _differsImmutable(a, b) { + return a != a ? b == b : a !== b; +} + +function callAll(fns) { + while (fns && fns.length) fns.shift()(); +} + function insertNode(node, target, anchor) { target.insertBefore(node, anchor); } @@ -147,14 +155,6 @@ class Component extends Base { } } -function _differsImmutable(a, b) { - return a != a ? b == b : a !== b; -} - -function callAll(fns) { - while (fns && fns.length) fns.shift()(); -} - /* generated by Svelte vX.Y.Z */ function create_main_fragment(component, state) { diff --git a/test/js/samples/dont-use-dataset-in-svg/expected-bundle.js b/test/js/samples/dont-use-dataset-in-svg/expected-bundle.js index f6c8a48173..a0d7c7967b 100644 --- a/test/js/samples/dont-use-dataset-in-svg/expected-bundle.js +++ b/test/js/samples/dont-use-dataset-in-svg/expected-bundle.js @@ -5,6 +5,14 @@ function assign(tar, src) { return tar; } +function _differsImmutable(a, b) { + return a != a ? b == b : a !== b; +} + +function callAll(fns) { + while (fns && fns.length) fns.shift()(); +} + function appendNode(node, target) { target.appendChild(node); } @@ -147,14 +155,6 @@ class Component extends Base { } } -function _differsImmutable(a, b) { - return a != a ? b == b : a !== b; -} - -function callAll(fns) { - while (fns && fns.length) fns.shift()(); -} - /* generated by Svelte vX.Y.Z */ function create_main_fragment(component, state) { diff --git a/test/js/samples/each-block-changed-check/expected-bundle.js b/test/js/samples/each-block-changed-check/expected-bundle.js index 6924aa1c01..01edc06eb9 100644 --- a/test/js/samples/each-block-changed-check/expected-bundle.js +++ b/test/js/samples/each-block-changed-check/expected-bundle.js @@ -5,6 +5,14 @@ function assign(tar, src) { return tar; } +function _differsImmutable(a, b) { + return a != a ? b == b : a !== b; +} + +function callAll(fns) { + while (fns && fns.length) fns.shift()(); +} + function appendNode(node, target) { target.appendChild(node); } @@ -159,14 +167,6 @@ class Component extends Base { } } -function _differsImmutable(a, b) { - return a != a ? b == b : a !== b; -} - -function callAll(fns) { - while (fns && fns.length) fns.shift()(); -} - /* generated by Svelte vX.Y.Z */ function create_main_fragment(component, state) { diff --git a/test/js/samples/event-handlers-custom/expected-bundle.js b/test/js/samples/event-handlers-custom/expected-bundle.js index dbf6271946..f3e877aabb 100644 --- a/test/js/samples/event-handlers-custom/expected-bundle.js +++ b/test/js/samples/event-handlers-custom/expected-bundle.js @@ -5,6 +5,14 @@ function assign(tar, src) { return tar; } +function _differsImmutable(a, b) { + return a != a ? b == b : a !== b; +} + +function callAll(fns) { + while (fns && fns.length) fns.shift()(); +} + function insertNode(node, target, anchor) { target.insertBefore(node, anchor); } @@ -139,14 +147,6 @@ class Component extends Base { } } -function _differsImmutable(a, b) { - return a != a ? b == b : a !== b; -} - -function callAll(fns) { - while (fns && fns.length) fns.shift()(); -} - /* generated by Svelte vX.Y.Z */ function foo( node, callback ) { diff --git a/test/js/samples/head-no-whitespace/expected-bundle.js b/test/js/samples/head-no-whitespace/expected-bundle.js index 4fbf19e00a..c4e58f6211 100644 --- a/test/js/samples/head-no-whitespace/expected-bundle.js +++ b/test/js/samples/head-no-whitespace/expected-bundle.js @@ -5,6 +5,14 @@ function assign(tar, src) { return tar; } +function _differsImmutable(a, b) { + return a != a ? b == b : a !== b; +} + +function callAll(fns) { + while (fns && fns.length) fns.shift()(); +} + function appendNode(node, target) { target.appendChild(node); } @@ -139,14 +147,6 @@ class Component extends Base { } } -function _differsImmutable(a, b) { - return a != a ? b == b : a !== b; -} - -function callAll(fns) { - while (fns && fns.length) fns.shift()(); -} - /* generated by Svelte vX.Y.Z */ function create_main_fragment(component, state) { diff --git a/test/js/samples/if-block-no-update/expected-bundle.js b/test/js/samples/if-block-no-update/expected-bundle.js index a3492c7c3b..720966d58b 100644 --- a/test/js/samples/if-block-no-update/expected-bundle.js +++ b/test/js/samples/if-block-no-update/expected-bundle.js @@ -5,6 +5,14 @@ function assign(tar, src) { return tar; } +function _differsImmutable(a, b) { + return a != a ? b == b : a !== b; +} + +function callAll(fns) { + while (fns && fns.length) fns.shift()(); +} + function insertNode(node, target, anchor) { target.insertBefore(node, anchor); } @@ -143,14 +151,6 @@ class Component extends Base { } } -function _differsImmutable(a, b) { - return a != a ? b == b : a !== b; -} - -function callAll(fns) { - while (fns && fns.length) fns.shift()(); -} - /* generated by Svelte vX.Y.Z */ function create_main_fragment(component, state) { diff --git a/test/js/samples/if-block-simple/expected-bundle.js b/test/js/samples/if-block-simple/expected-bundle.js index 9221948e00..c1075003bf 100644 --- a/test/js/samples/if-block-simple/expected-bundle.js +++ b/test/js/samples/if-block-simple/expected-bundle.js @@ -5,6 +5,14 @@ function assign(tar, src) { return tar; } +function _differsImmutable(a, b) { + return a != a ? b == b : a !== b; +} + +function callAll(fns) { + while (fns && fns.length) fns.shift()(); +} + function insertNode(node, target, anchor) { target.insertBefore(node, anchor); } @@ -143,14 +151,6 @@ class Component extends Base { } } -function _differsImmutable(a, b) { - return a != a ? b == b : a !== b; -} - -function callAll(fns) { - while (fns && fns.length) fns.shift()(); -} - /* generated by Svelte vX.Y.Z */ function create_main_fragment(component, state) { diff --git a/test/js/samples/inline-style-optimized-multiple/expected-bundle.js b/test/js/samples/inline-style-optimized-multiple/expected-bundle.js index aa1946499f..8837d9d847 100644 --- a/test/js/samples/inline-style-optimized-multiple/expected-bundle.js +++ b/test/js/samples/inline-style-optimized-multiple/expected-bundle.js @@ -5,6 +5,14 @@ function assign(tar, src) { return tar; } +function _differsImmutable(a, b) { + return a != a ? b == b : a !== b; +} + +function callAll(fns) { + while (fns && fns.length) fns.shift()(); +} + function insertNode(node, target, anchor) { target.insertBefore(node, anchor); } @@ -143,14 +151,6 @@ class Component extends Base { } } -function _differsImmutable(a, b) { - return a != a ? b == b : a !== b; -} - -function callAll(fns) { - while (fns && fns.length) fns.shift()(); -} - /* generated by Svelte vX.Y.Z */ function create_main_fragment(component, state) { diff --git a/test/js/samples/inline-style-optimized-url/expected-bundle.js b/test/js/samples/inline-style-optimized-url/expected-bundle.js index 905ebb024c..72228302ed 100644 --- a/test/js/samples/inline-style-optimized-url/expected-bundle.js +++ b/test/js/samples/inline-style-optimized-url/expected-bundle.js @@ -5,6 +5,14 @@ function assign(tar, src) { return tar; } +function _differsImmutable(a, b) { + return a != a ? b == b : a !== b; +} + +function callAll(fns) { + while (fns && fns.length) fns.shift()(); +} + function insertNode(node, target, anchor) { target.insertBefore(node, anchor); } @@ -143,14 +151,6 @@ class Component extends Base { } } -function _differsImmutable(a, b) { - return a != a ? b == b : a !== b; -} - -function callAll(fns) { - while (fns && fns.length) fns.shift()(); -} - /* generated by Svelte vX.Y.Z */ function create_main_fragment(component, state) { diff --git a/test/js/samples/inline-style-optimized/expected-bundle.js b/test/js/samples/inline-style-optimized/expected-bundle.js index be3e62e122..43b50774d4 100644 --- a/test/js/samples/inline-style-optimized/expected-bundle.js +++ b/test/js/samples/inline-style-optimized/expected-bundle.js @@ -5,6 +5,14 @@ function assign(tar, src) { return tar; } +function _differsImmutable(a, b) { + return a != a ? b == b : a !== b; +} + +function callAll(fns) { + while (fns && fns.length) fns.shift()(); +} + function insertNode(node, target, anchor) { target.insertBefore(node, anchor); } @@ -143,14 +151,6 @@ class Component extends Base { } } -function _differsImmutable(a, b) { - return a != a ? b == b : a !== b; -} - -function callAll(fns) { - while (fns && fns.length) fns.shift()(); -} - /* generated by Svelte vX.Y.Z */ function create_main_fragment(component, state) { diff --git a/test/js/samples/inline-style-unoptimized/expected-bundle.js b/test/js/samples/inline-style-unoptimized/expected-bundle.js index 909f9b3646..0856f73e2a 100644 --- a/test/js/samples/inline-style-unoptimized/expected-bundle.js +++ b/test/js/samples/inline-style-unoptimized/expected-bundle.js @@ -5,6 +5,14 @@ function assign(tar, src) { return tar; } +function _differsImmutable(a, b) { + return a != a ? b == b : a !== b; +} + +function callAll(fns) { + while (fns && fns.length) fns.shift()(); +} + function insertNode(node, target, anchor) { target.insertBefore(node, anchor); } @@ -143,14 +151,6 @@ class Component extends Base { } } -function _differsImmutable(a, b) { - return a != a ? b == b : a !== b; -} - -function callAll(fns) { - while (fns && fns.length) fns.shift()(); -} - /* generated by Svelte vX.Y.Z */ function create_main_fragment(component, state) { diff --git a/test/js/samples/input-without-blowback-guard/expected-bundle.js b/test/js/samples/input-without-blowback-guard/expected-bundle.js index 02ec9bccd7..b8af16c6d2 100644 --- a/test/js/samples/input-without-blowback-guard/expected-bundle.js +++ b/test/js/samples/input-without-blowback-guard/expected-bundle.js @@ -5,6 +5,14 @@ function assign(tar, src) { return tar; } +function _differsImmutable(a, b) { + return a != a ? b == b : a !== b; +} + +function callAll(fns) { + while (fns && fns.length) fns.shift()(); +} + function insertNode(node, target, anchor) { target.insertBefore(node, anchor); } @@ -151,14 +159,6 @@ class Component extends Base { } } -function _differsImmutable(a, b) { - return a != a ? b == b : a !== b; -} - -function callAll(fns) { - while (fns && fns.length) fns.shift()(); -} - /* generated by Svelte vX.Y.Z */ function create_main_fragment(component, state) { diff --git a/test/js/samples/legacy-input-type/expected-bundle.js b/test/js/samples/legacy-input-type/expected-bundle.js index 6da52e3914..d864a71173 100644 --- a/test/js/samples/legacy-input-type/expected-bundle.js +++ b/test/js/samples/legacy-input-type/expected-bundle.js @@ -5,6 +5,14 @@ function assign(tar, src) { return tar; } +function _differsImmutable(a, b) { + return a != a ? b == b : a !== b; +} + +function callAll(fns) { + while (fns && fns.length) fns.shift()(); +} + function insertNode(node, target, anchor) { target.insertBefore(node, anchor); } @@ -145,14 +153,6 @@ class Component extends Base { } } -function _differsImmutable(a, b) { - return a != a ? b == b : a !== b; -} - -function callAll(fns) { - while (fns && fns.length) fns.shift()(); -} - /* generated by Svelte vX.Y.Z */ function create_main_fragment(component, state) { diff --git a/test/js/samples/media-bindings/expected-bundle.js b/test/js/samples/media-bindings/expected-bundle.js index df5151a54e..f9c3a82f1f 100644 --- a/test/js/samples/media-bindings/expected-bundle.js +++ b/test/js/samples/media-bindings/expected-bundle.js @@ -5,6 +5,14 @@ function assign(tar, src) { return tar; } +function _differsImmutable(a, b) { + return a != a ? b == b : a !== b; +} + +function callAll(fns) { + while (fns && fns.length) fns.shift()(); +} + function insertNode(node, target, anchor) { target.insertBefore(node, anchor); } @@ -155,14 +163,6 @@ class Component extends Base { } } -function _differsImmutable(a, b) { - return a != a ? b == b : a !== b; -} - -function callAll(fns) { - while (fns && fns.length) fns.shift()(); -} - /* generated by Svelte vX.Y.Z */ function create_main_fragment(component, state) { diff --git a/test/js/samples/method-arrow-function/expected-bundle.js b/test/js/samples/method-arrow-function/expected-bundle.js index 0f9e112452..204f0f8892 100644 --- a/test/js/samples/method-arrow-function/expected-bundle.js +++ b/test/js/samples/method-arrow-function/expected-bundle.js @@ -5,6 +5,14 @@ function assign(tar, src) { return tar; } +function _differsImmutable(a, b) { + return a != a ? b == b : a !== b; +} + +function callAll(fns) { + while (fns && fns.length) fns.shift()(); +} + function blankObject() { return Object.create(null); } @@ -127,14 +135,6 @@ class Component extends Base { } } -function _differsImmutable(a, b) { - return a != a ? b == b : a !== b; -} - -function callAll(fns) { - while (fns && fns.length) fns.shift()(); -} - /* generated by Svelte vX.Y.Z */ function create_main_fragment(component, state) { diff --git a/test/js/samples/method-async/expected-bundle.js b/test/js/samples/method-async/expected-bundle.js index 10f4c1e3fd..b0dc283fa1 100644 --- a/test/js/samples/method-async/expected-bundle.js +++ b/test/js/samples/method-async/expected-bundle.js @@ -5,6 +5,14 @@ function assign(tar, src) { return tar; } +function _differsImmutable(a, b) { + return a != a ? b == b : a !== b; +} + +function callAll(fns) { + while (fns && fns.length) fns.shift()(); +} + function blankObject() { return Object.create(null); } @@ -127,14 +135,6 @@ class Component extends Base { } } -function _differsImmutable(a, b) { - return a != a ? b == b : a !== b; -} - -function callAll(fns) { - while (fns && fns.length) fns.shift()(); -} - /* generated by Svelte vX.Y.Z */ function create_main_fragment(component, state) { diff --git a/test/js/samples/method-function-keyword/expected-bundle.js b/test/js/samples/method-function-keyword/expected-bundle.js index 6d7492f57a..2115cc6b86 100644 --- a/test/js/samples/method-function-keyword/expected-bundle.js +++ b/test/js/samples/method-function-keyword/expected-bundle.js @@ -5,6 +5,14 @@ function assign(tar, src) { return tar; } +function _differsImmutable(a, b) { + return a != a ? b == b : a !== b; +} + +function callAll(fns) { + while (fns && fns.length) fns.shift()(); +} + function blankObject() { return Object.create(null); } @@ -127,14 +135,6 @@ class Component extends Base { } } -function _differsImmutable(a, b) { - return a != a ? b == b : a !== b; -} - -function callAll(fns) { - while (fns && fns.length) fns.shift()(); -} - /* generated by Svelte vX.Y.Z */ function create_main_fragment(component, state) { diff --git a/test/js/samples/method-non-function-expression/expected-bundle.js b/test/js/samples/method-non-function-expression/expected-bundle.js index 3c4a6f8622..91c7b6d525 100644 --- a/test/js/samples/method-non-function-expression/expected-bundle.js +++ b/test/js/samples/method-non-function-expression/expected-bundle.js @@ -5,6 +5,14 @@ function assign(tar, src) { return tar; } +function _differsImmutable(a, b) { + return a != a ? b == b : a !== b; +} + +function callAll(fns) { + while (fns && fns.length) fns.shift()(); +} + function blankObject() { return Object.create(null); } @@ -127,14 +135,6 @@ class Component extends Base { } } -function _differsImmutable(a, b) { - return a != a ? b == b : a !== b; -} - -function callAll(fns) { - while (fns && fns.length) fns.shift()(); -} - /* generated by Svelte vX.Y.Z */ function foo() { diff --git a/test/js/samples/non-imported-component/expected-bundle.js b/test/js/samples/non-imported-component/expected-bundle.js index f3d943a229..f38cc96cfc 100644 --- a/test/js/samples/non-imported-component/expected-bundle.js +++ b/test/js/samples/non-imported-component/expected-bundle.js @@ -7,6 +7,14 @@ function assign(tar, src) { return tar; } +function _differsImmutable(a, b) { + return a != a ? b == b : a !== b; +} + +function callAll(fns) { + while (fns && fns.length) fns.shift()(); +} + function insertNode(node, target, anchor) { target.insertBefore(node, anchor); } @@ -141,14 +149,6 @@ class Component extends Base { } } -function _differsImmutable(a, b) { - return a != a ? b == b : a !== b; -} - -function callAll(fns) { - while (fns && fns.length) fns.shift()(); -} - /* generated by Svelte vX.Y.Z */ diff --git a/test/js/samples/setup-method/expected-bundle.js b/test/js/samples/setup-method/expected-bundle.js index 523ad5eb90..3c696b5649 100644 --- a/test/js/samples/setup-method/expected-bundle.js +++ b/test/js/samples/setup-method/expected-bundle.js @@ -5,6 +5,14 @@ function assign(tar, src) { return tar; } +function _differsImmutable(a, b) { + return a != a ? b == b : a !== b; +} + +function callAll(fns) { + while (fns && fns.length) fns.shift()(); +} + function blankObject() { return Object.create(null); } @@ -127,14 +135,6 @@ class Component extends Base { } } -function _differsImmutable(a, b) { - return a != a ? b == b : a !== b; -} - -function callAll(fns) { - while (fns && fns.length) fns.shift()(); -} - /* generated by Svelte vX.Y.Z */ function setup(Component$$1) { diff --git a/test/js/samples/svg-title/expected-bundle.js b/test/js/samples/svg-title/expected-bundle.js index 5d992714dd..2f6a4423b3 100644 --- a/test/js/samples/svg-title/expected-bundle.js +++ b/test/js/samples/svg-title/expected-bundle.js @@ -5,6 +5,14 @@ function assign(tar, src) { return tar; } +function _differsImmutable(a, b) { + return a != a ? b == b : a !== b; +} + +function callAll(fns) { + while (fns && fns.length) fns.shift()(); +} + function appendNode(node, target) { target.appendChild(node); } @@ -147,14 +155,6 @@ class Component extends Base { } } -function _differsImmutable(a, b) { - return a != a ? b == b : a !== b; -} - -function callAll(fns) { - while (fns && fns.length) fns.shift()(); -} - /* generated by Svelte vX.Y.Z */ function create_main_fragment(component, state) { diff --git a/test/js/samples/title/expected-bundle.js b/test/js/samples/title/expected-bundle.js index 55b3a2644e..a7458a2cd3 100644 --- a/test/js/samples/title/expected-bundle.js +++ b/test/js/samples/title/expected-bundle.js @@ -5,6 +5,14 @@ function assign(tar, src) { return tar; } +function _differsImmutable(a, b) { + return a != a ? b == b : a !== b; +} + +function callAll(fns) { + while (fns && fns.length) fns.shift()(); +} + function blankObject() { return Object.create(null); } @@ -127,14 +135,6 @@ class Component extends Base { } } -function _differsImmutable(a, b) { - return a != a ? b == b : a !== b; -} - -function callAll(fns) { - while (fns && fns.length) fns.shift()(); -} - /* generated by Svelte vX.Y.Z */ function create_main_fragment(component, state) { diff --git a/test/js/samples/use-elements-as-anchors/expected-bundle.js b/test/js/samples/use-elements-as-anchors/expected-bundle.js index 239be07fae..40751cfc8f 100644 --- a/test/js/samples/use-elements-as-anchors/expected-bundle.js +++ b/test/js/samples/use-elements-as-anchors/expected-bundle.js @@ -5,6 +5,14 @@ function assign(tar, src) { return tar; } +function _differsImmutable(a, b) { + return a != a ? b == b : a !== b; +} + +function callAll(fns) { + while (fns && fns.length) fns.shift()(); +} + function appendNode(node, target) { target.appendChild(node); } @@ -151,14 +159,6 @@ class Component extends Base { } } -function _differsImmutable(a, b) { - return a != a ? b == b : a !== b; -} - -function callAll(fns) { - while (fns && fns.length) fns.shift()(); -} - /* generated by Svelte vX.Y.Z */ function create_main_fragment(component, state) { diff --git a/test/js/samples/window-binding-scroll/expected-bundle.js b/test/js/samples/window-binding-scroll/expected-bundle.js index 9c2e078249..dc5f54aa35 100644 --- a/test/js/samples/window-binding-scroll/expected-bundle.js +++ b/test/js/samples/window-binding-scroll/expected-bundle.js @@ -5,6 +5,14 @@ function assign(tar, src) { return tar; } +function _differsImmutable(a, b) { + return a != a ? b == b : a !== b; +} + +function callAll(fns) { + while (fns && fns.length) fns.shift()(); +} + function appendNode(node, target) { target.appendChild(node); } @@ -147,14 +155,6 @@ class Component extends Base { } } -function _differsImmutable(a, b) { - return a != a ? b == b : a !== b; -} - -function callAll(fns) { - while (fns && fns.length) fns.shift()(); -} - /* generated by Svelte vX.Y.Z */ function create_main_fragment(component, state) {