This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 29566 - Specify insertRule('@import ...', 0) loading
Summary: Specify insertRule('@import ...', 0) loading
Status: NEW
Alias: None
Product: CSS
Classification: Unclassified
Component: CSSOM (show other bugs)
Version: unspecified
Hardware: PC All
: P2 normal
Target Milestone: ---
Assignee: Simon Pieters
QA Contact: public-css-bugzilla
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-04-08 13:07 UTC by Simon Pieters
Modified: 2016-04-08 14:51 UTC (History)
1 user (show)

See Also:


Attachments

Description Simon Pieters 2016-04-08 13:07:11 UTC
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
Comment 1 Simon Pieters 2016-04-08 13:44:09 UTC
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.
Comment 2 Rune Lillesveen 2016-04-08 14:51:38 UTC
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.