Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
helper.getDOM(str).forEach(function(child) {
DomUtils.prepend(elem, child);
});
});
function prependElement(parent, element) {
if (parent.children)
DOMUtils.prepend(parent.children[0], element);
else
DOMUtils.appendChild(parent, element);
}
const css = stringifyRules(rules, compress);
const styleElement = {
type: ElementType.Style,
name: 'style',
attribs: {},
children: []
};
DOMUtils.appendChild(styleElement, {
type: ElementType.Text,
data: css
});
const head = DOMUtils.getElementsByTagName('head', dom, true, 2)[0];
if (head)
if (head.children)
DOMUtils.prepend(head.children[0], styleElement);
else
DOMUtils.appendChild(head, styleElement);
else {
const body = DOMUtils.getElementsByTagName('body', dom, true, 2)[0];
if (body)
if (body.children)
DOMUtils.prepend(body.children[0], styleElement);
else
DOMUtils.appendChild(body, styleElement);
else
dom.unshift(styleElement);
}
}
return context.delete('rules');
};