Merge pull request #1210 from ekhaled/some_fixes

fixes #1188, fixes #1201
pull/1216/head
Rich Harris 7 years ago committed by GitHub
commit 6ea1612db8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -267,7 +267,7 @@ export default function dom(
this._fragment.c();
this._fragment.${block.hasIntroMethod ? 'i' : 'm'}(this.shadowRoot, null);
if (options.target) this._mount(options.target, options.anchor || null);
if (options.target) this._mount(options.target, options.anchor);
` : deindent`
if (options.target) {
${generator.hydratable
@ -280,7 +280,7 @@ export default function dom(
${options.dev && `if (options.hydrate) throw new Error("options.hydrate only works if the component was compiled with the \`hydratable: true\` option");`}
this._fragment.c();
`}
this._fragment.${block.hasIntroMethod ? 'i' : 'm'}(options.target, options.anchor || null);
this._mount(options.target, options.anchor);
${(generator.hasComponents || generator.hasComplexBindings || templateProperties.oncreate || generator.hasIntroTransitions) && deindent`
${generator.hasComponents && `this._lock = true;`}

@ -185,7 +185,7 @@ export function callAll(fns) {
}
export function _mount(target, anchor) {
this._fragment.m(target, anchor);
this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor || null);
}
export function _unmount() {

@ -171,7 +171,7 @@ function callAll(fns) {
}
function _mount(target, anchor) {
this._fragment.m(target, anchor);
this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor || null);
}
function _unmount() {
@ -252,7 +252,7 @@ function SvelteComponent(options) {
if (options.target) {
this._fragment.c();
this._fragment.m(options.target, options.anchor || null);
this._mount(options.target, options.anchor);
}
}

@ -59,7 +59,7 @@ function SvelteComponent(options) {
if (options.target) {
this._fragment.c();
this._fragment.m(options.target, options.anchor || null);
this._mount(options.target, options.anchor);
}
}

@ -151,7 +151,7 @@ function callAll(fns) {
}
function _mount(target, anchor) {
this._fragment.m(target, anchor);
this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor || null);
}
function _unmount() {
@ -219,7 +219,7 @@ function SvelteComponent(options) {
if (options.target) {
this._fragment.c();
this._fragment.m(options.target, options.anchor || null);
this._mount(options.target, options.anchor);
this._lock = true;
callAll(this._beforecreate);

@ -45,7 +45,7 @@ function SvelteComponent(options) {
if (options.target) {
this._fragment.c();
this._fragment.m(options.target, options.anchor || null);
this._mount(options.target, options.anchor);
this._lock = true;
callAll(this._beforecreate);

@ -151,7 +151,7 @@ function callAll(fns) {
}
function _mount(target, anchor) {
this._fragment.m(target, anchor);
this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor || null);
}
function _unmount() {
@ -219,7 +219,7 @@ function SvelteComponent(options) {
if (options.target) {
this._fragment.c();
this._fragment.m(options.target, options.anchor || null);
this._mount(options.target, options.anchor);
this._lock = true;
callAll(this._beforecreate);

@ -45,7 +45,7 @@ function SvelteComponent(options) {
if (options.target) {
this._fragment.c();
this._fragment.m(options.target, options.anchor || null);
this._mount(options.target, options.anchor);
this._lock = true;
callAll(this._beforecreate);

@ -147,7 +147,7 @@ function callAll(fns) {
}
function _mount(target, anchor) {
this._fragment.m(target, anchor);
this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor || null);
}
function _unmount() {
@ -215,7 +215,7 @@ function SvelteComponent(options) {
if (options.target) {
this._fragment.c();
this._fragment.m(options.target, options.anchor || null);
this._mount(options.target, options.anchor);
this._lock = true;
callAll(this._beforecreate);

@ -45,7 +45,7 @@ function SvelteComponent(options) {
if (options.target) {
this._fragment.c();
this._fragment.m(options.target, options.anchor || null);
this._mount(options.target, options.anchor);
this._lock = true;
callAll(this._beforecreate);

@ -147,7 +147,7 @@ function callAll(fns) {
}
function _mount(target, anchor) {
this._fragment.m(target, anchor);
this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor || null);
}
function _unmount() {
@ -203,7 +203,7 @@ function SvelteComponent(options) {
if (options.target) {
this._fragment.c();
this._fragment.m(options.target, options.anchor || null);
this._mount(options.target, options.anchor);
}
}

@ -33,7 +33,7 @@ function SvelteComponent(options) {
if (options.target) {
this._fragment.c();
this._fragment.m(options.target, options.anchor || null);
this._mount(options.target, options.anchor);
}
}

@ -167,7 +167,7 @@ function callAll(fns) {
}
function _mount(target, anchor) {
this._fragment.m(target, anchor);
this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor || null);
}
function _unmount() {
@ -239,7 +239,7 @@ function SvelteComponent(options) {
if (options.target) {
this._fragment.c();
this._fragment.m(options.target, options.anchor || null);
this._mount(options.target, options.anchor);
}
}

@ -49,7 +49,7 @@ function SvelteComponent(options) {
if (options.target) {
this._fragment.c();
this._fragment.m(options.target, options.anchor || null);
this._mount(options.target, options.anchor);
}
}

@ -159,7 +159,7 @@ function callAll(fns) {
}
function _mount(target, anchor) {
this._fragment.m(target, anchor);
this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor || null);
}
function _unmount() {
@ -221,7 +221,7 @@ class SvelteComponent extends HTMLElement {
this._fragment.c();
this._fragment.m(this.shadowRoot, null);
if (options.target) this._mount(options.target, options.anchor || null);
if (options.target) this._mount(options.target, options.anchor);
}
static get observedAttributes() {

@ -39,7 +39,7 @@ class SvelteComponent extends HTMLElement {
this._fragment.c();
this._fragment.m(this.shadowRoot, null);
if (options.target) this._mount(options.target, options.anchor || null);
if (options.target) this._mount(options.target, options.anchor);
}
static get observedAttributes() {

@ -147,7 +147,7 @@ function callAll(fns) {
}
function _mount(target, anchor) {
this._fragment.m(target, anchor);
this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor || null);
}
function _unmount() {
@ -211,7 +211,7 @@ function SvelteComponent(options) {
if (options.target) {
this._fragment.c();
this._fragment.m(options.target, options.anchor || null);
this._mount(options.target, options.anchor);
callAll(this._oncreate);
}

@ -42,7 +42,7 @@ function SvelteComponent(options) {
if (options.target) {
this._fragment.c();
this._fragment.m(options.target, options.anchor || null);
this._mount(options.target, options.anchor);
callAll(this._oncreate);
}

@ -163,7 +163,7 @@ function callAll(fns) {
}
function _mount(target, anchor) {
this._fragment.m(target, anchor);
this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor || null);
}
function _unmount() {
@ -233,7 +233,7 @@ function SvelteComponent(options) {
if (options.target) {
this._fragment.c();
this._fragment.m(options.target, options.anchor || null);
this._mount(options.target, options.anchor);
}
}

@ -47,7 +47,7 @@ function SvelteComponent(options) {
if (options.target) {
this._fragment.c();
this._fragment.m(options.target, options.anchor || null);
this._mount(options.target, options.anchor);
}
}

@ -167,7 +167,7 @@ function callAll(fns) {
}
function _mount(target, anchor) {
this._fragment.m(target, anchor);
this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor || null);
}
function _unmount() {
@ -237,7 +237,7 @@ function SvelteComponent(options) {
if (options.target) {
this._fragment.c();
this._fragment.m(options.target, options.anchor || null);
this._mount(options.target, options.anchor);
}
}

@ -47,7 +47,7 @@ function SvelteComponent(options) {
if (options.target) {
this._fragment.c();
this._fragment.m(options.target, options.anchor || null);
this._mount(options.target, options.anchor);
}
}

@ -167,7 +167,7 @@ function callAll(fns) {
}
function _mount(target, anchor) {
this._fragment.m(target, anchor);
this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor || null);
}
function _unmount() {
@ -235,7 +235,7 @@ function SvelteComponent(options) {
if (options.target) {
this._fragment.c();
this._fragment.m(options.target, options.anchor || null);
this._mount(options.target, options.anchor);
}
}

@ -45,7 +45,7 @@ function SvelteComponent(options) {
if (options.target) {
this._fragment.c();
this._fragment.m(options.target, options.anchor || null);
this._mount(options.target, options.anchor);
}
}

@ -179,7 +179,7 @@ function callAll(fns) {
}
function _mount(target, anchor) {
this._fragment.m(target, anchor);
this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor || null);
}
function _unmount() {
@ -360,7 +360,7 @@ function SvelteComponent(options) {
if (options.target) {
this._fragment.c();
this._fragment.m(options.target, options.anchor || null);
this._mount(options.target, options.anchor);
}
}

@ -158,7 +158,7 @@ function SvelteComponent(options) {
if (options.target) {
this._fragment.c();
this._fragment.m(options.target, options.anchor || null);
this._mount(options.target, options.anchor);
}
}

@ -159,7 +159,7 @@ function callAll(fns) {
}
function _mount(target, anchor) {
this._fragment.m(target, anchor);
this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor || null);
}
function _unmount() {
@ -233,7 +233,7 @@ function SvelteComponent(options) {
if (options.target) {
this._fragment.c();
this._fragment.m(options.target, options.anchor || null);
this._mount(options.target, options.anchor);
}
}

@ -52,7 +52,7 @@ function SvelteComponent(options) {
if (options.target) {
this._fragment.c();
this._fragment.m(options.target, options.anchor || null);
this._mount(options.target, options.anchor);
}
}

@ -159,7 +159,7 @@ function callAll(fns) {
}
function _mount(target, anchor) {
this._fragment.m(target, anchor);
this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor || null);
}
function _unmount() {
@ -224,7 +224,7 @@ function SvelteComponent(options) {
if (options.target) {
this._fragment.c();
this._fragment.m(options.target, options.anchor || null);
this._mount(options.target, options.anchor);
}
}

@ -42,7 +42,7 @@ function SvelteComponent(options) {
if (options.target) {
this._fragment.c();
this._fragment.m(options.target, options.anchor || null);
this._mount(options.target, options.anchor);
}
}

@ -163,7 +163,7 @@ function callAll(fns) {
}
function _mount(target, anchor) {
this._fragment.m(target, anchor);
this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor || null);
}
function _unmount() {
@ -281,7 +281,7 @@ function SvelteComponent(options) {
if (options.target) {
this._fragment.c();
this._fragment.m(options.target, options.anchor || null);
this._mount(options.target, options.anchor);
}
}

@ -95,7 +95,7 @@ function SvelteComponent(options) {
if (options.target) {
this._fragment.c();
this._fragment.m(options.target, options.anchor || null);
this._mount(options.target, options.anchor);
}
}

@ -163,7 +163,7 @@ function callAll(fns) {
}
function _mount(target, anchor) {
this._fragment.m(target, anchor);
this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor || null);
}
function _unmount() {
@ -258,7 +258,7 @@ function SvelteComponent(options) {
if (options.target) {
this._fragment.c();
this._fragment.m(options.target, options.anchor || null);
this._mount(options.target, options.anchor);
}
}

@ -72,7 +72,7 @@ function SvelteComponent(options) {
if (options.target) {
this._fragment.c();
this._fragment.m(options.target, options.anchor || null);
this._mount(options.target, options.anchor);
}
}

@ -163,7 +163,7 @@ function callAll(fns) {
}
function _mount(target, anchor) {
this._fragment.m(target, anchor);
this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor || null);
}
function _unmount() {
@ -231,7 +231,7 @@ function SvelteComponent(options) {
if (options.target) {
this._fragment.c();
this._fragment.m(options.target, options.anchor || null);
this._mount(options.target, options.anchor);
}
}

@ -45,7 +45,7 @@ function SvelteComponent(options) {
if (options.target) {
this._fragment.c();
this._fragment.m(options.target, options.anchor || null);
this._mount(options.target, options.anchor);
}
}

@ -163,7 +163,7 @@ function callAll(fns) {
}
function _mount(target, anchor) {
this._fragment.m(target, anchor);
this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor || null);
}
function _unmount() {
@ -226,7 +226,7 @@ function SvelteComponent(options) {
if (options.target) {
this._fragment.c();
this._fragment.m(options.target, options.anchor || null);
this._mount(options.target, options.anchor);
}
}

@ -40,7 +40,7 @@ function SvelteComponent(options) {
if (options.target) {
this._fragment.c();
this._fragment.m(options.target, options.anchor || null);
this._mount(options.target, options.anchor);
}
}

@ -163,7 +163,7 @@ function callAll(fns) {
}
function _mount(target, anchor) {
this._fragment.m(target, anchor);
this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor || null);
}
function _unmount() {
@ -226,7 +226,7 @@ function SvelteComponent(options) {
if (options.target) {
this._fragment.c();
this._fragment.m(options.target, options.anchor || null);
this._mount(options.target, options.anchor);
}
}

@ -40,7 +40,7 @@ function SvelteComponent(options) {
if (options.target) {
this._fragment.c();
this._fragment.m(options.target, options.anchor || null);
this._mount(options.target, options.anchor);
}
}

@ -163,7 +163,7 @@ function callAll(fns) {
}
function _mount(target, anchor) {
this._fragment.m(target, anchor);
this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor || null);
}
function _unmount() {
@ -237,7 +237,7 @@ function SvelteComponent(options) {
if (options.target) {
this._fragment.c();
this._fragment.m(options.target, options.anchor || null);
this._mount(options.target, options.anchor);
}
}

@ -51,7 +51,7 @@ function SvelteComponent(options) {
if (options.target) {
this._fragment.c();
this._fragment.m(options.target, options.anchor || null);
this._mount(options.target, options.anchor);
}
}

@ -167,7 +167,7 @@ function callAll(fns) {
}
function _mount(target, anchor) {
this._fragment.m(target, anchor);
this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor || null);
}
function _unmount() {
@ -237,7 +237,7 @@ function SvelteComponent(options) {
if (options.target) {
this._fragment.c();
this._fragment.m(options.target, options.anchor || null);
this._mount(options.target, options.anchor);
}
}

@ -47,7 +47,7 @@ function SvelteComponent(options) {
if (options.target) {
this._fragment.c();
this._fragment.m(options.target, options.anchor || null);
this._mount(options.target, options.anchor);
}
}

@ -181,7 +181,7 @@ function callAll(fns) {
}
function _mount(target, anchor) {
this._fragment.m(target, anchor);
this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor || null);
}
function _unmount() {
@ -275,7 +275,7 @@ function SvelteComponent(options) {
if (options.target) {
this._fragment.c();
this._fragment.m(options.target, options.anchor || null);
this._mount(options.target, options.anchor);
this._lock = true;
callAll(this._beforecreate);

@ -71,7 +71,7 @@ function SvelteComponent(options) {
if (options.target) {
this._fragment.c();
this._fragment.m(options.target, options.anchor || null);
this._mount(options.target, options.anchor);
this._lock = true;
callAll(this._beforecreate);

@ -165,7 +165,7 @@ function callAll(fns) {
}
function _mount(target, anchor) {
this._fragment.m(target, anchor);
this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor || null);
}
function _unmount() {
@ -224,7 +224,7 @@ function SvelteComponent(options) {
if (options.target) {
this._fragment.c();
this._fragment.m(options.target, options.anchor || null);
this._mount(options.target, options.anchor);
}
}

@ -36,7 +36,7 @@ function SvelteComponent(options) {
if (options.target) {
this._fragment.c();
this._fragment.m(options.target, options.anchor || null);
this._mount(options.target, options.anchor);
}
}

@ -182,7 +182,7 @@ function callAll(fns) {
}
function _mount(target, anchor) {
this._fragment.m(target, anchor);
this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor || null);
}
function _unmount() {
@ -251,7 +251,7 @@ function SvelteComponent(options) {
var nodes = children(options.target);
options.hydrate ? this._fragment.l(nodes) : this._fragment.c();
nodes.forEach(detachNode);
this._fragment.m(options.target, options.anchor || null);
this._mount(options.target, options.anchor);
}
}

@ -46,7 +46,7 @@ function SvelteComponent(options) {
var nodes = children(options.target);
options.hydrate ? this._fragment.l(nodes) : this._fragment.c();
nodes.forEach(detachNode);
this._fragment.m(options.target, options.anchor || null);
this._mount(options.target, options.anchor);
}
}

@ -175,7 +175,7 @@ function callAll(fns) {
}
function _mount(target, anchor) {
this._fragment.m(target, anchor);
this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor || null);
}
function _unmount() {
@ -295,7 +295,7 @@ function SvelteComponent(options) {
if (options.target) {
this._fragment.c();
this._fragment.m(options.target, options.anchor || null);
this._mount(options.target, options.anchor);
callAll(this._beforecreate);
}

@ -97,7 +97,7 @@ function SvelteComponent(options) {
if (options.target) {
this._fragment.c();
this._fragment.m(options.target, options.anchor || null);
this._mount(options.target, options.anchor);
callAll(this._beforecreate);
}

@ -161,7 +161,7 @@ function callAll(fns) {
}
function _mount(target, anchor) {
this._fragment.m(target, anchor);
this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor || null);
}
function _unmount() {
@ -240,7 +240,7 @@ function SvelteComponent(options) {
if (options.target) {
this._fragment.c();
this._fragment.m(options.target, options.anchor || null);
this._mount(options.target, options.anchor);
this._lock = true;
callAll(this._beforecreate);

@ -57,7 +57,7 @@ function SvelteComponent(options) {
if (options.target) {
this._fragment.c();
this._fragment.m(options.target, options.anchor || null);
this._mount(options.target, options.anchor);
this._lock = true;
callAll(this._beforecreate);

@ -147,7 +147,7 @@ function callAll(fns) {
}
function _mount(target, anchor) {
this._fragment.m(target, anchor);
this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor || null);
}
function _unmount() {
@ -206,7 +206,7 @@ function SvelteComponent(options) {
if (options.target) {
this._fragment.c();
this._fragment.m(options.target, options.anchor || null);
this._mount(options.target, options.anchor);
callAll(this._oncreate);
}

@ -38,7 +38,7 @@ function SvelteComponent(options) {
if (options.target) {
this._fragment.c();
this._fragment.m(options.target, options.anchor || null);
this._mount(options.target, options.anchor);
callAll(this._oncreate);
}

@ -147,7 +147,7 @@ function callAll(fns) {
}
function _mount(target, anchor) {
this._fragment.m(target, anchor);
this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor || null);
}
function _unmount() {
@ -210,7 +210,7 @@ function SvelteComponent(options) {
if (options.target) {
this._fragment.c();
this._fragment.m(options.target, options.anchor || null);
this._mount(options.target, options.anchor);
}
}

@ -40,7 +40,7 @@ function SvelteComponent(options) {
if (options.target) {
this._fragment.c();
this._fragment.m(options.target, options.anchor || null);
this._mount(options.target, options.anchor);
}
}

@ -167,7 +167,7 @@ function callAll(fns) {
}
function _mount(target, anchor) {
this._fragment.m(target, anchor);
this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor || null);
}
function _unmount() {
@ -225,7 +225,7 @@ function SvelteComponent(options) {
if (options.target) {
this._fragment.c();
this._fragment.m(options.target, options.anchor || null);
this._mount(options.target, options.anchor);
}
}

@ -35,7 +35,7 @@ function SvelteComponent(options) {
if (options.target) {
this._fragment.c();
this._fragment.m(options.target, options.anchor || null);
this._mount(options.target, options.anchor);
}
}

@ -147,7 +147,7 @@ function callAll(fns) {
}
function _mount(target, anchor) {
this._fragment.m(target, anchor);
this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor || null);
}
function _unmount() {
@ -201,7 +201,7 @@ function SvelteComponent(options) {
if (options.target) {
this._fragment.c();
this._fragment.m(options.target, options.anchor || null);
this._mount(options.target, options.anchor);
}
}

@ -31,7 +31,7 @@ function SvelteComponent(options) {
if (options.target) {
this._fragment.c();
this._fragment.m(options.target, options.anchor || null);
this._mount(options.target, options.anchor);
}
}

@ -171,7 +171,7 @@ function callAll(fns) {
}
function _mount(target, anchor) {
this._fragment.m(target, anchor);
this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor || null);
}
function _unmount() {
@ -448,7 +448,7 @@ function SvelteComponent(options) {
if (options.target) {
this._fragment.c();
this._fragment.m(options.target, options.anchor || null);
this._mount(options.target, options.anchor);
}
}

@ -254,7 +254,7 @@ function SvelteComponent(options) {
if (options.target) {
this._fragment.c();
this._fragment.m(options.target, options.anchor || null);
this._mount(options.target, options.anchor);
}
}

@ -167,7 +167,7 @@ function callAll(fns) {
}
function _mount(target, anchor) {
this._fragment.m(target, anchor);
this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor || null);
}
function _unmount() {
@ -250,7 +250,7 @@ function SvelteComponent(options) {
if (options.target) {
this._fragment.c();
this._fragment.m(options.target, options.anchor || null);
this._mount(options.target, options.anchor);
}
}

@ -60,7 +60,7 @@ function SvelteComponent(options) {
if (options.target) {
this._fragment.c();
this._fragment.m(options.target, options.anchor || null);
this._mount(options.target, options.anchor);
}
}

@ -0,0 +1,17 @@
<div transition:foo><slot></slot></div>
<script>
export default {
transitions: {
foo: function ( node, params ) {
return {
delay: 50,
duration: 100,
tick: t => {
node.foo = t;
}
};
}
}
};
</script>

@ -0,0 +1,21 @@
export default {
test ( assert, component, target, window, raf ) {
component.set({ visible: true });
const div = target.querySelector( 'div' );
assert.equal( div.foo, 0 );
raf.tick( 50 );
assert.equal( div.foo, 0 );
raf.tick( 100 );
assert.equal( div.foo, 0.5 );
raf.tick( 125 );
assert.equal( div.foo, 0.75 );
raf.tick( 150 );
assert.equal( div.foo, 1 );
component.destroy();
}
};

@ -0,0 +1,10 @@
{{#if visible}}
<Child>delayed</Child>
{{/if}}
<script>
import Child from './Child.html';
export default {
components:{ Child }
};
</script>
Loading…
Cancel
Save