update style_manager to use customStyleTag

pull/5639/head
Ivan Hofer 5 years ago
parent 54d3e91929
commit ee789853e7

@ -18,6 +18,9 @@ export function append_styles(
}
}
export function append_empty_stylesheet() {
return appendStylesTo.appendChild(element('style') as HTMLStyleElement);
}
export function append(target: Node, node: Node) {
target.appendChild(node);

@ -1,4 +1,4 @@
import { element } from './dom';
import { append_empty_stylesheet } from './dom';
import { raf } from './environment';
interface ExtendedDoc extends Document {
@ -31,7 +31,7 @@ export function create_rule(node: Element & ElementCSSInlineStyle, a: number, b:
const name = `__svelte_${hash(rule)}_${uid}`;
const doc = node.ownerDocument as ExtendedDoc;
active_docs.add(doc);
const stylesheet = doc.__svelte_stylesheet || (doc.__svelte_stylesheet = doc.head.appendChild(element('style') as HTMLStyleElement).sheet as CSSStyleSheet);
const stylesheet = doc.__svelte_stylesheet || (doc.__svelte_stylesheet = append_empty_stylesheet().sheet as CSSStyleSheet);
const current_rules = doc.__svelte_rules || (doc.__svelte_rules = {});
if (!current_rules[name]) {

Loading…
Cancel
Save