mirror of
https://github.com/sveltejs/svelte.git
synced 2024-12-01 17:30:59 +01:00
update tests
This commit is contained in:
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.type = 'text/html';
|
||||
|
||||
object.onload = () => {
|
||||
object.contentDocument.defaultView.addEventListener('resize', fn);
|
||||
};
|
||||
|
||||
if (/Trident/.test(navigator.userAgent)) {
|
||||
element.appendChild(object);
|
||||
object.data = 'about:blank';
|
||||
@ -34,10 +38,6 @@ function addResizeListener(element, fn) {
|
||||
element.appendChild(object);
|
||||
}
|
||||
|
||||
object.onload = () => {
|
||||
object.contentDocument.defaultView.addEventListener('resize', fn);
|
||||
};
|
||||
|
||||
return {
|
||||
cancel: () => {
|
||||
object.contentDocument.defaultView.removeEventListener('resize', fn);
|
||||
@ -179,23 +179,22 @@ function create_main_fragment(component, ctx) {
|
||||
},
|
||||
|
||||
h: function hydrate() {
|
||||
div_resize_listener = addResizeListener(div, div_resize_handler);
|
||||
component.root._beforecreate.push(div_resize_handler);
|
||||
},
|
||||
|
||||
m: function mount(target, anchor) {
|
||||
insertNode(div, target, anchor);
|
||||
div_resize_listener = addResizeListener(div, div_resize_handler);
|
||||
},
|
||||
|
||||
p: noop,
|
||||
|
||||
u: function unmount() {
|
||||
detachNode(div);
|
||||
div_resize_listener.cancel();
|
||||
},
|
||||
|
||||
d: function destroy$$1() {
|
||||
div_resize_listener.cancel();
|
||||
}
|
||||
d: noop
|
||||
};
|
||||
}
|
||||
|
||||
@ -203,11 +202,18 @@ function SvelteComponent(options) {
|
||||
init(this, options);
|
||||
this._state = assign({}, options.data);
|
||||
|
||||
if (!options.root) {
|
||||
this._oncreate = [];
|
||||
this._beforecreate = [];
|
||||
}
|
||||
|
||||
this._fragment = create_main_fragment(this, this._state);
|
||||
|
||||
if (options.target) {
|
||||
this._fragment.c();
|
||||
this._mount(options.target, options.anchor);
|
||||
|
||||
callAll(this._beforecreate);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* 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) {
|
||||
var div, div_resize_listener;
|
||||
@ -16,23 +16,22 @@ function create_main_fragment(component, ctx) {
|
||||
},
|
||||
|
||||
h: function hydrate() {
|
||||
div_resize_listener = addResizeListener(div, div_resize_handler);
|
||||
component.root._beforecreate.push(div_resize_handler);
|
||||
},
|
||||
|
||||
m: function mount(target, anchor) {
|
||||
insertNode(div, target, anchor);
|
||||
div_resize_listener = addResizeListener(div, div_resize_handler);
|
||||
},
|
||||
|
||||
p: noop,
|
||||
|
||||
u: function unmount() {
|
||||
detachNode(div);
|
||||
div_resize_listener.cancel();
|
||||
},
|
||||
|
||||
d: function destroy() {
|
||||
div_resize_listener.cancel();
|
||||
}
|
||||
d: noop
|
||||
};
|
||||
}
|
||||
|
||||
@ -40,11 +39,18 @@ function SvelteComponent(options) {
|
||||
init(this, options);
|
||||
this._state = assign({}, options.data);
|
||||
|
||||
if (!options.root) {
|
||||
this._oncreate = [];
|
||||
this._beforecreate = [];
|
||||
}
|
||||
|
||||
this._fragment = create_main_fragment(this, this._state);
|
||||
|
||||
if (options.target) {
|
||||
this._fragment.c();
|
||||
this._mount(options.target, options.anchor);
|
||||
|
||||
callAll(this._beforecreate);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user