Open abarth opened 10 years ago
@tabatkins for moar insight.
I might be way off-base, but this seems tenuously connected to the proposal to allow authors to set their own initial styles. It sounds like what we're talking about here aren't actually initial styles proper, but they seem to serve similar use cases for authors.
One way of looking at this connection might be, if we provide some way for authors to set these "specificity 0 default styles," we have also solved some of the use cases in that thread (although not the transition-timing-function
one, I think).
Elliot and I have discussed, in the context of constructable Stylesheet objects, being able to set up "default" sheets that apply at the specificity discussed here. There's a bunch of interesting concept-space lying here that we should explore.
That sounds really nice. "Constructable Stylesheet objects" sounds much like the underpinnings of <custom-style>
, too.
I imagine then we could add a declarative version, <style default>
or something, once the imperative API is figured out.
Specifically:
*
as the selector almost does this; the only difference is that this is below *
selector rules.)* /deep/ *
for this, because outer rules win over all inner rules when dealing with cross-shadow contexts. (Most of the time this is what you want, as you're usually tweaking existing component styles with that kind of style.)
Many HTML elements have presentation attributes, which get translated into CSS properties that get inserted into a particular place in the cascade:
"The UA may choose to honor presentational attributes in an HTML source document. If so, these attributes are translated to the corresponding CSS rules with specificity equal to 0, and are treated as if they were inserted at the start of the author style sheet. They may therefore be overridden by subsequent style sheet rules."
http://www.w3.org/TR/CSS2/cascade.html
I don't know of any way currently for a web component to insert presentational CSS into the correct place in the cascade.