update tests

pull/1386/head
Rich Harris 7 years ago
parent 541ec6c397
commit 1bacad1087

@ -26,6 +26,10 @@ function addResizeListener(element, fn) {
object.setAttribute('style', 'display: block; position: absolute; top: 0; left: 0; height: 100%; width: 100%; overflow: hidden; pointer-events: none; z-index: -1;'); object.setAttribute('style', 'display: block; position: absolute; top: 0; left: 0; height: 100%; width: 100%; overflow: hidden; pointer-events: none; z-index: -1;');
object.type = 'text/html'; object.type = 'text/html';
object.onload = () => {
object.contentDocument.defaultView.addEventListener('resize', fn);
};
if (/Trident/.test(navigator.userAgent)) { if (/Trident/.test(navigator.userAgent)) {
element.appendChild(object); element.appendChild(object);
object.data = 'about:blank'; object.data = 'about:blank';
@ -34,10 +38,6 @@ function addResizeListener(element, fn) {
element.appendChild(object); element.appendChild(object);
} }
object.onload = () => {
object.contentDocument.defaultView.addEventListener('resize', fn);
};
return { return {
cancel: () => { cancel: () => {
object.contentDocument.defaultView.removeEventListener('resize', fn); object.contentDocument.defaultView.removeEventListener('resize', fn);
@ -179,23 +179,22 @@ function create_main_fragment(component, ctx) {
}, },
h: function hydrate() { h: function hydrate() {
div_resize_listener = addResizeListener(div, div_resize_handler);
component.root._beforecreate.push(div_resize_handler); component.root._beforecreate.push(div_resize_handler);
}, },
m: function mount(target, anchor) { m: function mount(target, anchor) {
insertNode(div, target, anchor); insertNode(div, target, anchor);
div_resize_listener = addResizeListener(div, div_resize_handler);
}, },
p: noop, p: noop,
u: function unmount() { u: function unmount() {
detachNode(div); detachNode(div);
div_resize_listener.cancel();
}, },
d: function destroy$$1() { d: noop
div_resize_listener.cancel();
}
}; };
} }
@ -203,11 +202,18 @@ function SvelteComponent(options) {
init(this, options); init(this, options);
this._state = assign({}, options.data); this._state = assign({}, options.data);
if (!options.root) {
this._oncreate = [];
this._beforecreate = [];
}
this._fragment = create_main_fragment(this, this._state); this._fragment = create_main_fragment(this, this._state);
if (options.target) { if (options.target) {
this._fragment.c(); this._fragment.c();
this._mount(options.target, options.anchor); this._mount(options.target, options.anchor);
callAll(this._beforecreate);
} }
} }

@ -1,5 +1,5 @@
/* generated by Svelte vX.Y.Z */ /* generated by Svelte vX.Y.Z */
import { addResizeListener, assign, createElement, detachNode, init, insertNode, noop, proto } from "svelte/shared.js"; import { addResizeListener, assign, callAll, createElement, detachNode, init, insertNode, noop, proto } from "svelte/shared.js";
function create_main_fragment(component, ctx) { function create_main_fragment(component, ctx) {
var div, div_resize_listener; var div, div_resize_listener;
@ -16,23 +16,22 @@ function create_main_fragment(component, ctx) {
}, },
h: function hydrate() { h: function hydrate() {
div_resize_listener = addResizeListener(div, div_resize_handler);
component.root._beforecreate.push(div_resize_handler); component.root._beforecreate.push(div_resize_handler);
}, },
m: function mount(target, anchor) { m: function mount(target, anchor) {
insertNode(div, target, anchor); insertNode(div, target, anchor);
div_resize_listener = addResizeListener(div, div_resize_handler);
}, },
p: noop, p: noop,
u: function unmount() { u: function unmount() {
detachNode(div); detachNode(div);
div_resize_listener.cancel();
}, },
d: function destroy() { d: noop
div_resize_listener.cancel();
}
}; };
} }
@ -40,11 +39,18 @@ function SvelteComponent(options) {
init(this, options); init(this, options);
this._state = assign({}, options.data); this._state = assign({}, options.data);
if (!options.root) {
this._oncreate = [];
this._beforecreate = [];
}
this._fragment = create_main_fragment(this, this._state); this._fragment = create_main_fragment(this, this._state);
if (options.target) { if (options.target) {
this._fragment.c(); this._fragment.c();
this._mount(options.target, options.anchor); this._mount(options.target, options.anchor);
callAll(this._beforecreate);
} }
} }

Loading…
Cancel
Save