[csswg-drafts] [cssom] spec for inserting @import rules should explain effects on child stylesheet lists, etc. (#4821)

dbaron has just created a new issue for https://github.com/w3c/csswg-drafts:

== [cssom] spec for inserting @import rules should explain effects on child stylesheet lists, etc. ==
The spec for [inserting a CSS rule](https://drafts.csswg.org/cssom/#insert-a-css-rule) specifies how the rule gets inserted into a style sheet.  It seems like the rule being inserted can be an `@import` rule, which seems like it should lead to loading of a CSS style sheet (linked from the `CSSImportRule`s `styleSheet` property) and population of the `CSSStyleSheet` object that is being imported.

It seems like this should probably be specified in a bit more detail.  In particular, given that the spec [says](https://drafts.csswg.org/cssom/#the-cssimportrule-interface):

> Note: An @import at-rule always has an associated CSS style sheet.

it seems like what happens is that the linked `CSSStyleSheet` is created immediately, but gets populated later as the style sheet loads.

Some points that aren't clear are:
* does that `CSSStyleSheet` get populated immediately when the newly-loaded style sheet is parsed (and then essentially follow this algorithm for adding rules recursively), or does it wait for other subresources of that style sheet to load?
* when do relayouts happen as multiple style sheets load?

It also seems that it would be useful for this to be specified better because a number of other specifications, in particular CSS Modules (which we got here from w3ctag/design-reviews#405) and Constructible Stylesheets (w3ctag/design-reviews#308, #3433) are disallowing `@import` rules, a restriction that seems likely to stick around if it's done initially, and which we feel may not really be there for good underlying reasons (and may be related to the lack of solid specification here).

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/4821 using your GitHub account

Received on Monday, 2 March 2020 23:19:27 UTC