Skip to content

Commit

Permalink
set state to blank object on destroy, not null - fixes #1354
Browse files Browse the repository at this point in the history
  • Loading branch information
Rich-Harris committed Apr 22, 2018
1 parent a6262ce commit f8b076b
Show file tree
Hide file tree
Showing 35 changed files with 113 additions and 66 deletions.
5 changes: 3 additions & 2 deletions src/shared/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
5 changes: 3 additions & 2 deletions test/js/samples/action/expected-bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
5 changes: 3 additions & 2 deletions test/js/samples/component-static-immutable/expected-bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
5 changes: 3 additions & 2 deletions test/js/samples/component-static/expected-bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
5 changes: 3 additions & 2 deletions test/js/samples/computed-collapsed-if/expected-bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
5 changes: 3 additions & 2 deletions test/js/samples/css-media-query/expected-bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
5 changes: 3 additions & 2 deletions test/js/samples/css-shadow-dom-keyframes/expected-bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
5 changes: 3 additions & 2 deletions test/js/samples/deconflict-builtins/expected-bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
5 changes: 3 additions & 2 deletions test/js/samples/deconflict-globals/expected-bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
5 changes: 3 additions & 2 deletions test/js/samples/do-use-dataset/expected-bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
5 changes: 3 additions & 2 deletions test/js/samples/dont-use-dataset-in-legacy/expected-bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
5 changes: 3 additions & 2 deletions test/js/samples/dont-use-dataset-in-svg/expected-bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
5 changes: 3 additions & 2 deletions test/js/samples/each-block-changed-check/expected-bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
5 changes: 3 additions & 2 deletions test/js/samples/event-handlers-custom/expected-bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
5 changes: 3 additions & 2 deletions test/js/samples/head-no-whitespace/expected-bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
5 changes: 3 additions & 2 deletions test/js/samples/if-block-no-update/expected-bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
5 changes: 3 additions & 2 deletions test/js/samples/if-block-simple/expected-bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
5 changes: 3 additions & 2 deletions test/js/samples/inline-style-optimized-url/expected-bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
5 changes: 3 additions & 2 deletions test/js/samples/inline-style-optimized/expected-bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
5 changes: 3 additions & 2 deletions test/js/samples/inline-style-unoptimized/expected-bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
5 changes: 3 additions & 2 deletions test/js/samples/legacy-input-type/expected-bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Loading

0 comments on commit f8b076b

Please sign in to comment.