This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.
https://drafts.csswg.org/cssom/#the-cssimportrule-interface [[ Note: If loading of the style sheet fails its CSS rules list is simply empty, i.e., an @import at-rule always has an associated CSS style sheet. ]] Unclear what should happen for insertRule('@import url(...);', 0); on an already-loaded stylesheet, as in http://software.hixie.ch/utilities/js/live-dom-viewer/saved/4039 What happens with the parent sheet while it's loading? What happens when the @imported sheet is half-way loaded? What happens when accessing CSSImportRule#styleSheet during loading? Ack rune
From rune: > what makes me uncertain is that the loading import blocks the main > sheet from being applied in when the @import is parsed as part of the > <style> element. You have three scenarios if you're inserting the > style element after you applied style to your document the first time > and there are no other sheets blocking. > 1. Insert <style>@import url; ...</style> > 2. Insert <style>...</style>, insert @import > 3. Insert <style>...</style>, re-apply style, insert @import > for the first case, the loading @import blocks application of the rest > of the <style> element. Gecko and Blink agrees on that.
Inserting a style element with script and then insertRule() a slow loading @import will currently apply the main style of the style element in both Gecko and Blink before the @import finishes loading. If you insert two @import rules, Gecko will apply them separately as they finish loading, but Blink will currently block until both sheets are loaded.