diff --git a/src/shared/index.js b/src/shared/index.js index 0d7cb43bddbb..1040e5eb6be6 100644 --- a/src/shared/index.js +++ b/src/shared/index.js @@ -13,11 +13,12 @@ export function blankObject() { export function destroy(detach) { this.destroy = noop; this.fire('destroy'); - this.set = this.get = noop; + this.set = noop; if (detach !== false) this._fragment.u(); this._fragment.d(); - this._fragment = this._state = null; + this._fragment = null; + this._state = {}; } export function destroyDev(detach) { diff --git a/test/js/samples/action/expected-bundle.js b/test/js/samples/action/expected-bundle.js index 093fb642a768..6c93a26fbbab 100644 --- a/test/js/samples/action/expected-bundle.js +++ b/test/js/samples/action/expected-bundle.js @@ -24,11 +24,12 @@ function blankObject() { function destroy(detach) { this.destroy = noop; this.fire('destroy'); - this.set = this.get = noop; + this.set = noop; if (detach !== false) this._fragment.u(); this._fragment.d(); - this._fragment = this._state = null; + this._fragment = null; + this._state = {}; } function _differs(a, b) { 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 6786d1c2dcff..6d3d9653a440 100644 --- a/test/js/samples/collapses-text-around-comments/expected-bundle.js +++ b/test/js/samples/collapses-text-around-comments/expected-bundle.js @@ -32,11 +32,12 @@ function blankObject() { function destroy(detach) { this.destroy = noop; this.fire('destroy'); - this.set = this.get = noop; + this.set = noop; if (detach !== false) this._fragment.u(); this._fragment.d(); - this._fragment = this._state = null; + this._fragment = null; + this._state = {}; } function _differs(a, b) { diff --git a/test/js/samples/component-static-immutable/expected-bundle.js b/test/js/samples/component-static-immutable/expected-bundle.js index 235f57755d3a..885c914ee4c6 100644 --- a/test/js/samples/component-static-immutable/expected-bundle.js +++ b/test/js/samples/component-static-immutable/expected-bundle.js @@ -12,11 +12,12 @@ function blankObject() { function destroy(detach) { this.destroy = noop; this.fire('destroy'); - this.set = this.get = noop; + this.set = noop; if (detach !== false) this._fragment.u(); this._fragment.d(); - this._fragment = this._state = null; + this._fragment = null; + this._state = {}; } function _differs(a, b) { diff --git a/test/js/samples/component-static-immutable2/expected-bundle.js b/test/js/samples/component-static-immutable2/expected-bundle.js index 235f57755d3a..885c914ee4c6 100644 --- a/test/js/samples/component-static-immutable2/expected-bundle.js +++ b/test/js/samples/component-static-immutable2/expected-bundle.js @@ -12,11 +12,12 @@ function blankObject() { function destroy(detach) { this.destroy = noop; this.fire('destroy'); - this.set = this.get = noop; + this.set = noop; if (detach !== false) this._fragment.u(); this._fragment.d(); - this._fragment = this._state = null; + this._fragment = null; + this._state = {}; } function _differs(a, b) { diff --git a/test/js/samples/component-static/expected-bundle.js b/test/js/samples/component-static/expected-bundle.js index dc4f6dbf0dd9..3a076f7b0668 100644 --- a/test/js/samples/component-static/expected-bundle.js +++ b/test/js/samples/component-static/expected-bundle.js @@ -12,11 +12,12 @@ function blankObject() { function destroy(detach) { this.destroy = noop; this.fire('destroy'); - this.set = this.get = noop; + this.set = noop; if (detach !== false) this._fragment.u(); this._fragment.d(); - this._fragment = this._state = null; + this._fragment = null; + this._state = {}; } function _differs(a, b) { diff --git a/test/js/samples/computed-collapsed-if/expected-bundle.js b/test/js/samples/computed-collapsed-if/expected-bundle.js index 8cd4bf0011db..c4ee81667268 100644 --- a/test/js/samples/computed-collapsed-if/expected-bundle.js +++ b/test/js/samples/computed-collapsed-if/expected-bundle.js @@ -12,11 +12,12 @@ function blankObject() { function destroy(detach) { this.destroy = noop; this.fire('destroy'); - this.set = this.get = noop; + this.set = noop; if (detach !== false) this._fragment.u(); this._fragment.d(); - this._fragment = this._state = null; + this._fragment = null; + this._state = {}; } function _differs(a, b) { diff --git a/test/js/samples/css-media-query/expected-bundle.js b/test/js/samples/css-media-query/expected-bundle.js index 6b1455f9c6ae..4a9ed1203e03 100644 --- a/test/js/samples/css-media-query/expected-bundle.js +++ b/test/js/samples/css-media-query/expected-bundle.js @@ -28,11 +28,12 @@ function blankObject() { function destroy(detach) { this.destroy = noop; this.fire('destroy'); - this.set = this.get = noop; + this.set = noop; if (detach !== false) this._fragment.u(); this._fragment.d(); - this._fragment = this._state = null; + this._fragment = null; + this._state = {}; } function _differs(a, b) { 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 c2f35f7b986e..fe55d1c905cd 100644 --- a/test/js/samples/css-shadow-dom-keyframes/expected-bundle.js +++ b/test/js/samples/css-shadow-dom-keyframes/expected-bundle.js @@ -24,11 +24,12 @@ function blankObject() { function destroy(detach) { this.destroy = noop; this.fire('destroy'); - this.set = this.get = noop; + this.set = noop; if (detach !== false) this._fragment.u(); this._fragment.d(); - this._fragment = this._state = null; + this._fragment = null; + this._state = {}; } function _differs(a, b) { diff --git a/test/js/samples/deconflict-builtins/expected-bundle.js b/test/js/samples/deconflict-builtins/expected-bundle.js index 2f9dd2db1d49..f26f231f4a05 100644 --- a/test/js/samples/deconflict-builtins/expected-bundle.js +++ b/test/js/samples/deconflict-builtins/expected-bundle.js @@ -42,11 +42,12 @@ function blankObject() { function destroy(detach) { this.destroy = noop; this.fire('destroy'); - this.set = this.get = noop; + this.set = noop; if (detach !== false) this._fragment.u(); this._fragment.d(); - this._fragment = this._state = null; + this._fragment = null; + this._state = {}; } function _differs(a, b) { diff --git a/test/js/samples/deconflict-globals/expected-bundle.js b/test/js/samples/deconflict-globals/expected-bundle.js index 214eed957865..5f02ccb9f3f7 100644 --- a/test/js/samples/deconflict-globals/expected-bundle.js +++ b/test/js/samples/deconflict-globals/expected-bundle.js @@ -12,11 +12,12 @@ function blankObject() { function destroy(detach) { this.destroy = noop; this.fire('destroy'); - this.set = this.get = noop; + this.set = noop; if (detach !== false) this._fragment.u(); this._fragment.d(); - this._fragment = this._state = null; + this._fragment = null; + this._state = {}; } function _differs(a, b) { 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 e0ff6a11717d..574211a6e0d8 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 @@ -32,11 +32,12 @@ function blankObject() { function destroy(detach) { this.destroy = noop; this.fire('destroy'); - this.set = this.get = noop; + this.set = noop; if (detach !== false) this._fragment.u(); this._fragment.d(); - this._fragment = this._state = null; + this._fragment = null; + this._state = {}; } function destroyDev(detach) { diff --git a/test/js/samples/do-use-dataset/expected-bundle.js b/test/js/samples/do-use-dataset/expected-bundle.js index 32af7494c3df..7e6d87e70d02 100644 --- a/test/js/samples/do-use-dataset/expected-bundle.js +++ b/test/js/samples/do-use-dataset/expected-bundle.js @@ -28,11 +28,12 @@ function blankObject() { function destroy(detach) { this.destroy = noop; this.fire('destroy'); - this.set = this.get = noop; + this.set = noop; if (detach !== false) this._fragment.u(); this._fragment.d(); - this._fragment = this._state = null; + this._fragment = null; + this._state = {}; } function _differs(a, b) { 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 5e9def191391..e7bd12a65e3f 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 @@ -32,11 +32,12 @@ function blankObject() { function destroy(detach) { this.destroy = noop; this.fire('destroy'); - this.set = this.get = noop; + this.set = noop; if (detach !== false) this._fragment.u(); this._fragment.d(); - this._fragment = this._state = null; + this._fragment = null; + this._state = {}; } function _differs(a, b) { 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 54b8382a2db9..51c29449e754 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 @@ -32,11 +32,12 @@ function blankObject() { function destroy(detach) { this.destroy = noop; this.fire('destroy'); - this.set = this.get = noop; + this.set = noop; if (detach !== false) this._fragment.u(); this._fragment.d(); - this._fragment = this._state = null; + this._fragment = null; + this._state = {}; } function _differs(a, b) { 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 89c3cab24320..fc21b6f74792 100644 --- a/test/js/samples/each-block-changed-check/expected-bundle.js +++ b/test/js/samples/each-block-changed-check/expected-bundle.js @@ -44,11 +44,12 @@ function blankObject() { function destroy(detach) { this.destroy = noop; this.fire('destroy'); - this.set = this.get = noop; + this.set = noop; if (detach !== false) this._fragment.u(); this._fragment.d(); - this._fragment = this._state = null; + this._fragment = null; + this._state = {}; } function _differs(a, b) { diff --git a/test/js/samples/event-handlers-custom/expected-bundle.js b/test/js/samples/event-handlers-custom/expected-bundle.js index 5d85e177e1b4..0cfb3a6cee07 100644 --- a/test/js/samples/event-handlers-custom/expected-bundle.js +++ b/test/js/samples/event-handlers-custom/expected-bundle.js @@ -24,11 +24,12 @@ function blankObject() { function destroy(detach) { this.destroy = noop; this.fire('destroy'); - this.set = this.get = noop; + this.set = noop; if (detach !== false) this._fragment.u(); this._fragment.d(); - this._fragment = this._state = null; + this._fragment = null; + this._state = {}; } function _differs(a, b) { diff --git a/test/js/samples/head-no-whitespace/expected-bundle.js b/test/js/samples/head-no-whitespace/expected-bundle.js index 7f88574b70f6..f812b7f6e2b6 100644 --- a/test/js/samples/head-no-whitespace/expected-bundle.js +++ b/test/js/samples/head-no-whitespace/expected-bundle.js @@ -24,11 +24,12 @@ function blankObject() { function destroy(detach) { this.destroy = noop; this.fire('destroy'); - this.set = this.get = noop; + this.set = noop; if (detach !== false) this._fragment.u(); this._fragment.d(); - this._fragment = this._state = null; + this._fragment = null; + this._state = {}; } function _differs(a, b) { 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 1760a2ca607f..345549181173 100644 --- a/test/js/samples/if-block-no-update/expected-bundle.js +++ b/test/js/samples/if-block-no-update/expected-bundle.js @@ -28,11 +28,12 @@ function blankObject() { function destroy(detach) { this.destroy = noop; this.fire('destroy'); - this.set = this.get = noop; + this.set = noop; if (detach !== false) this._fragment.u(); this._fragment.d(); - this._fragment = this._state = null; + this._fragment = null; + this._state = {}; } function _differs(a, b) { diff --git a/test/js/samples/if-block-simple/expected-bundle.js b/test/js/samples/if-block-simple/expected-bundle.js index f71aafff9415..3e1925e2ea13 100644 --- a/test/js/samples/if-block-simple/expected-bundle.js +++ b/test/js/samples/if-block-simple/expected-bundle.js @@ -28,11 +28,12 @@ function blankObject() { function destroy(detach) { this.destroy = noop; this.fire('destroy'); - this.set = this.get = noop; + this.set = noop; if (detach !== false) this._fragment.u(); this._fragment.d(); - this._fragment = this._state = null; + this._fragment = null; + this._state = {}; } function _differs(a, b) { 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 bd3bacfac27a..77e36beceb55 100644 --- a/test/js/samples/inline-style-optimized-multiple/expected-bundle.js +++ b/test/js/samples/inline-style-optimized-multiple/expected-bundle.js @@ -28,11 +28,12 @@ function blankObject() { function destroy(detach) { this.destroy = noop; this.fire('destroy'); - this.set = this.get = noop; + this.set = noop; if (detach !== false) this._fragment.u(); this._fragment.d(); - this._fragment = this._state = null; + this._fragment = null; + this._state = {}; } function _differs(a, b) { 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 411990568209..2850b95305f0 100644 --- a/test/js/samples/inline-style-optimized-url/expected-bundle.js +++ b/test/js/samples/inline-style-optimized-url/expected-bundle.js @@ -28,11 +28,12 @@ function blankObject() { function destroy(detach) { this.destroy = noop; this.fire('destroy'); - this.set = this.get = noop; + this.set = noop; if (detach !== false) this._fragment.u(); this._fragment.d(); - this._fragment = this._state = null; + this._fragment = null; + this._state = {}; } function _differs(a, b) { diff --git a/test/js/samples/inline-style-optimized/expected-bundle.js b/test/js/samples/inline-style-optimized/expected-bundle.js index 7643ee066d12..eade3769eec5 100644 --- a/test/js/samples/inline-style-optimized/expected-bundle.js +++ b/test/js/samples/inline-style-optimized/expected-bundle.js @@ -28,11 +28,12 @@ function blankObject() { function destroy(detach) { this.destroy = noop; this.fire('destroy'); - this.set = this.get = noop; + this.set = noop; if (detach !== false) this._fragment.u(); this._fragment.d(); - this._fragment = this._state = null; + this._fragment = null; + this._state = {}; } function _differs(a, b) { diff --git a/test/js/samples/inline-style-unoptimized/expected-bundle.js b/test/js/samples/inline-style-unoptimized/expected-bundle.js index 67b27347432a..4b696f17afc3 100644 --- a/test/js/samples/inline-style-unoptimized/expected-bundle.js +++ b/test/js/samples/inline-style-unoptimized/expected-bundle.js @@ -28,11 +28,12 @@ function blankObject() { function destroy(detach) { this.destroy = noop; this.fire('destroy'); - this.set = this.get = noop; + this.set = noop; if (detach !== false) this._fragment.u(); this._fragment.d(); - this._fragment = this._state = null; + this._fragment = null; + this._state = {}; } function _differs(a, b) { 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 e881aa6de460..9101a81c6c48 100644 --- a/test/js/samples/input-without-blowback-guard/expected-bundle.js +++ b/test/js/samples/input-without-blowback-guard/expected-bundle.js @@ -36,11 +36,12 @@ function blankObject() { function destroy(detach) { this.destroy = noop; this.fire('destroy'); - this.set = this.get = noop; + this.set = noop; if (detach !== false) this._fragment.u(); this._fragment.d(); - this._fragment = this._state = null; + this._fragment = null; + this._state = {}; } function _differs(a, b) { diff --git a/test/js/samples/legacy-input-type/expected-bundle.js b/test/js/samples/legacy-input-type/expected-bundle.js index 1119454b3db6..f07c5c914e28 100644 --- a/test/js/samples/legacy-input-type/expected-bundle.js +++ b/test/js/samples/legacy-input-type/expected-bundle.js @@ -30,11 +30,12 @@ function blankObject() { function destroy(detach) { this.destroy = noop; this.fire('destroy'); - this.set = this.get = noop; + this.set = noop; if (detach !== false) this._fragment.u(); this._fragment.d(); - this._fragment = this._state = null; + this._fragment = null; + this._state = {}; } function _differs(a, b) { diff --git a/test/js/samples/media-bindings/expected-bundle.js b/test/js/samples/media-bindings/expected-bundle.js index abcdd409862d..b2010075af39 100644 --- a/test/js/samples/media-bindings/expected-bundle.js +++ b/test/js/samples/media-bindings/expected-bundle.js @@ -40,11 +40,12 @@ function blankObject() { function destroy(detach) { this.destroy = noop; this.fire('destroy'); - this.set = this.get = noop; + this.set = noop; if (detach !== false) this._fragment.u(); this._fragment.d(); - this._fragment = this._state = null; + this._fragment = null; + this._state = {}; } function _differs(a, b) { diff --git a/test/js/samples/non-imported-component/expected-bundle.js b/test/js/samples/non-imported-component/expected-bundle.js index b4adec303a0a..871f615eb9c3 100644 --- a/test/js/samples/non-imported-component/expected-bundle.js +++ b/test/js/samples/non-imported-component/expected-bundle.js @@ -26,11 +26,12 @@ function blankObject() { function destroy(detach) { this.destroy = noop; this.fire('destroy'); - this.set = this.get = noop; + this.set = noop; if (detach !== false) this._fragment.u(); this._fragment.d(); - this._fragment = this._state = null; + this._fragment = null; + this._state = {}; } function _differs(a, b) { diff --git a/test/js/samples/setup-method/expected-bundle.js b/test/js/samples/setup-method/expected-bundle.js index e1aaa9ae759a..53edf878f8a6 100644 --- a/test/js/samples/setup-method/expected-bundle.js +++ b/test/js/samples/setup-method/expected-bundle.js @@ -12,11 +12,12 @@ function blankObject() { function destroy(detach) { this.destroy = noop; this.fire('destroy'); - this.set = this.get = noop; + this.set = noop; if (detach !== false) this._fragment.u(); this._fragment.d(); - this._fragment = this._state = null; + this._fragment = null; + this._state = {}; } function _differs(a, b) { diff --git a/test/js/samples/svg-title/expected-bundle.js b/test/js/samples/svg-title/expected-bundle.js index 477d97c83947..5b9452eb77c3 100644 --- a/test/js/samples/svg-title/expected-bundle.js +++ b/test/js/samples/svg-title/expected-bundle.js @@ -32,11 +32,12 @@ function blankObject() { function destroy(detach) { this.destroy = noop; this.fire('destroy'); - this.set = this.get = noop; + this.set = noop; if (detach !== false) this._fragment.u(); this._fragment.d(); - this._fragment = this._state = null; + this._fragment = null; + this._state = {}; } function _differs(a, b) { diff --git a/test/js/samples/title/expected-bundle.js b/test/js/samples/title/expected-bundle.js index 27cae18b3d14..1403bdadcd1b 100644 --- a/test/js/samples/title/expected-bundle.js +++ b/test/js/samples/title/expected-bundle.js @@ -12,11 +12,12 @@ function blankObject() { function destroy(detach) { this.destroy = noop; this.fire('destroy'); - this.set = this.get = noop; + this.set = noop; if (detach !== false) this._fragment.u(); this._fragment.d(); - this._fragment = this._state = null; + this._fragment = null; + this._state = {}; } function _differs(a, b) { 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 1fda063de122..5554270e8b28 100644 --- a/test/js/samples/use-elements-as-anchors/expected-bundle.js +++ b/test/js/samples/use-elements-as-anchors/expected-bundle.js @@ -36,11 +36,12 @@ function blankObject() { function destroy(detach) { this.destroy = noop; this.fire('destroy'); - this.set = this.get = noop; + this.set = noop; if (detach !== false) this._fragment.u(); this._fragment.d(); - this._fragment = this._state = null; + this._fragment = null; + this._state = {}; } function _differs(a, b) { diff --git a/test/js/samples/window-binding-scroll/expected-bundle.js b/test/js/samples/window-binding-scroll/expected-bundle.js index df4fc6b2c981..704146c5a967 100644 --- a/test/js/samples/window-binding-scroll/expected-bundle.js +++ b/test/js/samples/window-binding-scroll/expected-bundle.js @@ -32,11 +32,12 @@ function blankObject() { function destroy(detach) { this.destroy = noop; this.fire('destroy'); - this.set = this.get = noop; + this.set = noop; if (detach !== false) this._fragment.u(); this._fragment.d(); - this._fragment = this._state = null; + this._fragment = null; + this._state = {}; } function _differs(a, b) { diff --git a/test/runtime/samples/get-after-destroy/_config.js b/test/runtime/samples/get-after-destroy/_config.js new file mode 100644 index 000000000000..c3627bc604b4 --- /dev/null +++ b/test/runtime/samples/get-after-destroy/_config.js @@ -0,0 +1,13 @@ +export default { + data: { + foo: 1 + }, + + html: `
1
`, + + test(assert, component) { + component.destroy(); + const { foo } = component.get(); + assert.equal(foo, undefined); + } +} \ No newline at end of file diff --git a/test/runtime/samples/get-after-destroy/main.html b/test/runtime/samples/get-after-destroy/main.html new file mode 100644 index 000000000000..ea892526af6a --- /dev/null +++ b/test/runtime/samples/get-after-destroy/main.html @@ -0,0 +1 @@ +
{foo}
\ No newline at end of file