update tests

pull/7738/head
Rich Harris 8 years ago
parent 30cc2664c7
commit 6a1248334b

@ -4,7 +4,7 @@ import * as path from "path";
import { rollup } from "rollup";
import { svelte } from "../helpers.js";
describe.skip("js", () => {
describe("js", () => {
fs.readdirSync("test/js/samples").forEach(dir => {
if (dir[0] === ".") return;

@ -151,16 +151,22 @@ function add_css () {
}
function create_main_fragment ( state, component ) {
var text_value;
var p = createElement( 'p' );
setAttribute( p, 'svelte-3842350206', '' );
var text = createText( text_value = state.foo );
appendNode( text, p );
var p, text_value, text;
return {
create: function () {
p = createElement( 'p' );
text = createText( text_value = state.foo );
this.hydrate();
},
hydrate: function ( nodes ) {
setAttribute( p, 'svelte-3842350206', '' );
},
mount: function ( target, anchor ) {
insertNode( p, target, anchor );
appendNode( text, p );
},
update: function ( changed, state ) {
@ -195,7 +201,11 @@ function SvelteComponent ( options ) {
if ( !document.getElementById( "svelte-3842350206-style" ) ) add_css();
this._fragment = create_main_fragment( this._state, this );
if ( options.target ) this._fragment.mount( options.target, null );
if ( options.target ) {
this._fragment.create();
this._fragment.mount( options.target, null );
}
}
assign( SvelteComponent.prototype, proto );

@ -16,16 +16,22 @@ function add_css () {
}
function create_main_fragment ( state, component ) {
var text_value;
var p = createElement( 'p' );
setAttribute( p, 'svelte-3842350206', '' );
var text = createText( text_value = state.foo );
appendNode( text, p );
var p, text_value, text;
return {
create: function () {
p = createElement( 'p' );
text = createText( text_value = state.foo );
this.hydrate();
},
hydrate: function ( nodes ) {
setAttribute( p, 'svelte-3842350206', '' );
},
mount: function ( target, anchor ) {
insertNode( p, target, anchor );
appendNode( text, p );
},
update: function ( changed, state ) {
@ -60,7 +66,11 @@ function SvelteComponent ( options ) {
if ( !document.getElementById( "svelte-3842350206-style" ) ) add_css();
this._fragment = create_main_fragment( this._state, this );
if ( options.target ) this._fragment.mount( options.target, null );
if ( options.target ) {
this._fragment.create();
this._fragment.mount( options.target, null );
}
}
assign( SvelteComponent.prototype, proto );

@ -129,8 +129,9 @@ var template = (function () {
function create_main_fragment ( state, component ) {
return {
create: noop,
mount: noop,
unmount: noop,
@ -157,7 +158,11 @@ function SvelteComponent ( options ) {
this._torndown = false;
this._fragment = create_main_fragment( this._state, this );
if ( options.target ) this._fragment.mount( options.target, null );
if ( options.target ) {
this._fragment.create();
this._fragment.mount( options.target, null );
}
}
assign( SvelteComponent.prototype, proto );

@ -18,8 +18,9 @@ var template = (function () {
function create_main_fragment ( state, component ) {
return {
create: noop,
mount: noop,
unmount: noop,
@ -46,7 +47,11 @@ function SvelteComponent ( options ) {
this._torndown = false;
this._fragment = create_main_fragment( this._state, this );
if ( options.target ) this._fragment.mount( options.target, null );
if ( options.target ) {
this._fragment.create();
this._fragment.mount( options.target, null );
}
}
assign( SvelteComponent.prototype, proto );

@ -145,7 +145,7 @@ var proto = {
};
function create_main_fragment ( state, component ) {
var text_1_value;
var text, p, text_1_value, text_1;
var each_block_value = state.comments;
@ -155,12 +155,17 @@ function create_main_fragment ( state, component ) {
each_block_iterations[i] = create_each_block( state, each_block_value, each_block_value[i], i, component );
}
var text = createText( "\n\n" );
var p = createElement( 'p' );
var text_1 = createText( text_1_value = state.foo );
appendNode( text_1, p );
return {
create: function () {
for ( var i = 0; i < each_block_iterations.length; i += 1 ) {
each_block_iterations[i].create();
}
text = createText( "\n\n" );
p = createElement( 'p' );
text_1 = createText( text_1_value = state.foo );
},
mount: function ( target, anchor ) {
for ( var i = 0; i < each_block_iterations.length; i += 1 ) {
each_block_iterations[i].mount( target, anchor );
@ -168,6 +173,7 @@ function create_main_fragment ( state, component ) {
insertNode( text, target, anchor );
insertNode( p, target, anchor );
appendNode( text_1, p );
},
update: function ( changed, state ) {
@ -179,6 +185,7 @@ function create_main_fragment ( state, component ) {
each_block_iterations[i].update( changed, state, each_block_value, each_block_value[i], i );
} else {
each_block_iterations[i] = create_each_block( state, each_block_value, each_block_value[i], i, component );
each_block_iterations[i].create();
each_block_iterations[i].mount( text.parentNode, text );
}
}
@ -211,35 +218,44 @@ function create_main_fragment ( state, component ) {
}
function create_each_block ( state, each_block_value, comment, i, component ) {
var text_value, text_2_value, text_4_value;
var div = createElement( 'div' );
div.className = "comment";
var strong = createElement( 'strong' );
appendNode( strong, div );
var text = createText( text_value = i );
appendNode( text, strong );
appendNode( createText( "\n\n\t\t" ), div );
var span = createElement( 'span' );
appendNode( span, div );
span.className = "meta";
var text_2 = createText( text_2_value = comment.author );
appendNode( text_2, span );
appendNode( createText( " wrote " ), span );
var text_4 = createText( text_4_value = state.elapsed(comment.time, state.time) );
appendNode( text_4, span );
appendNode( createText( " ago:" ), span );
appendNode( createText( "\n\n\t\t" ), div );
var raw_before = createElement( 'noscript' );
appendNode( raw_before, div );
var raw_after = createElement( 'noscript' );
appendNode( raw_after, div );
var raw_value = comment.html;
raw_before.insertAdjacentHTML( 'afterend', raw_value );
var div, strong, text_value, text, text_1, span, text_2_value, text_2, text_3, text_4_value, text_4, text_5, text_6, raw_value, raw_before, raw_after;
return {
create: function () {
div = createElement( 'div' );
strong = createElement( 'strong' );
text = createText( text_value = i );
text_1 = createText( "\n\n\t\t" );
span = createElement( 'span' );
text_2 = createText( text_2_value = comment.author );
text_3 = createText( " wrote " );
text_4 = createText( text_4_value = state.elapsed(comment.time, state.time) );
text_5 = createText( " ago:" );
text_6 = createText( "\n\n\t\t" );
raw_before = createElement( 'noscript' );
raw_after = createElement( 'noscript' );
this.hydrate();
},
hydrate: function ( nodes ) {
div.className = "comment";
span.className = "meta";
},
mount: function ( target, anchor ) {
insertNode( div, target, anchor );
appendNode( strong, div );
appendNode( text, strong );
appendNode( text_1, div );
appendNode( span, div );
appendNode( text_2, span );
appendNode( text_3, span );
appendNode( text_4, span );
appendNode( text_5, span );
appendNode( text_6, div );
appendNode( raw_before, div );
appendNode( raw_after, div );
raw_before.insertAdjacentHTML( 'afterend', raw_value = comment.html );
},
update: function ( changed, state, each_block_value, comment, i ) {
@ -257,7 +273,7 @@ function create_each_block ( state, each_block_value, comment, i, component ) {
if ( raw_value !== ( raw_value = comment.html ) ) {
detachBetween( raw_before, raw_after );
raw_before.insertAdjacentHTML( 'afterend', raw_value );
raw_before.insertAdjacentHTML( 'afterend', raw_value = comment.html );
}
},
@ -288,7 +304,11 @@ function SvelteComponent ( options ) {
this._torndown = false;
this._fragment = create_main_fragment( this._state, this );
if ( options.target ) this._fragment.mount( options.target, null );
if ( options.target ) {
this._fragment.create();
this._fragment.mount( options.target, null );
}
}
assign( SvelteComponent.prototype, proto );

@ -1,7 +1,7 @@
import { appendNode, assign, createElement, createText, destroyEach, detachBetween, detachNode, dispatchObservers, insertNode, noop, proto } from "svelte/shared.js";
function create_main_fragment ( state, component ) {
var text_1_value;
var text, p, text_1_value, text_1;
var each_block_value = state.comments;
@ -11,12 +11,17 @@ function create_main_fragment ( state, component ) {
each_block_iterations[i] = create_each_block( state, each_block_value, each_block_value[i], i, component );
}
var text = createText( "\n\n" );
var p = createElement( 'p' );
var text_1 = createText( text_1_value = state.foo );
appendNode( text_1, p );
return {
create: function () {
for ( var i = 0; i < each_block_iterations.length; i += 1 ) {
each_block_iterations[i].create();
}
text = createText( "\n\n" );
p = createElement( 'p' );
text_1 = createText( text_1_value = state.foo );
},
mount: function ( target, anchor ) {
for ( var i = 0; i < each_block_iterations.length; i += 1 ) {
each_block_iterations[i].mount( target, anchor );
@ -24,6 +29,7 @@ function create_main_fragment ( state, component ) {
insertNode( text, target, anchor );
insertNode( p, target, anchor );
appendNode( text_1, p );
},
update: function ( changed, state ) {
@ -35,6 +41,7 @@ function create_main_fragment ( state, component ) {
each_block_iterations[i].update( changed, state, each_block_value, each_block_value[i], i );
} else {
each_block_iterations[i] = create_each_block( state, each_block_value, each_block_value[i], i, component );
each_block_iterations[i].create();
each_block_iterations[i].mount( text.parentNode, text );
}
}
@ -67,35 +74,44 @@ function create_main_fragment ( state, component ) {
}
function create_each_block ( state, each_block_value, comment, i, component ) {
var text_value, text_2_value, text_4_value;
var div = createElement( 'div' );
div.className = "comment";
var strong = createElement( 'strong' );
appendNode( strong, div );
var text = createText( text_value = i );
appendNode( text, strong );
appendNode( createText( "\n\n\t\t" ), div );
var span = createElement( 'span' );
appendNode( span, div );
span.className = "meta";
var text_2 = createText( text_2_value = comment.author );
appendNode( text_2, span );
appendNode( createText( " wrote " ), span );
var text_4 = createText( text_4_value = state.elapsed(comment.time, state.time) );
appendNode( text_4, span );
appendNode( createText( " ago:" ), span );
appendNode( createText( "\n\n\t\t" ), div );
var raw_before = createElement( 'noscript' );
appendNode( raw_before, div );
var raw_after = createElement( 'noscript' );
appendNode( raw_after, div );
var raw_value = comment.html;
raw_before.insertAdjacentHTML( 'afterend', raw_value );
var div, strong, text_value, text, text_1, span, text_2_value, text_2, text_3, text_4_value, text_4, text_5, text_6, raw_value, raw_before, raw_after;
return {
create: function () {
div = createElement( 'div' );
strong = createElement( 'strong' );
text = createText( text_value = i );
text_1 = createText( "\n\n\t\t" );
span = createElement( 'span' );
text_2 = createText( text_2_value = comment.author );
text_3 = createText( " wrote " );
text_4 = createText( text_4_value = state.elapsed(comment.time, state.time) );
text_5 = createText( " ago:" );
text_6 = createText( "\n\n\t\t" );
raw_before = createElement( 'noscript' );
raw_after = createElement( 'noscript' );
this.hydrate();
},
hydrate: function ( nodes ) {
div.className = "comment";
span.className = "meta";
},
mount: function ( target, anchor ) {
insertNode( div, target, anchor );
appendNode( strong, div );
appendNode( text, strong );
appendNode( text_1, div );
appendNode( span, div );
appendNode( text_2, span );
appendNode( text_3, span );
appendNode( text_4, span );
appendNode( text_5, span );
appendNode( text_6, div );
appendNode( raw_before, div );
appendNode( raw_after, div );
raw_before.insertAdjacentHTML( 'afterend', raw_value = comment.html );
},
update: function ( changed, state, each_block_value, comment, i ) {
@ -113,7 +129,7 @@ function create_each_block ( state, each_block_value, comment, i, component ) {
if ( raw_value !== ( raw_value = comment.html ) ) {
detachBetween( raw_before, raw_after );
raw_before.insertAdjacentHTML( 'afterend', raw_value );
raw_before.insertAdjacentHTML( 'afterend', raw_value = comment.html );
}
},
@ -144,7 +160,11 @@ function SvelteComponent ( options ) {
this._torndown = false;
this._fragment = create_main_fragment( this._state, this );
if ( options.target ) this._fragment.mount( options.target, null );
if ( options.target ) {
this._fragment.create();
this._fragment.mount( options.target, null );
}
}
assign( SvelteComponent.prototype, proto );

@ -145,18 +145,25 @@ var template = (function () {
}());
function create_main_fragment ( state, component ) {
var button = createElement( 'button' );
var button, foo_handler, text;
var foo_handler = template.events.foo.call( component, button, function ( event ) {
var state = component.get();
component.foo( state.bar );
});
return {
create: function () {
button = createElement( 'button' );
text = createText( "foo" );
this.hydrate();
},
appendNode( createText( "foo" ), button );
hydrate: function ( nodes ) {
foo_handler = template.events.foo.call( component, button, function ( event ) {
var state = component.get();
component.foo( state.bar );
});
},
return {
mount: function ( target, anchor ) {
insertNode( button, target, anchor );
appendNode( text, button );
},
unmount: function () {
@ -186,7 +193,11 @@ function SvelteComponent ( options ) {
this._torndown = false;
this._fragment = create_main_fragment( this._state, this );
if ( options.target ) this._fragment.mount( options.target, null );
if ( options.target ) {
this._fragment.create();
this._fragment.mount( options.target, null );
}
}
assign( SvelteComponent.prototype, template.methods, proto );

@ -16,18 +16,25 @@ var template = (function () {
}());
function create_main_fragment ( state, component ) {
var button = createElement( 'button' );
var button, foo_handler, text;
var foo_handler = template.events.foo.call( component, button, function ( event ) {
var state = component.get();
component.foo( state.bar );
});
return {
create: function () {
button = createElement( 'button' );
text = createText( "foo" );
this.hydrate();
},
appendNode( createText( "foo" ), button );
hydrate: function ( nodes ) {
foo_handler = template.events.foo.call( component, button, function ( event ) {
var state = component.get();
component.foo( state.bar );
});
},
return {
mount: function ( target, anchor ) {
insertNode( button, target, anchor );
appendNode( text, button );
},
unmount: function () {
@ -57,7 +64,11 @@ function SvelteComponent ( options ) {
this._torndown = false;
this._fragment = create_main_fragment( this._state, this );
if ( options.target ) this._fragment.mount( options.target, null );
if ( options.target ) {
this._fragment.create();
this._fragment.mount( options.target, null );
}
}
assign( SvelteComponent.prototype, template.methods, proto );

@ -136,6 +136,8 @@ var proto = {
};
function create_main_fragment ( state, component ) {
var if_block_anchor;
function get_block ( state ) {
if ( state.foo ) return create_if_block;
return create_if_block_1;
@ -144,9 +146,12 @@ function create_main_fragment ( state, component ) {
var current_block = get_block( state );
var if_block = current_block( state, component );
var if_block_anchor = createComment();
return {
create: function () {
if_block.create();
if_block_anchor = createComment();
},
mount: function ( target, anchor ) {
if_block.mount( target, anchor );
insertNode( if_block_anchor, target, anchor );
@ -154,11 +159,10 @@ function create_main_fragment ( state, component ) {
update: function ( changed, state ) {
if ( current_block !== ( current_block = get_block( state ) ) ) {
{
if_block.unmount();
if_block.destroy();
}
if_block.unmount();
if_block.destroy();
if_block = current_block( state, component );
if_block.create();
if_block.mount( if_block_anchor.parentNode, if_block_anchor );
}
},
@ -175,12 +179,17 @@ function create_main_fragment ( state, component ) {
}
function create_if_block ( state, component ) {
var p = createElement( 'p' );
appendNode( createText( "foo!" ), p );
var p, text;
return {
create: function () {
p = createElement( 'p' );
text = createText( "foo!" );
},
mount: function ( target, anchor ) {
insertNode( p, target, anchor );
appendNode( text, p );
},
unmount: function () {
@ -192,12 +201,17 @@ function create_if_block ( state, component ) {
}
function create_if_block_1 ( state, component ) {
var p = createElement( 'p' );
appendNode( createText( "not foo!" ), p );
var p, text;
return {
create: function () {
p = createElement( 'p' );
text = createText( "not foo!" );
},
mount: function ( target, anchor ) {
insertNode( p, target, anchor );
appendNode( text, p );
},
unmount: function () {
@ -225,7 +239,11 @@ function SvelteComponent ( options ) {
this._torndown = false;
this._fragment = create_main_fragment( this._state, this );
if ( options.target ) this._fragment.mount( options.target, null );
if ( options.target ) {
this._fragment.create();
this._fragment.mount( options.target, null );
}
}
assign( SvelteComponent.prototype, proto );

@ -1,6 +1,8 @@
import { appendNode, assign, createComment, createElement, createText, detachNode, dispatchObservers, insertNode, noop, proto } from "svelte/shared.js";
function create_main_fragment ( state, component ) {
var if_block_anchor;
function get_block ( state ) {
if ( state.foo ) return create_if_block;
return create_if_block_1;
@ -9,9 +11,12 @@ function create_main_fragment ( state, component ) {
var current_block = get_block( state );
var if_block = current_block( state, component );
var if_block_anchor = createComment();
return {
create: function () {
if_block.create();
if_block_anchor = createComment();
},
mount: function ( target, anchor ) {
if_block.mount( target, anchor );
insertNode( if_block_anchor, target, anchor );
@ -19,11 +24,10 @@ function create_main_fragment ( state, component ) {
update: function ( changed, state ) {
if ( current_block !== ( current_block = get_block( state ) ) ) {
{
if_block.unmount();
if_block.destroy();
}
if_block.unmount();
if_block.destroy();
if_block = current_block( state, component );
if_block.create();
if_block.mount( if_block_anchor.parentNode, if_block_anchor );
}
},
@ -40,12 +44,17 @@ function create_main_fragment ( state, component ) {
}
function create_if_block ( state, component ) {
var p = createElement( 'p' );
appendNode( createText( "foo!" ), p );
var p, text;
return {
create: function () {
p = createElement( 'p' );
text = createText( "foo!" );
},
mount: function ( target, anchor ) {
insertNode( p, target, anchor );
appendNode( text, p );
},
unmount: function () {
@ -57,12 +66,17 @@ function create_if_block ( state, component ) {
}
function create_if_block_1 ( state, component ) {
var p = createElement( 'p' );
appendNode( createText( "not foo!" ), p );
var p, text;
return {
create: function () {
p = createElement( 'p' );
text = createText( "not foo!" );
},
mount: function ( target, anchor ) {
insertNode( p, target, anchor );
appendNode( text, p );
},
unmount: function () {
@ -90,7 +104,11 @@ function SvelteComponent ( options ) {
this._torndown = false;
this._fragment = create_main_fragment( this._state, this );
if ( options.target ) this._fragment.mount( options.target, null );
if ( options.target ) {
this._fragment.create();
this._fragment.mount( options.target, null );
}
}
assign( SvelteComponent.prototype, proto );
@ -114,4 +132,4 @@ SvelteComponent.prototype.teardown = SvelteComponent.prototype.destroy = functio
this._torndown = true;
};
export default SvelteComponent;
export default SvelteComponent;

@ -136,11 +136,16 @@ var proto = {
};
function create_main_fragment ( state, component ) {
var if_block = (state.foo) && create_if_block( state, component );
var if_block_anchor;
var if_block_anchor = createComment();
var if_block = (state.foo) && create_if_block( state, component );
return {
create: function () {
if ( if_block ) if_block.create();
if_block_anchor = createComment();
},
mount: function ( target, anchor ) {
if ( if_block ) if_block.mount( target, anchor );
insertNode( if_block_anchor, target, anchor );
@ -150,6 +155,7 @@ function create_main_fragment ( state, component ) {
if ( state.foo ) {
if ( !if_block ) {
if_block = create_if_block( state, component );
if_block.create();
if_block.mount( if_block_anchor.parentNode, if_block_anchor );
}
} else if ( if_block ) {
@ -171,12 +177,17 @@ function create_main_fragment ( state, component ) {
}
function create_if_block ( state, component ) {
var p = createElement( 'p' );
appendNode( createText( "foo!" ), p );
var p, text;
return {
create: function () {
p = createElement( 'p' );
text = createText( "foo!" );
},
mount: function ( target, anchor ) {
insertNode( p, target, anchor );
appendNode( text, p );
},
unmount: function () {
@ -204,7 +215,11 @@ function SvelteComponent ( options ) {
this._torndown = false;
this._fragment = create_main_fragment( this._state, this );
if ( options.target ) this._fragment.mount( options.target, null );
if ( options.target ) {
this._fragment.create();
this._fragment.mount( options.target, null );
}
}
assign( SvelteComponent.prototype, proto );

@ -1,11 +1,16 @@
import { appendNode, assign, createComment, createElement, createText, detachNode, dispatchObservers, insertNode, noop, proto } from "svelte/shared.js";
function create_main_fragment ( state, component ) {
var if_block = (state.foo) && create_if_block( state, component );
var if_block_anchor;
var if_block_anchor = createComment();
var if_block = (state.foo) && create_if_block( state, component );
return {
create: function () {
if ( if_block ) if_block.create();
if_block_anchor = createComment();
},
mount: function ( target, anchor ) {
if ( if_block ) if_block.mount( target, anchor );
insertNode( if_block_anchor, target, anchor );
@ -15,6 +20,7 @@ function create_main_fragment ( state, component ) {
if ( state.foo ) {
if ( !if_block ) {
if_block = create_if_block( state, component );
if_block.create();
if_block.mount( if_block_anchor.parentNode, if_block_anchor );
}
} else if ( if_block ) {
@ -36,12 +42,17 @@ function create_main_fragment ( state, component ) {
}
function create_if_block ( state, component ) {
var p = createElement( 'p' );
appendNode( createText( "foo!" ), p );
var p, text;
return {
create: function () {
p = createElement( 'p' );
text = createText( "foo!" );
},
mount: function ( target, anchor ) {
insertNode( p, target, anchor );
appendNode( text, p );
},
unmount: function () {
@ -69,7 +80,11 @@ function SvelteComponent ( options ) {
this._torndown = false;
this._fragment = create_main_fragment( this._state, this );
if ( options.target ) this._fragment.mount( options.target, null );
if ( options.target ) {
this._fragment.create();
this._fragment.mount( options.target, null );
}
}
assign( SvelteComponent.prototype, proto );

@ -132,19 +132,23 @@ var template = (function () {
}());
function create_main_fragment ( state, component ) {
var text;
var imported = new Imported({
target: null,
_root: component._root
});
var text = createText( "\n" );
var nonimported = new template.components.NonImported({
target: null,
_root: component._root
});
return {
create: function () {
imported._fragment.create();
text = createText( "\n" );
nonimported._fragment.create();
},
mount: function ( target, anchor ) {
imported._fragment.mount( target, anchor );
insertNode( text, target, anchor );
@ -182,7 +186,11 @@ function SvelteComponent ( options ) {
this._renderHooks = [];
this._fragment = create_main_fragment( this._state, this );
if ( options.target ) this._fragment.mount( options.target, null );
if ( options.target ) {
this._fragment.create();
this._fragment.mount( options.target, null );
}
this._flush();
}

@ -11,19 +11,23 @@ var template = (function () {
}());
function create_main_fragment ( state, component ) {
var text;
var imported = new Imported({
target: null,
_root: component._root
});
var text = createText( "\n" );
var nonimported = new template.components.NonImported({
target: null,
_root: component._root
});
return {
create: function () {
imported._fragment.create();
text = createText( "\n" );
nonimported._fragment.create();
},
mount: function ( target, anchor ) {
imported._fragment.mount( target, anchor );
insertNode( text, target, anchor );
@ -61,7 +65,11 @@ function SvelteComponent ( options ) {
this._renderHooks = [];
this._fragment = create_main_fragment( this._state, this );
if ( options.target ) this._fragment.mount( options.target, null );
if ( options.target ) {
this._fragment.create();
this._fragment.mount( options.target, null );
}
this._flush();
}

@ -121,8 +121,9 @@ var template = (function () {
function create_main_fragment ( state, component ) {
return {
create: noop,
mount: noop,
unmount: noop,
@ -148,7 +149,11 @@ function SvelteComponent ( options ) {
this._torndown = false;
this._fragment = create_main_fragment( this._state, this );
if ( options.target ) this._fragment.mount( options.target, null );
if ( options.target ) {
this._fragment.create();
this._fragment.mount( options.target, null );
}
if ( options._root ) {
options._root._renderHooks.push( template.oncreate.bind( this ) );

@ -10,8 +10,9 @@ var template = (function () {
function create_main_fragment ( state, component ) {
return {
create: noop,
mount: noop,
unmount: noop,
@ -37,7 +38,11 @@ function SvelteComponent ( options ) {
this._torndown = false;
this._fragment = create_main_fragment( this._state, this );
if ( options.target ) this._fragment.mount( options.target, null );
if ( options.target ) {
this._fragment.create();
this._fragment.mount( options.target, null );
}
if ( options._root ) {
options._root._renderHooks.push( template.oncreate.bind( this ) );

@ -136,48 +136,56 @@ var proto = {
};
function create_main_fragment ( state, component ) {
var div = createElement( 'div' );
var div, text, p, text_1, text_2, text_3, text_4, p_1, text_5, text_6, text_7, text_8, if_block_4_anchor;
var if_block = (state.a) && create_if_block( state, component );
if ( if_block ) if_block.mount( div, null );
var text = createText( "\n\n\t" );
appendNode( text, div );
var p = createElement( 'p' );
appendNode( p, div );
appendNode( createText( "this can be used as an anchor" ), p );
appendNode( createText( "\n\n\t" ), div );
var if_block_1 = (state.b) && create_if_block_1( state, component );
if ( if_block_1 ) if_block_1.mount( div, null );
var text_3 = createText( "\n\n\t" );
appendNode( text_3, div );
var if_block_2 = (state.c) && create_if_block_2( state, component );
if ( if_block_2 ) if_block_2.mount( div, null );
var text_4 = createText( "\n\n\t" );
appendNode( text_4, div );
var p_1 = createElement( 'p' );
appendNode( p_1, div );
appendNode( createText( "so can this" ), p_1 );
appendNode( createText( "\n\n\t" ), div );
var if_block_3 = (state.d) && create_if_block_3( state, component );
if ( if_block_3 ) if_block_3.mount( div, null );
var text_7 = createText( "\n\n\t" );
appendNode( text_7, div );
var text_8 = createText( "\n\n" );
var if_block_4 = (state.e) && create_if_block_4( state, component );
var if_block_4_anchor = createComment();
return {
create: function () {
div = createElement( 'div' );
if ( if_block ) if_block.create();
text = createText( "\n\n\t" );
p = createElement( 'p' );
text_1 = createText( "this can be used as an anchor" );
text_2 = createText( "\n\n\t" );
if ( if_block_1 ) if_block_1.create();
text_3 = createText( "\n\n\t" );
if ( if_block_2 ) if_block_2.create();
text_4 = createText( "\n\n\t" );
p_1 = createElement( 'p' );
text_5 = createText( "so can this" );
text_6 = createText( "\n\n\t" );
if ( if_block_3 ) if_block_3.create();
text_7 = createText( "\n\n\t" );
text_8 = createText( "\n\n" );
if ( if_block_4 ) if_block_4.create();
if_block_4_anchor = createComment();
},
mount: function ( target, anchor ) {
insertNode( div, target, anchor );
if ( if_block ) if_block.mount( div, null );
appendNode( text, div );
appendNode( p, div );
appendNode( text_1, p );
appendNode( text_2, div );
if ( if_block_1 ) if_block_1.mount( div, null );
appendNode( text_3, div );
if ( if_block_2 ) if_block_2.mount( div, null );
appendNode( text_4, div );
appendNode( p_1, div );
appendNode( text_5, p_1 );
appendNode( text_6, div );
if ( if_block_3 ) if_block_3.mount( div, null );
appendNode( text_7, div );
insertNode( text_8, target, anchor );
if ( if_block_4 ) if_block_4.mount( target, anchor );
insertNode( if_block_4_anchor, target, anchor );
@ -187,6 +195,7 @@ function create_main_fragment ( state, component ) {
if ( state.a ) {
if ( !if_block ) {
if_block = create_if_block( state, component );
if_block.create();
if_block.mount( div, text );
}
} else if ( if_block ) {
@ -198,6 +207,7 @@ function create_main_fragment ( state, component ) {
if ( state.b ) {
if ( !if_block_1 ) {
if_block_1 = create_if_block_1( state, component );
if_block_1.create();
if_block_1.mount( div, text_3 );
}
} else if ( if_block_1 ) {
@ -209,6 +219,7 @@ function create_main_fragment ( state, component ) {
if ( state.c ) {
if ( !if_block_2 ) {
if_block_2 = create_if_block_2( state, component );
if_block_2.create();
if_block_2.mount( div, text_4 );
}
} else if ( if_block_2 ) {
@ -220,6 +231,7 @@ function create_main_fragment ( state, component ) {
if ( state.d ) {
if ( !if_block_3 ) {
if_block_3 = create_if_block_3( state, component );
if_block_3.create();
if_block_3.mount( div, text_7 );
}
} else if ( if_block_3 ) {
@ -231,6 +243,7 @@ function create_main_fragment ( state, component ) {
if ( state.e ) {
if ( !if_block_4 ) {
if_block_4 = create_if_block_4( state, component );
if_block_4.create();
if_block_4.mount( if_block_4_anchor.parentNode, if_block_4_anchor );
}
} else if ( if_block_4 ) {
@ -262,12 +275,17 @@ function create_main_fragment ( state, component ) {
}
function create_if_block ( state, component ) {
var p = createElement( 'p' );
appendNode( createText( "a" ), p );
var p, text;
return {
create: function () {
p = createElement( 'p' );
text = createText( "a" );
},
mount: function ( target, anchor ) {
insertNode( p, target, anchor );
appendNode( text, p );
},
unmount: function () {
@ -279,12 +297,17 @@ function create_if_block ( state, component ) {
}
function create_if_block_1 ( state, component ) {
var p = createElement( 'p' );
appendNode( createText( "b" ), p );
var p, text;
return {
create: function () {
p = createElement( 'p' );
text = createText( "b" );
},
mount: function ( target, anchor ) {
insertNode( p, target, anchor );
appendNode( text, p );
},
unmount: function () {
@ -296,12 +319,17 @@ function create_if_block_1 ( state, component ) {
}
function create_if_block_2 ( state, component ) {
var p = createElement( 'p' );
appendNode( createText( "c" ), p );
var p, text;
return {
create: function () {
p = createElement( 'p' );
text = createText( "c" );
},
mount: function ( target, anchor ) {
insertNode( p, target, anchor );
appendNode( text, p );
},
unmount: function () {
@ -313,12 +341,17 @@ function create_if_block_2 ( state, component ) {
}
function create_if_block_3 ( state, component ) {
var p = createElement( 'p' );
appendNode( createText( "d" ), p );
var p, text;
return {
create: function () {
p = createElement( 'p' );
text = createText( "d" );
},
mount: function ( target, anchor ) {
insertNode( p, target, anchor );
appendNode( text, p );
},
unmount: function () {
@ -330,12 +363,17 @@ function create_if_block_3 ( state, component ) {
}
function create_if_block_4 ( state, component ) {
var p = createElement( 'p' );
appendNode( createText( "e" ), p );
var p, text;
return {
create: function () {
p = createElement( 'p' );
text = createText( "e" );
},
mount: function ( target, anchor ) {
insertNode( p, target, anchor );
appendNode( text, p );
},
unmount: function () {
@ -363,7 +401,11 @@ function SvelteComponent ( options ) {
this._torndown = false;
this._fragment = create_main_fragment( this._state, this );
if ( options.target ) this._fragment.mount( options.target, null );
if ( options.target ) {
this._fragment.create();
this._fragment.mount( options.target, null );
}
}
assign( SvelteComponent.prototype, proto );

@ -1,48 +1,56 @@
import { appendNode, assign, createComment, createElement, createText, detachNode, dispatchObservers, insertNode, noop, proto } from "svelte/shared.js";
function create_main_fragment ( state, component ) {
var div = createElement( 'div' );
var div, text, p, text_1, text_2, text_3, text_4, p_1, text_5, text_6, text_7, text_8, if_block_4_anchor;
var if_block = (state.a) && create_if_block( state, component );
if ( if_block ) if_block.mount( div, null );
var text = createText( "\n\n\t" );
appendNode( text, div );
var p = createElement( 'p' );
appendNode( p, div );
appendNode( createText( "this can be used as an anchor" ), p );
appendNode( createText( "\n\n\t" ), div );
var if_block_1 = (state.b) && create_if_block_1( state, component );
if ( if_block_1 ) if_block_1.mount( div, null );
var text_3 = createText( "\n\n\t" );
appendNode( text_3, div );
var if_block_2 = (state.c) && create_if_block_2( state, component );
if ( if_block_2 ) if_block_2.mount( div, null );
var text_4 = createText( "\n\n\t" );
appendNode( text_4, div );
var p_1 = createElement( 'p' );
appendNode( p_1, div );
appendNode( createText( "so can this" ), p_1 );
appendNode( createText( "\n\n\t" ), div );
var if_block_3 = (state.d) && create_if_block_3( state, component );
if ( if_block_3 ) if_block_3.mount( div, null );
var text_7 = createText( "\n\n\t" );
appendNode( text_7, div );
var text_8 = createText( "\n\n" );
var if_block_4 = (state.e) && create_if_block_4( state, component );
var if_block_4_anchor = createComment();
return {
create: function () {
div = createElement( 'div' );
if ( if_block ) if_block.create();
text = createText( "\n\n\t" );
p = createElement( 'p' );
text_1 = createText( "this can be used as an anchor" );
text_2 = createText( "\n\n\t" );
if ( if_block_1 ) if_block_1.create();
text_3 = createText( "\n\n\t" );
if ( if_block_2 ) if_block_2.create();
text_4 = createText( "\n\n\t" );
p_1 = createElement( 'p' );
text_5 = createText( "so can this" );
text_6 = createText( "\n\n\t" );
if ( if_block_3 ) if_block_3.create();
text_7 = createText( "\n\n\t" );
text_8 = createText( "\n\n" );
if ( if_block_4 ) if_block_4.create();
if_block_4_anchor = createComment();
},
mount: function ( target, anchor ) {
insertNode( div, target, anchor );
if ( if_block ) if_block.mount( div, null );
appendNode( text, div );
appendNode( p, div );
appendNode( text_1, p );
appendNode( text_2, div );
if ( if_block_1 ) if_block_1.mount( div, null );
appendNode( text_3, div );
if ( if_block_2 ) if_block_2.mount( div, null );
appendNode( text_4, div );
appendNode( p_1, div );
appendNode( text_5, p_1 );
appendNode( text_6, div );
if ( if_block_3 ) if_block_3.mount( div, null );
appendNode( text_7, div );
insertNode( text_8, target, anchor );
if ( if_block_4 ) if_block_4.mount( target, anchor );
insertNode( if_block_4_anchor, target, anchor );
@ -52,6 +60,7 @@ function create_main_fragment ( state, component ) {
if ( state.a ) {
if ( !if_block ) {
if_block = create_if_block( state, component );
if_block.create();
if_block.mount( div, text );
}
} else if ( if_block ) {
@ -63,6 +72,7 @@ function create_main_fragment ( state, component ) {
if ( state.b ) {
if ( !if_block_1 ) {
if_block_1 = create_if_block_1( state, component );
if_block_1.create();
if_block_1.mount( div, text_3 );
}
} else if ( if_block_1 ) {
@ -74,6 +84,7 @@ function create_main_fragment ( state, component ) {
if ( state.c ) {
if ( !if_block_2 ) {
if_block_2 = create_if_block_2( state, component );
if_block_2.create();
if_block_2.mount( div, text_4 );
}
} else if ( if_block_2 ) {
@ -85,6 +96,7 @@ function create_main_fragment ( state, component ) {
if ( state.d ) {
if ( !if_block_3 ) {
if_block_3 = create_if_block_3( state, component );
if_block_3.create();
if_block_3.mount( div, text_7 );
}
} else if ( if_block_3 ) {
@ -96,6 +108,7 @@ function create_main_fragment ( state, component ) {
if ( state.e ) {
if ( !if_block_4 ) {
if_block_4 = create_if_block_4( state, component );
if_block_4.create();
if_block_4.mount( if_block_4_anchor.parentNode, if_block_4_anchor );
}
} else if ( if_block_4 ) {
@ -127,12 +140,17 @@ function create_main_fragment ( state, component ) {
}
function create_if_block ( state, component ) {
var p = createElement( 'p' );
appendNode( createText( "a" ), p );
var p, text;
return {
create: function () {
p = createElement( 'p' );
text = createText( "a" );
},
mount: function ( target, anchor ) {
insertNode( p, target, anchor );
appendNode( text, p );
},
unmount: function () {
@ -144,12 +162,17 @@ function create_if_block ( state, component ) {
}
function create_if_block_1 ( state, component ) {
var p = createElement( 'p' );
appendNode( createText( "b" ), p );
var p, text;
return {
create: function () {
p = createElement( 'p' );
text = createText( "b" );
},
mount: function ( target, anchor ) {
insertNode( p, target, anchor );
appendNode( text, p );
},
unmount: function () {
@ -161,12 +184,17 @@ function create_if_block_1 ( state, component ) {
}
function create_if_block_2 ( state, component ) {
var p = createElement( 'p' );
appendNode( createText( "c" ), p );
var p, text;
return {
create: function () {
p = createElement( 'p' );
text = createText( "c" );
},
mount: function ( target, anchor ) {
insertNode( p, target, anchor );
appendNode( text, p );
},
unmount: function () {
@ -178,12 +206,17 @@ function create_if_block_2 ( state, component ) {
}
function create_if_block_3 ( state, component ) {
var p = createElement( 'p' );
appendNode( createText( "d" ), p );
var p, text;
return {
create: function () {
p = createElement( 'p' );
text = createText( "d" );
},
mount: function ( target, anchor ) {
insertNode( p, target, anchor );
appendNode( text, p );
},
unmount: function () {
@ -195,12 +228,17 @@ function create_if_block_3 ( state, component ) {
}
function create_if_block_4 ( state, component ) {
var p = createElement( 'p' );
appendNode( createText( "e" ), p );
var p, text;
return {
create: function () {
p = createElement( 'p' );
text = createText( "e" );
},
mount: function ( target, anchor ) {
insertNode( p, target, anchor );
appendNode( text, p );
},
unmount: function () {
@ -228,7 +266,11 @@ function SvelteComponent ( options ) {
this._torndown = false;
this._fragment = create_main_fragment( this._state, this );
if ( options.target ) this._fragment.mount( options.target, null );
if ( options.target ) {
this._fragment.create();
this._fragment.mount( options.target, null );
}
}
assign( SvelteComponent.prototype, proto );

Loading…
Cancel
Save