w3c / csswg-drafts

CSS Working Group Editor Drafts
https://drafts.csswg.org/
Other
4.5k stars 664 forks source link

[cssom-1] Indicating when a style sheet is script-blocking is duplicated several times #3103

Open domfarolino opened 6 years ago

domfarolino commented 6 years ago

In the HTML Standard's Interactions of styling and scripting section we have the definition of the "style sheet ready" flag for CSS style sheets. We also have a list of conditions which, if met, make a style sheet a script-blocking one. Not too long ago this section was reformatted, and another condition has been added.

The "style sheet ready" flag is seemingly never used or set, and we're going to change (and maybe rename?) this to be a flag that makes a style sheet that was previously script-blocking, no longer script-blocking. When searching around for usages of the flag, I noticed that some text at the bottom of both the xml-stylesheet process instruction and Link header requirements sections mention the conditions that make a style sheet a script-blocking one. This seems like normative information that is duplicated from the HTML Standard, and can easily get out of sync (like with the adding of more conditions as we've seen).

Would the editors accept a PR from me that replaces these paragraphs with something like a "Note" linking to the appropriate section in the HTML Standard so this logic might stay in one place?

/cc @emilio @annevk

annevk commented 6 years ago

I think we'd need to make changes on both sides if we want to reuse HTML's definition. E.g., the xml-stylesheet processing instruction is not an element whereas HTML only talks about elements.

I do agree it makes sense though, especially as they are already out-of-sync.

emilio commented 6 years ago

Would the editors accept a PR from me that replaces these paragraphs with something like a "Note" linking to the appropriate section in the HTML Standard so this logic might stay in one place?

Please do! Otherwise let me know if you don't have the cycles and I'll do the edits myself. Thanks!

domfarolino commented 6 years ago

@annevk I think I understand the changes you refer to on the HTML side, but could you clarify what changes would need made elsewhere? Are you saying we should add text in the CSSOM spec and wherever xml-stylesheet processing is that says, "In the context of a web page, these style sheets can be script-blocking [HTML], given the conditions defined in that standard" or something?

annevk commented 6 years ago

@domfarolino I think on the CSSOM side we can mostly remove text as it's already tied to HTML through the Document object to which the styles are added. One thing that might be worth fixing at some point (but is a large undertaking) is to make CSSOM less handwavy about arguments to algorithms vs global state. Or rather, modernize its algorithms in general.