Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function initNode(
styleNodes: Object,
baseNode: Object,
css: string,
type: string,
media: string = ''
): void {
const node = getStyleNode(styleNodes, baseNode, type, media)
// in case that there is a node coming from server already
// but rules are not matchnig
if (node.textContent !== css) {
node.textContent = css
}
}
return function changeSubscription(change) {
if (change.type === CLEAR_TYPE) {
for (const node in renderer.styleNodes) {
renderer.styleNodes[node].textContent = ''
}
return
}
const styleNode = getStyleNode(
renderer.styleNodes,
baseNode,
change.type,
change.media
)
if (change.type === RULE_TYPE) {
// only use insertRule in production as browser devtools might have
// weird behavior if used together with insertRule at runtime
if (process.env.NODE_ENV !== 'production') {
if (change.media) {
styleNode.textContent = renderer.mediaRules[change.media]
} else {
styleNode.textContent = renderer.rules
}
} else {