fix `add_css` to allow custom stle hashes

pull/5870/head
Ivan Hofer 5 years ago
parent eb6fd8f9a4
commit 7e5a1ec50d

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

@ -115,14 +115,13 @@ function init_hydrate(target: NodeEx) {
export function append_styles(
target: Node,
styleSheetId: string,
styles: string,
styleId: string = `svelte-${styleSheetId}-style`
styles: string
) {
const appendStylesTo = get_root_for_styles(target);
if (!appendStylesTo?.querySelector('#' + styleId)) {
if (!appendStylesTo?.querySelector(`#${styleSheetId}`)) {
const style = element('style');
style.id = styleId;
style.id = styleSheetId;
style.textContent = styles;
append(appendStylesTo, style);
}

Loading…
Cancel
Save