gngr
gngr copied to clipboard
style nodes get processed twice
Our HTML parser first appends the style node to the DOM, then appends its child nodes to the style node.
The style node gets an "attached-to-DOM" event and then a "child-list-changed" event. This causes the CSS to be parsed twice.
The simplest fix for this would be to detect the case of missing child-nodes and create an empty stylesheet directly.
A more sophisticated solution would avoid any duplicate processing. For eample, by inform the style node that parsing is incomplete when it is first attached to the DOM.