replace destroy with noop on destroy

pull/7738/head
Rich Harris 8 years ago
parent 6ae5e32371
commit a2e85aec1d

@ -212,7 +212,6 @@ export default function dom(
this._root = options._root || this; this._root = options._root || this;
this._yield = options._yield; this._yield = options._yield;
this._destroyed = false;
${generator.stylesheet.hasStyles && ${generator.stylesheet.hasStyles &&
options.css !== false && options.css !== false &&
`if ( !document.getElementById( '${generator.stylesheet.id}-style' ) ) @add_css();`} `if ( !document.getElementById( '${generator.stylesheet.id}-style' ) ) @add_css();`}

@ -5,22 +5,21 @@ export * from './transitions.js';
export * from './utils.js'; export * from './utils.js';
export function destroy(detach) { export function destroy(detach) {
if (!this._destroyed) { this.destroy = this.set = noop;
this.set = noop; this.fire('destroy');
this.fire('destroy');
if (detach !== false) this._fragment.unmount(); if (detach !== false) this._fragment.unmount();
this._fragment.destroy(); this._fragment.destroy();
this._fragment = null; this._fragment = null;
this._state = {}; this._state = {};
this._destroyed = true;
}
} }
export function destroyDev(detach) { export function destroyDev(detach) {
if (this._destroyed) console.warn('Component was already destroyed');
destroy.call(this, detach); destroy.call(this, detach);
this.destroy = function() {
console.warn('Component was already destroyed');
};
} }
export function differs(a, b) { export function differs(a, b) {

@ -38,17 +38,14 @@ function setAttribute(node, attribute, value) {
} }
function destroy(detach) { function destroy(detach) {
if (!this._destroyed) { this.destroy = this.set = noop;
this.set = noop; this.fire('destroy');
this.fire('destroy');
if (detach !== false) this._fragment.unmount(); if (detach !== false) this._fragment.unmount();
this._fragment.destroy(); this._fragment.destroy();
this._fragment = null; this._fragment = null;
this._state = {}; this._state = {};
this._destroyed = true;
}
} }
function differs(a, b) { function differs(a, b) {
@ -217,7 +214,6 @@ function SvelteComponent ( options ) {
this._root = options._root || this; this._root = options._root || this;
this._yield = options._yield; this._yield = options._yield;
this._destroyed = false;
if ( !document.getElementById( 'svelte-3590263702-style' ) ) add_css(); if ( !document.getElementById( 'svelte-3590263702-style' ) ) add_css();
this._fragment = create_main_fragment( this._state, this ); this._fragment = create_main_fragment( this._state, this );

@ -66,7 +66,6 @@ function SvelteComponent ( options ) {
this._root = options._root || this; this._root = options._root || this;
this._yield = options._yield; this._yield = options._yield;
this._destroyed = false;
if ( !document.getElementById( 'svelte-3590263702-style' ) ) add_css(); if ( !document.getElementById( 'svelte-3590263702-style' ) ) add_css();
this._fragment = create_main_fragment( this._state, this ); this._fragment = create_main_fragment( this._state, this );

@ -14,17 +14,14 @@ function assign(target) {
} }
function destroy(detach) { function destroy(detach) {
if (!this._destroyed) { this.destroy = this.set = noop;
this.set = noop; this.fire('destroy');
this.fire('destroy');
if (detach !== false) this._fragment.unmount(); if (detach !== false) this._fragment.unmount();
this._fragment.destroy(); this._fragment.destroy();
this._fragment = null; this._fragment = null;
this._state = {}; this._state = {};
this._destroyed = true;
}
} }
function differs(a, b) { function differs(a, b) {
@ -171,8 +168,6 @@ function SvelteComponent ( options ) {
this._root = options._root || this; this._root = options._root || this;
this._yield = options._yield; this._yield = options._yield;
this._destroyed = false;
this._fragment = create_main_fragment( this._state, this ); this._fragment = create_main_fragment( this._state, this );
if ( options.target ) { if ( options.target ) {

@ -44,8 +44,6 @@ function SvelteComponent ( options ) {
this._root = options._root || this; this._root = options._root || this;
this._yield = options._yield; this._yield = options._yield;
this._destroyed = false;
this._fragment = create_main_fragment( this._state, this ); this._fragment = create_main_fragment( this._state, this );
if ( options.target ) { if ( options.target ) {

@ -34,17 +34,14 @@ function setAttribute(node, attribute, value) {
} }
function destroy(detach) { function destroy(detach) {
if (!this._destroyed) { this.destroy = this.set = noop;
this.set = noop; this.fire('destroy');
this.fire('destroy');
if (detach !== false) this._fragment.unmount(); if (detach !== false) this._fragment.unmount();
this._fragment.destroy(); this._fragment.destroy();
this._fragment = null; this._fragment = null;
this._state = {}; this._state = {};
this._destroyed = true;
}
} }
function differs(a, b) { function differs(a, b) {
@ -197,7 +194,6 @@ function SvelteComponent ( options ) {
this._root = options._root || this; this._root = options._root || this;
this._yield = options._yield; this._yield = options._yield;
this._destroyed = false;
if ( !document.getElementById( 'svelte-2363328337-style' ) ) add_css(); if ( !document.getElementById( 'svelte-2363328337-style' ) ) add_css();
this._fragment = create_main_fragment( this._state, this ); this._fragment = create_main_fragment( this._state, this );

@ -50,7 +50,6 @@ function SvelteComponent ( options ) {
this._root = options._root || this; this._root = options._root || this;
this._yield = options._yield; this._yield = options._yield;
this._destroyed = false;
if ( !document.getElementById( 'svelte-2363328337-style' ) ) add_css(); if ( !document.getElementById( 'svelte-2363328337-style' ) ) add_css();
this._fragment = create_main_fragment( this._state, this ); this._fragment = create_main_fragment( this._state, this );

@ -47,17 +47,14 @@ function createText(data) {
} }
function destroy(detach) { function destroy(detach) {
if (!this._destroyed) { this.destroy = this.set = noop;
this.set = noop; this.fire('destroy');
this.fire('destroy');
if (detach !== false) this._fragment.unmount(); if (detach !== false) this._fragment.unmount();
this._fragment.destroy(); this._fragment.destroy();
this._fragment = null; this._fragment = null;
this._state = {}; this._state = {};
this._destroyed = true;
}
} }
function differs(a, b) { function differs(a, b) {
@ -317,8 +314,6 @@ function SvelteComponent ( options ) {
this._root = options._root || this; this._root = options._root || this;
this._yield = options._yield; this._yield = options._yield;
this._destroyed = false;
this._fragment = create_main_fragment( this._state, this ); this._fragment = create_main_fragment( this._state, this );
if ( options.target ) { if ( options.target ) {

@ -157,8 +157,6 @@ function SvelteComponent ( options ) {
this._root = options._root || this; this._root = options._root || this;
this._yield = options._yield; this._yield = options._yield;
this._destroyed = false;
this._fragment = create_main_fragment( this._state, this ); this._fragment = create_main_fragment( this._state, this );
if ( options.target ) { if ( options.target ) {

@ -34,17 +34,14 @@ function createText(data) {
} }
function destroy(detach) { function destroy(detach) {
if (!this._destroyed) { this.destroy = this.set = noop;
this.set = noop; this.fire('destroy');
this.fire('destroy');
if (detach !== false) this._fragment.unmount(); if (detach !== false) this._fragment.unmount();
this._fragment.destroy(); this._fragment.destroy();
this._fragment = null; this._fragment = null;
this._state = {}; this._state = {};
this._destroyed = true;
}
} }
function differs(a, b) { function differs(a, b) {
@ -208,8 +205,6 @@ function SvelteComponent ( options ) {
this._root = options._root || this; this._root = options._root || this;
this._yield = options._yield; this._yield = options._yield;
this._destroyed = false;
this._fragment = create_main_fragment( this._state, this ); this._fragment = create_main_fragment( this._state, this );
if ( options.target ) { if ( options.target ) {

@ -61,8 +61,6 @@ function SvelteComponent ( options ) {
this._root = options._root || this; this._root = options._root || this;
this._yield = options._yield; this._yield = options._yield;
this._destroyed = false;
this._fragment = create_main_fragment( this._state, this ); this._fragment = create_main_fragment( this._state, this );
if ( options.target ) { if ( options.target ) {

@ -38,17 +38,14 @@ function createComment() {
} }
function destroy(detach) { function destroy(detach) {
if (!this._destroyed) { this.destroy = this.set = noop;
this.set = noop; this.fire('destroy');
this.fire('destroy');
if (detach !== false) this._fragment.unmount(); if (detach !== false) this._fragment.unmount();
this._fragment.destroy(); this._fragment.destroy();
this._fragment = null; this._fragment = null;
this._state = {}; this._state = {};
this._destroyed = true;
}
} }
function differs(a, b) { function differs(a, b) {
@ -252,8 +249,6 @@ function SvelteComponent ( options ) {
this._root = options._root || this; this._root = options._root || this;
this._yield = options._yield; this._yield = options._yield;
this._destroyed = false;
this._fragment = create_main_fragment( this._state, this ); this._fragment = create_main_fragment( this._state, this );
if ( options.target ) { if ( options.target ) {

@ -101,8 +101,6 @@ function SvelteComponent ( options ) {
this._root = options._root || this; this._root = options._root || this;
this._yield = options._yield; this._yield = options._yield;
this._destroyed = false;
this._fragment = create_main_fragment( this._state, this ); this._fragment = create_main_fragment( this._state, this );
if ( options.target ) { if ( options.target ) {

@ -38,17 +38,14 @@ function createComment() {
} }
function destroy(detach) { function destroy(detach) {
if (!this._destroyed) { this.destroy = this.set = noop;
this.set = noop; this.fire('destroy');
this.fire('destroy');
if (detach !== false) this._fragment.unmount(); if (detach !== false) this._fragment.unmount();
this._fragment.destroy(); this._fragment.destroy();
this._fragment = null; this._fragment = null;
this._state = {}; this._state = {};
this._destroyed = true;
}
} }
function differs(a, b) { function differs(a, b) {
@ -228,8 +225,6 @@ function SvelteComponent ( options ) {
this._root = options._root || this; this._root = options._root || this;
this._yield = options._yield; this._yield = options._yield;
this._destroyed = false;
this._fragment = create_main_fragment( this._state, this ); this._fragment = create_main_fragment( this._state, this );
if ( options.target ) { if ( options.target ) {

@ -77,8 +77,6 @@ function SvelteComponent ( options ) {
this._root = options._root || this; this._root = options._root || this;
this._yield = options._yield; this._yield = options._yield;
this._destroyed = false;
this._fragment = create_main_fragment( this._state, this ); this._fragment = create_main_fragment( this._state, this );
if ( options.target ) { if ( options.target ) {

@ -28,17 +28,14 @@ function createText(data) {
} }
function destroy(detach) { function destroy(detach) {
if (!this._destroyed) { this.destroy = this.set = noop;
this.set = noop; this.fire('destroy');
this.fire('destroy');
if (detach !== false) this._fragment.unmount(); if (detach !== false) this._fragment.unmount();
this._fragment.destroy(); this._fragment.destroy();
this._fragment = null; this._fragment = null;
this._state = {}; this._state = {};
this._destroyed = true;
}
} }
function differs(a, b) { function differs(a, b) {
@ -200,8 +197,6 @@ function SvelteComponent ( options ) {
this._root = options._root || this; this._root = options._root || this;
this._yield = options._yield; this._yield = options._yield;
this._destroyed = false;
if ( !options._root ) { if ( !options._root ) {
this._oncreate = []; this._oncreate = [];
this._beforecreate = []; this._beforecreate = [];

@ -61,8 +61,6 @@ function SvelteComponent ( options ) {
this._root = options._root || this; this._root = options._root || this;
this._yield = options._yield; this._yield = options._yield;
this._destroyed = false;
if ( !options._root ) { if ( !options._root ) {
this._oncreate = []; this._oncreate = [];
this._beforecreate = []; this._beforecreate = [];

@ -14,17 +14,14 @@ function assign(target) {
} }
function destroy(detach) { function destroy(detach) {
if (!this._destroyed) { this.destroy = this.set = noop;
this.set = noop; this.fire('destroy');
this.fire('destroy');
if (detach !== false) this._fragment.unmount(); if (detach !== false) this._fragment.unmount();
this._fragment.destroy(); this._fragment.destroy();
this._fragment = null; this._fragment = null;
this._state = {}; this._state = {};
this._destroyed = true;
}
} }
function differs(a, b) { function differs(a, b) {
@ -163,8 +160,6 @@ function SvelteComponent ( options ) {
this._root = options._root || this; this._root = options._root || this;
this._yield = options._yield; this._yield = options._yield;
this._destroyed = false;
var oncreate = template.oncreate.bind( this ); var oncreate = template.oncreate.bind( this );
if ( !options._root ) { if ( !options._root ) {

@ -36,8 +36,6 @@ function SvelteComponent ( options ) {
this._root = options._root || this; this._root = options._root || this;
this._yield = options._yield; this._yield = options._yield;
this._destroyed = false;
var oncreate = template.oncreate.bind( this ); var oncreate = template.oncreate.bind( this );
if ( !options._root ) { if ( !options._root ) {

@ -14,17 +14,14 @@ function assign(target) {
} }
function destroy(detach) { function destroy(detach) {
if (!this._destroyed) { this.destroy = this.set = noop;
this.set = noop; this.fire('destroy');
this.fire('destroy');
if (detach !== false) this._fragment.unmount(); if (detach !== false) this._fragment.unmount();
this._fragment.destroy(); this._fragment.destroy();
this._fragment = null; this._fragment = null;
this._state = {}; this._state = {};
this._destroyed = true;
}
} }
function differs(a, b) { function differs(a, b) {
@ -173,8 +170,6 @@ function SvelteComponent ( options ) {
this._root = options._root || this; this._root = options._root || this;
this._yield = options._yield; this._yield = options._yield;
this._destroyed = false;
this._fragment = create_main_fragment( this._state, this ); this._fragment = create_main_fragment( this._state, this );
if ( options.target ) { if ( options.target ) {

@ -46,8 +46,6 @@ function SvelteComponent ( options ) {
this._root = options._root || this; this._root = options._root || this;
this._yield = options._yield; this._yield = options._yield;
this._destroyed = false;
this._fragment = create_main_fragment( this._state, this ); this._fragment = create_main_fragment( this._state, this );
if ( options.target ) { if ( options.target ) {

@ -38,17 +38,14 @@ function createComment() {
} }
function destroy(detach) { function destroy(detach) {
if (!this._destroyed) { this.destroy = this.set = noop;
this.set = noop; this.fire('destroy');
this.fire('destroy');
if (detach !== false) this._fragment.unmount(); if (detach !== false) this._fragment.unmount();
this._fragment.destroy(); this._fragment.destroy();
this._fragment = null; this._fragment = null;
this._state = {}; this._state = {};
this._destroyed = true;
}
} }
function differs(a, b) { function differs(a, b) {
@ -412,8 +409,6 @@ function SvelteComponent ( options ) {
this._root = options._root || this; this._root = options._root || this;
this._yield = options._yield; this._yield = options._yield;
this._destroyed = false;
this._fragment = create_main_fragment( this._state, this ); this._fragment = create_main_fragment( this._state, this );
if ( options.target ) { if ( options.target ) {

@ -261,8 +261,6 @@ function SvelteComponent ( options ) {
this._root = options._root || this; this._root = options._root || this;
this._yield = options._yield; this._yield = options._yield;
this._destroyed = false;
this._fragment = create_main_fragment( this._state, this ); this._fragment = create_main_fragment( this._state, this );
if ( options.target ) { if ( options.target ) {

Loading…
Cancel
Save