Merge pull request #1365 from sveltejs/gh-1354

set state to blank object on destroy, not null
pull/1370/head
Rich Harris 7 years ago committed by GitHub
commit 4734382e69
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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) {

@ -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) {

@ -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) {

@ -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) {

@ -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) {

@ -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) {

@ -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) {

@ -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) {

@ -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) {

@ -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) {

@ -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) {

@ -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) {

@ -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) {

@ -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) {

@ -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) {

@ -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) {

@ -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) {

@ -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) {

@ -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) {

@ -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) {

@ -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) {

@ -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) {

@ -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) {

@ -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) {

@ -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) {

@ -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) {

@ -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) {

@ -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) {

@ -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) {

@ -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) {

@ -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) {

@ -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) {

@ -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) {

@ -0,0 +1,13 @@
export default {
data: {
foo: 1
},
html: `<div>1</div>`,
test(assert, component) {
component.destroy();
const { foo } = component.get();
assert.equal(foo, undefined);
}
}
Loading…
Cancel
Save