Open nordzilla opened 4 years ago
More generally, alternate
is only useful to determine the initial disabled
state. So if you can specify disabled
then it's not great.
There's another quirk of regular sheets that isn't great, which is that if you haven't seen a sheet with title
before, the "preferred" title becomes that title, if non-empty. I don't think we necessarily want that for constructable stylesheets, but worth thinking about?
It doesn't help that Blink's / WebKit's handling of alternate stylesheets is so broken though, see https://github.com/whatwg/html/issues/3840.
Hmm, interesting. The MDN page does say an alternate style sheet must have a specified title, but the spec text here doesn't really do anything with stylesheets whose alternate flag is set and an empty title, so I'm not sure if we should throw there. However looking closely I think our current draft spec in this repro isn't hooked up to any of the steps here https://drafts.csswg.org/cssom/#add-a-css-style-sheet (see reply below too)
There's another quirk of regular sheets that isn't great, which is that if you haven't seen a sheet with title before, the "preferred" title becomes that title, if non-empty. I don't think we necessarily want that for constructable stylesheets, but worth thinking about?
I think we can get this for free too if we hook up the construction with "create a CSS style sheet". Is there any reason why we don't want this behavior?
It seems a bit weird because title
has no effect in regular Shadow DOM stylesheets already, see https://github.com/w3c/csswg-drafts/issues/2646...
I think title
and alternate
should just be removed, and we should just leave disabled
which sets the final value of the disabled
flag.
The CSS Working Group just discussed CSSStyleSheetInit dictionary may have unintended usage
, and agreed to the following:
RESOLVED: remove title and alternate from constructor
Since title
is used to define Style Sheet Set
doesn't removing it from the constructor and keeping it read-only impact the whole concept of sets? A sheet created with new CSSStyleSheet()
can never get a title and therefore can't participate in sets. Maybe open up the constructor and specify guards to address invalid conditions/combinations?
The
CSSStyleSheetInit
dictionary specified here in the spec may lead to some configurations.For example, setting
title = ""
andalternate = true
is a possible configuration using this dictionary; however an alternate style sheet must have a specified title.Also, the CSSOM spec notes that
media
,title
, andalternate
are specified when the sheet is created, but it does not say this aboutdisabled
. Should we be allowed to specifydisabled
explicitly as one of the constructor options?At the very least, I think that the constructor should throw if
title = ""
andalternate = true
.