-
Notifications
You must be signed in to change notification settings - Fork 719
[css-cascade] Provide an attribute for assigning a to a cascade layer #5853
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
I suspect that's not going to work, as existing user agents would just ignore the layer attribute, and assign all those styles to the default layer instead, so that's not going to be forward compatible. For "> If so, we might want to revisit the priority of this? It seems like a fairly common use-case. |
@mirisuzanne These two should have the same performance (at least in Chromium). Both are captured by preload scanners. |
I think this is a problem worth solving, either by hacking a
The Chromium/WebKit preload scanner for CSS imports is significantly more fragile than its HTML equivalent, as it doesn't perform "real" tokenization. It'd be better to not put the weight of this feature's performance on it. Also, Firefox doesn't have such a preload scanner AFAIK. |
What is the next step for pushing a |
Little, I suspect. Next would be socializing it in WHATWG with an issue, getting some impl buy-in, and then writing a PR. |
2a2200e defines the production necessary for HTML to reference media & supports conditions as a single syntax. I think otherwise we can close this, and continue the conversation/progress in the linked WHATWG issue, and the HTML spec. |
I'm working on a PR against the HTML spec to allow support queries in That is to say, I think we might need to update CSSOM in order to make this possible? Would be glad for thoughts/advice (@tabatkins or @emilio, maybe?) on the best way to approach this. |
@frivoal what you mean with forward compatible? Having a link with |
@frivoal to your statement, there are npm addons like Material-UI that inject another thing is when I go over all the style tags every like @digitaldonkey said more options to set CSS chunks to layers will boost feature adoption. real and messy existing apps need more tools in their arsenal for unique problems. |
Florian's comment was not that we shouldn't do this, but that an attribute alone will cause compatibility issues - which is true. Any browser that doesn't understand the new This is something that we are actively working on for both |
Is this really such a problem though? The only people would would run into this problem, are the ones who choose to use the feature. I understand it is a problem that does need to be solved, but I don't see a reason it should completely hold up this feature. |
This problem was raised 5 years ago. If it had been specced and implemented at the time then we'd be able to use it now, instead worrying about backwards compatibility is causing a delay... Obviously developers could just wait until this feature has broad support before using it... |
This was raised on #4969, related to the Cascade level 5 spec.
We've defined a syntax for cascade layers to be declared as code-blocks or url imports:
If we're allowing authors to import entire stylesheets into a layer, it seems appropriate to make that available on
and
tags as well. For performance reasons, those are more likely to be used - rather than chaining imports. I'm proposing a
layer
attribute:The text was updated successfully, but these errors were encountered: