diff --git a/src/generators/dom/index.ts b/src/generators/dom/index.ts index 9566ba936f67..f947ec0a4c0f 100644 --- a/src/generators/dom/index.ts +++ b/src/generators/dom/index.ts @@ -204,7 +204,7 @@ export default function dom( const constructorBody = deindent` ${options.dev && `this._debugName = '${debugName}';`} ${options.dev && !generator.customElement && - `if (!options || (!options.target && !options._root)) throw new Error("'target' is a required option");`} + `if (!options || (!options.target && !options.root)) throw new Error("'target' is a required option");`} @init(this, options); ${generator.usesRefs && `this.refs = {};`} this._state = @assign(${initialState.join(', ')}); @@ -239,13 +239,13 @@ export default function dom( ${templateProperties.oncreate && `var _oncreate = %oncreate.bind(this);`} ${(templateProperties.oncreate || generator.hasComponents || generator.hasComplexBindings || generator.hasIntroTransitions) && deindent` - if (!options._root) { + if (!options.root) { this._oncreate = [${templateProperties.oncreate && `_oncreate`}]; ${(generator.hasComponents || generator.hasComplexBindings) && `this._beforecreate = [];`} ${(generator.hasComponents || generator.hasIntroTransitions) && `this._aftercreate = [];`} } ${templateProperties.oncreate && deindent` else { - this._root._oncreate.push(_oncreate); + this.root._oncreate.push(_oncreate); } `} `} diff --git a/src/generators/nodes/Component.ts b/src/generators/nodes/Component.ts index 95b29fcbd36a..8115ac808b47 100644 --- a/src/generators/nodes/Component.ts +++ b/src/generators/nodes/Component.ts @@ -68,7 +68,7 @@ export default class Component extends Node { const name = this.var; - const componentInitProperties = [`_root: #component._root`]; + const componentInitProperties = [`root: #component.root`]; if (this.children.length > 0) { const slots = Array.from(this._slots).map(name => `${name}: @createFragment()`); @@ -217,7 +217,7 @@ export default class Component extends Node { `); beforecreate = deindent` - #component._root._beforecreate.push(function() { + #component.root._beforecreate.push(function() { var state = #component.get(), childState = ${name}.get(), newState = {}; if (!childState) return; ${setParentFromChildOnInit} diff --git a/src/generators/nodes/Element.ts b/src/generators/nodes/Element.ts index 9a11cbde2511..33c21d63f064 100644 --- a/src/generators/nodes/Element.ts +++ b/src/generators/nodes/Element.ts @@ -527,7 +527,7 @@ export default class Element extends Node { this.generator.hasComplexBindings = true; block.builders.hydrate.addLine( - `if (!(${allInitialStateIsDefined})) #component._root._beforecreate.push(${handler});` + `if (!(${allInitialStateIsDefined})) #component.root._beforecreate.push(${handler});` ); } }); @@ -556,7 +556,7 @@ export default class Element extends Node { const fn = `%transitions-${intro.name}`; block.builders.intro.addBlock(deindent` - #component._root._aftercreate.push(function() { + #component.root._aftercreate.push(function() { if (!${name}) ${name} = @wrapTransition(#component, ${this.var}, ${fn}, ${snippet}, true, null); ${name}.run(true, function() { #component.fire("intro.end", { node: ${this.var} }); @@ -593,7 +593,7 @@ export default class Element extends Node { } block.builders.intro.addBlock(deindent` - #component._root._aftercreate.push(function() { + #component.root._aftercreate.push(function() { ${introName} = @wrapTransition(#component, ${this.var}, ${fn}, ${snippet}, true, null); ${introName}.run(true, function() { #component.fire("intro.end", { node: ${this.var} }); diff --git a/src/shared/index.js b/src/shared/index.js index 79b6f2cba9d2..fc87e66eb257 100644 --- a/src/shared/index.js +++ b/src/shared/index.js @@ -67,11 +67,11 @@ export function get(key) { export function init(component, options) { component._observers = { pre: blankObject(), post: blankObject() }; component._handlers = blankObject(); - component._root = options._root || component; component._bind = options._bind; component.options = options; - component.store = component._root.options.store; + component.root = options.root || component; + component.store = component.root.options.store; } export function observe(key, callback, options) { @@ -136,12 +136,12 @@ export function onDev(eventName, handler) { export function 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; + 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; } export function _set(newState) { 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 c54a4508e72e..6c2eadf1484c 100644 --- a/test/js/samples/collapses-text-around-comments/expected-bundle.js +++ b/test/js/samples/collapses-text-around-comments/expected-bundle.js @@ -93,11 +93,11 @@ function get(key) { function init(component, options) { component._observers = { pre: blankObject(), post: blankObject() }; component._handlers = blankObject(); - component._root = options._root || component; component._bind = options._bind; component.options = options; - component.store = component._root.options.store; + component.root = options.root || component; + component.store = component.root.options.store; } function observe(key, callback, options) { @@ -137,12 +137,12 @@ function on(eventName, handler) { function 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; + 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; } function _set(newState) { diff --git a/test/js/samples/component-static/expected-bundle.js b/test/js/samples/component-static/expected-bundle.js index 27d4a5d5df62..7045cd9ff86b 100644 --- a/test/js/samples/component-static/expected-bundle.js +++ b/test/js/samples/component-static/expected-bundle.js @@ -69,11 +69,11 @@ function get(key) { function init(component, options) { component._observers = { pre: blankObject(), post: blankObject() }; component._handlers = blankObject(); - component._root = options._root || component; component._bind = options._bind; component.options = options; - component.store = component._root.options.store; + component.root = options.root || component; + component.store = component.root.options.store; } function observe(key, callback, options) { @@ -113,12 +113,12 @@ function on(eventName, handler) { function 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; + 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; } function _set(newState) { @@ -174,7 +174,7 @@ var Nested = window.Nested; function create_main_fragment(state, component) { var nested = new Nested({ - _root: component._root, + root: component.root, data: { foo: "bar" } }); @@ -203,7 +203,7 @@ function SvelteComponent(options) { init(this, options); this._state = assign({}, options.data); - if (!options._root) { + if (!options.root) { this._oncreate = []; this._beforecreate = []; this._aftercreate = []; diff --git a/test/js/samples/component-static/expected.js b/test/js/samples/component-static/expected.js index 421a7adda6c8..d75cce1253cb 100644 --- a/test/js/samples/component-static/expected.js +++ b/test/js/samples/component-static/expected.js @@ -6,7 +6,7 @@ var Nested = window.Nested; function create_main_fragment(state, component) { var nested = new Nested({ - _root: component._root, + root: component.root, data: { foo: "bar" } }); @@ -35,7 +35,7 @@ function SvelteComponent(options) { init(this, options); this._state = assign({}, options.data); - if (!options._root) { + if (!options.root) { this._oncreate = []; this._beforecreate = []; this._aftercreate = []; diff --git a/test/js/samples/computed-collapsed-if/expected-bundle.js b/test/js/samples/computed-collapsed-if/expected-bundle.js index 9129d64ebfda..0a2f23d10087 100644 --- a/test/js/samples/computed-collapsed-if/expected-bundle.js +++ b/test/js/samples/computed-collapsed-if/expected-bundle.js @@ -69,11 +69,11 @@ function get(key) { function init(component, options) { component._observers = { pre: blankObject(), post: blankObject() }; component._handlers = blankObject(); - component._root = options._root || component; component._bind = options._bind; component.options = options; - component.store = component._root.options.store; + component.root = options.root || component; + component.store = component.root.options.store; } function observe(key, callback, options) { @@ -113,12 +113,12 @@ function on(eventName, handler) { function 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; + 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; } function _set(newState) { diff --git a/test/js/samples/css-media-query/expected-bundle.js b/test/js/samples/css-media-query/expected-bundle.js index 3eb06a7baaae..57181b1064c4 100644 --- a/test/js/samples/css-media-query/expected-bundle.js +++ b/test/js/samples/css-media-query/expected-bundle.js @@ -89,11 +89,11 @@ function get(key) { function init(component, options) { component._observers = { pre: blankObject(), post: blankObject() }; component._handlers = blankObject(); - component._root = options._root || component; component._bind = options._bind; component.options = options; - component.store = component._root.options.store; + component.root = options.root || component; + component.store = component.root.options.store; } function observe(key, callback, options) { @@ -133,12 +133,12 @@ function on(eventName, handler) { function 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; + 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; } function _set(newState) { 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 a8a14c254a69..ce3509fa69a5 100644 --- a/test/js/samples/css-shadow-dom-keyframes/expected-bundle.js +++ b/test/js/samples/css-shadow-dom-keyframes/expected-bundle.js @@ -81,11 +81,11 @@ function get(key) { function init(component, options) { component._observers = { pre: blankObject(), post: blankObject() }; component._handlers = blankObject(); - component._root = options._root || component; component._bind = options._bind; component.options = options; - component.store = component._root.options.store; + component.root = options.root || component; + component.store = component.root.options.store; } function observe(key, callback, options) { @@ -125,12 +125,12 @@ function on(eventName, handler) { function 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; + 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; } function _set(newState) { diff --git a/test/js/samples/do-use-dataset/expected-bundle.js b/test/js/samples/do-use-dataset/expected-bundle.js index 1baf806a5223..e82c4bf6204c 100644 --- a/test/js/samples/do-use-dataset/expected-bundle.js +++ b/test/js/samples/do-use-dataset/expected-bundle.js @@ -85,11 +85,11 @@ function get(key) { function init(component, options) { component._observers = { pre: blankObject(), post: blankObject() }; component._handlers = blankObject(); - component._root = options._root || component; component._bind = options._bind; component.options = options; - component.store = component._root.options.store; + component.root = options.root || component; + component.store = component.root.options.store; } function observe(key, callback, options) { @@ -129,12 +129,12 @@ function on(eventName, handler) { function 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; + 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; } function _set(newState) { 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 3ebad459d3df..9a982ad0438c 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 @@ -89,11 +89,11 @@ function get(key) { function init(component, options) { component._observers = { pre: blankObject(), post: blankObject() }; component._handlers = blankObject(); - component._root = options._root || component; component._bind = options._bind; component.options = options; - component.store = component._root.options.store; + component.root = options.root || component; + component.store = component.root.options.store; } function observe(key, callback, options) { @@ -133,12 +133,12 @@ function on(eventName, handler) { function 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; + 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; } function _set(newState) { 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 ba9b37513c46..253506e4c9e5 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 @@ -89,11 +89,11 @@ function get(key) { function init(component, options) { component._observers = { pre: blankObject(), post: blankObject() }; component._handlers = blankObject(); - component._root = options._root || component; component._bind = options._bind; component.options = options; - component.store = component._root.options.store; + component.root = options.root || component; + component.store = component.root.options.store; } function observe(key, callback, options) { @@ -133,12 +133,12 @@ function on(eventName, handler) { function 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; + 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; } function _set(newState) { 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 dae7830ecbb7..79439f1af03e 100644 --- a/test/js/samples/each-block-changed-check/expected-bundle.js +++ b/test/js/samples/each-block-changed-check/expected-bundle.js @@ -101,11 +101,11 @@ function get(key) { function init(component, options) { component._observers = { pre: blankObject(), post: blankObject() }; component._handlers = blankObject(); - component._root = options._root || component; component._bind = options._bind; component.options = options; - component.store = component._root.options.store; + component.root = options.root || component; + component.store = component.root.options.store; } function observe(key, callback, options) { @@ -145,12 +145,12 @@ function on(eventName, handler) { function 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; + 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; } function _set(newState) { diff --git a/test/js/samples/event-handlers-custom/expected-bundle.js b/test/js/samples/event-handlers-custom/expected-bundle.js index b1974ae869ea..c06174272598 100644 --- a/test/js/samples/event-handlers-custom/expected-bundle.js +++ b/test/js/samples/event-handlers-custom/expected-bundle.js @@ -81,11 +81,11 @@ function get(key) { function init(component, options) { component._observers = { pre: blankObject(), post: blankObject() }; component._handlers = blankObject(); - component._root = options._root || component; component._bind = options._bind; component.options = options; - component.store = component._root.options.store; + component.root = options.root || component; + component.store = component.root.options.store; } function observe(key, callback, options) { @@ -125,12 +125,12 @@ function on(eventName, handler) { function 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; + 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; } function _set(newState) { 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 12822a4ed3bd..673464486c1d 100644 --- a/test/js/samples/if-block-no-update/expected-bundle.js +++ b/test/js/samples/if-block-no-update/expected-bundle.js @@ -85,11 +85,11 @@ function get(key) { function init(component, options) { component._observers = { pre: blankObject(), post: blankObject() }; component._handlers = blankObject(); - component._root = options._root || component; component._bind = options._bind; component.options = options; - component.store = component._root.options.store; + component.root = options.root || component; + component.store = component.root.options.store; } function observe(key, callback, options) { @@ -129,12 +129,12 @@ function on(eventName, handler) { function 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; + 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; } function _set(newState) { diff --git a/test/js/samples/if-block-simple/expected-bundle.js b/test/js/samples/if-block-simple/expected-bundle.js index 098526057995..fc54ee85a7ac 100644 --- a/test/js/samples/if-block-simple/expected-bundle.js +++ b/test/js/samples/if-block-simple/expected-bundle.js @@ -85,11 +85,11 @@ function get(key) { function init(component, options) { component._observers = { pre: blankObject(), post: blankObject() }; component._handlers = blankObject(); - component._root = options._root || component; component._bind = options._bind; component.options = options; - component.store = component._root.options.store; + component.root = options.root || component; + component.store = component.root.options.store; } function observe(key, callback, options) { @@ -129,12 +129,12 @@ function on(eventName, handler) { function 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; + 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; } function _set(newState) { 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 6260246cc081..fa6efd1cec4e 100644 --- a/test/js/samples/inline-style-optimized-multiple/expected-bundle.js +++ b/test/js/samples/inline-style-optimized-multiple/expected-bundle.js @@ -85,11 +85,11 @@ function get(key) { function init(component, options) { component._observers = { pre: blankObject(), post: blankObject() }; component._handlers = blankObject(); - component._root = options._root || component; component._bind = options._bind; component.options = options; - component.store = component._root.options.store; + component.root = options.root || component; + component.store = component.root.options.store; } function observe(key, callback, options) { @@ -129,12 +129,12 @@ function on(eventName, handler) { function 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; + 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; } function _set(newState) { 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 921d377bf92c..2efac93cd50b 100644 --- a/test/js/samples/inline-style-optimized-url/expected-bundle.js +++ b/test/js/samples/inline-style-optimized-url/expected-bundle.js @@ -85,11 +85,11 @@ function get(key) { function init(component, options) { component._observers = { pre: blankObject(), post: blankObject() }; component._handlers = blankObject(); - component._root = options._root || component; component._bind = options._bind; component.options = options; - component.store = component._root.options.store; + component.root = options.root || component; + component.store = component.root.options.store; } function observe(key, callback, options) { @@ -129,12 +129,12 @@ function on(eventName, handler) { function 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; + 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; } function _set(newState) { diff --git a/test/js/samples/inline-style-optimized/expected-bundle.js b/test/js/samples/inline-style-optimized/expected-bundle.js index 8ddc55d2155a..d69bc32b9472 100644 --- a/test/js/samples/inline-style-optimized/expected-bundle.js +++ b/test/js/samples/inline-style-optimized/expected-bundle.js @@ -85,11 +85,11 @@ function get(key) { function init(component, options) { component._observers = { pre: blankObject(), post: blankObject() }; component._handlers = blankObject(); - component._root = options._root || component; component._bind = options._bind; component.options = options; - component.store = component._root.options.store; + component.root = options.root || component; + component.store = component.root.options.store; } function observe(key, callback, options) { @@ -129,12 +129,12 @@ function on(eventName, handler) { function 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; + 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; } function _set(newState) { diff --git a/test/js/samples/inline-style-unoptimized/expected-bundle.js b/test/js/samples/inline-style-unoptimized/expected-bundle.js index c3ca9e695714..1765fc172822 100644 --- a/test/js/samples/inline-style-unoptimized/expected-bundle.js +++ b/test/js/samples/inline-style-unoptimized/expected-bundle.js @@ -85,11 +85,11 @@ function get(key) { function init(component, options) { component._observers = { pre: blankObject(), post: blankObject() }; component._handlers = blankObject(); - component._root = options._root || component; component._bind = options._bind; component.options = options; - component.store = component._root.options.store; + component.root = options.root || component; + component.store = component.root.options.store; } function observe(key, callback, options) { @@ -129,12 +129,12 @@ function on(eventName, handler) { function 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; + 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; } function _set(newState) { 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 a7a7d25e0c7c..a4b7837682c6 100644 --- a/test/js/samples/input-without-blowback-guard/expected-bundle.js +++ b/test/js/samples/input-without-blowback-guard/expected-bundle.js @@ -89,11 +89,11 @@ function get(key) { function init(component, options) { component._observers = { pre: blankObject(), post: blankObject() }; component._handlers = blankObject(); - component._root = options._root || component; component._bind = options._bind; component.options = options; - component.store = component._root.options.store; + component.root = options.root || component; + component.store = component.root.options.store; } function observe(key, callback, options) { @@ -133,12 +133,12 @@ function on(eventName, handler) { function 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; + 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; } function _set(newState) { diff --git a/test/js/samples/legacy-input-type/expected-bundle.js b/test/js/samples/legacy-input-type/expected-bundle.js index 54a4c3c02d37..b7cfc1320ae8 100644 --- a/test/js/samples/legacy-input-type/expected-bundle.js +++ b/test/js/samples/legacy-input-type/expected-bundle.js @@ -87,11 +87,11 @@ function get(key) { function init(component, options) { component._observers = { pre: blankObject(), post: blankObject() }; component._handlers = blankObject(); - component._root = options._root || component; component._bind = options._bind; component.options = options; - component.store = component._root.options.store; + component.root = options.root || component; + component.store = component.root.options.store; } function observe(key, callback, options) { @@ -131,12 +131,12 @@ function on(eventName, handler) { function 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; + 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; } function _set(newState) { diff --git a/test/js/samples/legacy-quote-class/expected-bundle.js b/test/js/samples/legacy-quote-class/expected-bundle.js index c6f7bb8405c1..d71ad3e74b5c 100644 --- a/test/js/samples/legacy-quote-class/expected-bundle.js +++ b/test/js/samples/legacy-quote-class/expected-bundle.js @@ -104,11 +104,11 @@ function get(key) { function init(component, options) { component._observers = { pre: blankObject(), post: blankObject() }; component._handlers = blankObject(); - component._root = options._root || component; component._bind = options._bind; component.options = options; - component.store = component._root.options.store; + component.root = options.root || component; + component.store = component.root.options.store; } function observe(key, callback, options) { @@ -148,12 +148,12 @@ function on(eventName, handler) { function 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; + 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; } function _set(newState) { diff --git a/test/js/samples/media-bindings/expected-bundle.js b/test/js/samples/media-bindings/expected-bundle.js index bdac2a8f2a43..9ab9d72d9d35 100644 --- a/test/js/samples/media-bindings/expected-bundle.js +++ b/test/js/samples/media-bindings/expected-bundle.js @@ -97,11 +97,11 @@ function get(key) { function init(component, options) { component._observers = { pre: blankObject(), post: blankObject() }; component._handlers = blankObject(); - component._root = options._root || component; component._bind = options._bind; component.options = options; - component.store = component._root.options.store; + component.root = options.root || component; + component.store = component.root.options.store; } function observe(key, callback, options) { @@ -141,12 +141,12 @@ function on(eventName, handler) { function 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; + 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; } function _set(newState) { @@ -234,15 +234,15 @@ function create_main_fragment(state, component) { h: function hydrate() { addListener(audio, "timeupdate", audio_timeupdate_handler); - if (!('played' in state && 'currentTime' in state)) component._root._beforecreate.push(audio_timeupdate_handler); + if (!('played' in state && 'currentTime' in state)) component.root._beforecreate.push(audio_timeupdate_handler); addListener(audio, "durationchange", audio_durationchange_handler); - if (!('duration' in state)) component._root._beforecreate.push(audio_durationchange_handler); + if (!('duration' in state)) component.root._beforecreate.push(audio_durationchange_handler); addListener(audio, "play", audio_play_pause_handler); addListener(audio, "pause", audio_play_pause_handler); addListener(audio, "progress", audio_progress_handler); - if (!('buffered' in state)) component._root._beforecreate.push(audio_progress_handler); + if (!('buffered' in state)) component.root._beforecreate.push(audio_progress_handler); addListener(audio, "loadedmetadata", audio_loadedmetadata_handler); - if (!('buffered' in state && 'seekable' in state)) component._root._beforecreate.push(audio_loadedmetadata_handler); + if (!('buffered' in state && 'seekable' in state)) component.root._beforecreate.push(audio_loadedmetadata_handler); }, m: function mount(target, anchor) { @@ -273,7 +273,7 @@ function SvelteComponent(options) { init(this, options); this._state = assign({}, options.data); - if (!options._root) { + if (!options.root) { this._oncreate = []; this._beforecreate = []; } diff --git a/test/js/samples/media-bindings/expected.js b/test/js/samples/media-bindings/expected.js index c14eb2aa83ff..c1dd10c23885 100644 --- a/test/js/samples/media-bindings/expected.js +++ b/test/js/samples/media-bindings/expected.js @@ -38,15 +38,15 @@ function create_main_fragment(state, component) { h: function hydrate() { addListener(audio, "timeupdate", audio_timeupdate_handler); - if (!('played' in state && 'currentTime' in state)) component._root._beforecreate.push(audio_timeupdate_handler); + if (!('played' in state && 'currentTime' in state)) component.root._beforecreate.push(audio_timeupdate_handler); addListener(audio, "durationchange", audio_durationchange_handler); - if (!('duration' in state)) component._root._beforecreate.push(audio_durationchange_handler); + if (!('duration' in state)) component.root._beforecreate.push(audio_durationchange_handler); addListener(audio, "play", audio_play_pause_handler); addListener(audio, "pause", audio_play_pause_handler); addListener(audio, "progress", audio_progress_handler); - if (!('buffered' in state)) component._root._beforecreate.push(audio_progress_handler); + if (!('buffered' in state)) component.root._beforecreate.push(audio_progress_handler); addListener(audio, "loadedmetadata", audio_loadedmetadata_handler); - if (!('buffered' in state && 'seekable' in state)) component._root._beforecreate.push(audio_loadedmetadata_handler); + if (!('buffered' in state && 'seekable' in state)) component.root._beforecreate.push(audio_loadedmetadata_handler); }, m: function mount(target, anchor) { @@ -77,7 +77,7 @@ function SvelteComponent(options) { init(this, options); this._state = assign({}, options.data); - if (!options._root) { + if (!options.root) { this._oncreate = []; this._beforecreate = []; } diff --git a/test/js/samples/non-imported-component/expected-bundle.js b/test/js/samples/non-imported-component/expected-bundle.js index fd201d65b3fb..a7dd66c12860 100644 --- a/test/js/samples/non-imported-component/expected-bundle.js +++ b/test/js/samples/non-imported-component/expected-bundle.js @@ -83,11 +83,11 @@ function get(key) { function init(component, options) { component._observers = { pre: blankObject(), post: blankObject() }; component._handlers = blankObject(); - component._root = options._root || component; component._bind = options._bind; component.options = options; - component.store = component._root.options.store; + component.root = options.root || component; + component.store = component.root.options.store; } function observe(key, callback, options) { @@ -127,12 +127,12 @@ function on(eventName, handler) { function 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; + 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; } function _set(newState) { @@ -187,11 +187,11 @@ function create_main_fragment(state, component) { var text; var imported = new Imported({ - _root: component._root + root: component.root }); var nonimported = new NonImported({ - _root: component._root + root: component.root }); return { @@ -226,7 +226,7 @@ function SvelteComponent(options) { init(this, options); this._state = assign({}, options.data); - if (!options._root) { + if (!options.root) { this._oncreate = []; this._beforecreate = []; this._aftercreate = []; diff --git a/test/js/samples/non-imported-component/expected.js b/test/js/samples/non-imported-component/expected.js index 234a824e6c74..e7fc2c72558b 100644 --- a/test/js/samples/non-imported-component/expected.js +++ b/test/js/samples/non-imported-component/expected.js @@ -8,11 +8,11 @@ function create_main_fragment(state, component) { var text; var imported = new Imported({ - _root: component._root + root: component.root }); var nonimported = new NonImported({ - _root: component._root + root: component.root }); return { @@ -47,7 +47,7 @@ function SvelteComponent(options) { init(this, options); this._state = assign({}, options.data); - if (!options._root) { + if (!options.root) { this._oncreate = []; this._beforecreate = []; this._aftercreate = []; diff --git a/test/js/samples/onrender-onteardown-rewritten/expected-bundle.js b/test/js/samples/onrender-onteardown-rewritten/expected-bundle.js index 364ee2901d19..5e3648119dcf 100644 --- a/test/js/samples/onrender-onteardown-rewritten/expected-bundle.js +++ b/test/js/samples/onrender-onteardown-rewritten/expected-bundle.js @@ -69,11 +69,11 @@ function get(key) { function init(component, options) { component._observers = { pre: blankObject(), post: blankObject() }; component._handlers = blankObject(); - component._root = options._root || component; component._bind = options._bind; component.options = options; - component.store = component._root.options.store; + component.root = options.root || component; + component.store = component.root.options.store; } function observe(key, callback, options) { @@ -113,12 +113,12 @@ function on(eventName, handler) { function 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; + 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; } function _set(newState) { @@ -196,10 +196,10 @@ function SvelteComponent(options) { var _oncreate = oncreate.bind(this); - if (!options._root) { + if (!options.root) { this._oncreate = [_oncreate]; } else { - this._root._oncreate.push(_oncreate); + this.root._oncreate.push(_oncreate); } this._fragment = create_main_fragment(this._state, this); diff --git a/test/js/samples/onrender-onteardown-rewritten/expected.js b/test/js/samples/onrender-onteardown-rewritten/expected.js index ae6046dddb36..4cb3ad1f6f3a 100644 --- a/test/js/samples/onrender-onteardown-rewritten/expected.js +++ b/test/js/samples/onrender-onteardown-rewritten/expected.js @@ -28,10 +28,10 @@ function SvelteComponent(options) { var _oncreate = oncreate.bind(this); - if (!options._root) { + if (!options.root) { this._oncreate = [_oncreate]; } else { - this._root._oncreate.push(_oncreate); + this.root._oncreate.push(_oncreate); } this._fragment = create_main_fragment(this._state, this); diff --git a/test/js/samples/setup-method/expected-bundle.js b/test/js/samples/setup-method/expected-bundle.js index df267db975a7..1e35598d5ac0 100644 --- a/test/js/samples/setup-method/expected-bundle.js +++ b/test/js/samples/setup-method/expected-bundle.js @@ -69,11 +69,11 @@ function get(key) { function init(component, options) { component._observers = { pre: blankObject(), post: blankObject() }; component._handlers = blankObject(); - component._root = options._root || component; component._bind = options._bind; component.options = options; - component.store = component._root.options.store; + component.root = options.root || component; + component.store = component.root.options.store; } function observe(key, callback, options) { @@ -113,12 +113,12 @@ function on(eventName, handler) { function 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; + 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; } function _set(newState) { 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 272e03977275..47d5a50224cc 100644 --- a/test/js/samples/use-elements-as-anchors/expected-bundle.js +++ b/test/js/samples/use-elements-as-anchors/expected-bundle.js @@ -93,11 +93,11 @@ function get(key) { function init(component, options) { component._observers = { pre: blankObject(), post: blankObject() }; component._handlers = blankObject(); - component._root = options._root || component; component._bind = options._bind; component.options = options; - component.store = component._root.options.store; + component.root = options.root || component; + component.store = component.root.options.store; } function observe(key, callback, options) { @@ -137,12 +137,12 @@ function on(eventName, handler) { function 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; + 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; } function _set(newState) { diff --git a/test/js/samples/window-binding-scroll/expected-bundle.js b/test/js/samples/window-binding-scroll/expected-bundle.js index 3a11deb1b695..aedda719ed51 100644 --- a/test/js/samples/window-binding-scroll/expected-bundle.js +++ b/test/js/samples/window-binding-scroll/expected-bundle.js @@ -89,11 +89,11 @@ function get(key) { function init(component, options) { component._observers = { pre: blankObject(), post: blankObject() }; component._handlers = blankObject(); - component._root = options._root || component; component._bind = options._bind; component.options = options; - component.store = component._root.options.store; + component.root = options.root || component; + component.store = component.root.options.store; } function observe(key, callback, options) { @@ -133,12 +133,12 @@ function on(eventName, handler) { function 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; + 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; } function _set(newState) {