0
0
mirror of https://github.com/sveltejs/svelte.git synced 2024-11-30 17:00:40 +01:00
svelte/test/js/samples/css-media-query/expected.js

57 lines
1.2 KiB
JavaScript
Raw Normal View History

/* generated by Svelte vX.Y.Z */
2017-09-16 21:09:38 +02:00
import { appendNode, assign, createElement, detachNode, init, insertNode, noop, proto, setAttribute } from "svelte/shared.js";
2017-07-25 00:36:22 +02:00
function encapsulateStyles(node) {
setAttribute(node, "svelte-3905933315", "");
}
function add_css() {
var style = createElement("style");
style.id = 'svelte-3905933315-style';
style.textContent = "@media(min-width: 1px){div[svelte-3905933315],[svelte-3905933315] div{color:red}}";
appendNode(style, document.head);
2017-07-25 00:36:22 +02:00
}
2018-02-11 14:24:55 +01:00
function create_main_fragment(component, state) {
2017-07-25 00:36:22 +02:00
var div;
return {
2017-09-19 04:00:28 +02:00
c: function create() {
2017-09-03 23:18:59 +02:00
div = createElement("div");
2017-09-19 04:00:28 +02:00
this.h();
2017-07-25 00:36:22 +02:00
},
2017-09-19 04:00:28 +02:00
h: function hydrate() {
2017-09-03 23:18:59 +02:00
encapsulateStyles(div);
2017-07-25 00:36:22 +02:00
},
2017-09-19 04:00:28 +02:00
m: function mount(target, anchor) {
2017-09-03 23:18:59 +02:00
insertNode(div, target, anchor);
2017-07-25 00:36:22 +02:00
},
2017-09-19 04:00:28 +02:00
p: noop,
2017-08-14 04:36:39 +02:00
2017-09-19 04:00:28 +02:00
u: function unmount() {
2017-09-03 23:18:59 +02:00
detachNode(div);
2017-07-25 00:36:22 +02:00
},
2017-09-19 04:00:28 +02:00
d: noop
2017-07-25 00:36:22 +02:00
};
}
function SvelteComponent(options) {
2017-09-16 21:09:38 +02:00
init(this, options);
2017-10-15 22:17:48 +02:00
this._state = assign({}, options.data);
2017-07-25 00:36:22 +02:00
if (!document.getElementById("svelte-3905933315-style")) add_css();
2017-07-25 00:36:22 +02:00
2018-02-11 14:24:55 +01:00
this._fragment = create_main_fragment(this, this._state);
2017-07-25 00:36:22 +02:00
if (options.target) {
2017-09-19 04:00:28 +02:00
this._fragment.c();
2018-03-06 18:07:49 +01:00
this._mount(options.target, options.anchor || null);
2017-07-25 00:36:22 +02:00
}
}
2017-09-16 17:08:41 +02:00
assign(SvelteComponent.prototype, proto);
2018-01-26 19:29:21 +01:00
export default SvelteComponent;