-
Notifications
You must be signed in to change notification settings - Fork 707
[css-cascade] Relax the restriction for @import to precede all other rules #6334
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Yes, there's implementation reasons. @emilio can give a proper explanation, but basically the UA wants to kick off loading all the stylesheets before it gets done parsing everything. (Untagging cascade-4/5 since we're done with feature work in those levels. We're just blocked on fixing #4838 and #5864 before transitioning to CR.) |
It also complexifies the "in document order" part of cascade; currently all the styles in a given stylesheet are grouped together in document order, so you can just check if two styles come from the same stylesheet or not, and only dive into their exact position in they do. If @import can go anywhere, this is no longer true, as rules from one sheet can go before or after rules from another sheet. |
The details here are that browsers want to speculatively load |
Thank you so much @emilio for hunting down those parts of the sources too! Excuse my naïveté, but if the scanner remains unsophisticated and just drops the terminating condition for scanning |
The main issue is not dropping the terminating condition or what not. Right now those scanners stop scanning as soon as they find something unexpected. With |
Closing WONTFIX, @LeaVerou feel free to re-open if you feel it needs to be raised to the WG, but I think it's pretty clear we can't change this. |
I've recently come across a number of cases where stylesheets were concatenated, making previously valid
@import
rules invalid. It was quite annoying to need to write code to hoist them manually.Also, them having to be first means they cannot be used to import rules that should override other rules.
It also means that related code cannot be kept together, but needs to be scattered in multiple places.
Is there an implementation reason why these rules need to precede most other rules?
Would it be feasible in terms of web compat to relax this?
The text was updated successfully, but these errors were encountered: