move document.head to addCssToComponent method

pull/5639/head
Ivan Hofer 5 years ago
parent 5c3038ccae
commit 6d85265858

@ -44,8 +44,8 @@ export default function dom(
if (should_add_css) {
body.push(b`
function ${add_css}(customStyleTag) {
@appendStyleIfNotPresent(customStyleTag, "${component.stylesheet.id.replace('svelte-', '')}", "${styles}");
function ${add_css}(target) {
@appendStyleIfNotPresent(target, "${component.stylesheet.id.replace('svelte-', '')}", "${styles}");
}
`);
}

@ -102,7 +102,7 @@ export function addCssToComponent(component, add_css, options) {
component.$$ = {
customStyleTag: options.customStyleTag || current_component && current_component.$$.customStyleTag
};
add_css(component.$$.customStyleTag);
add_css(component.$$.customStyleTag || document.head);
}
export function init(component, options, instance, create_fragment, not_equal, props, dirty = [-1]) {

@ -1,7 +1,7 @@
import { has_prop } from './utils';
export function appendStyleIfNotPresent(
target: Element = document.head,
target: Element,
styleSheetId: string,
styles: string,
styleId:string = `svelte-${styleSheetId}-style`) {

Loading…
Cancel
Save