construct-stylesheets icon indicating copy to clipboard operation
construct-stylesheets copied to clipboard

Need to define quirks mode interactions for constructable stylesheets

Open bzbarsky opened this issue 7 years ago • 10 comments

Stylesheet parsing is affected by quirks mode. Should constructable stylesheets always be parsed in standards mode? Should they pick up the quirks mode of a document (which)?

@tabatkins @annevk @domenic @rakina

bzbarsky avatar Oct 24 '18 11:10 bzbarsky

Definitely always Standards mode; I see no reason to further expose quirks mode.

tabatkins avatar Oct 24 '18 11:10 tabatkins

I agree.

(Note that the mismatch of document and style sheet quirks mode can already be done using the Link header and document.open(). It's a little unclear if all the specifications are clear on which quirks mode they mean though.)

cc @zcorpan

annevk avatar Oct 24 '18 11:10 annevk

Also agree with @tabatkins

zcorpan avatar Oct 25 '18 08:10 zcorpan

Fwiw, I also think they should always be standards mode. We just need to specify this.

bzbarsky avatar Oct 25 '18 08:10 bzbarsky

How do we define that? Just add "in no-quirks mode" to the end of "Parse a stylesheet from text"?

rakina avatar Oct 25 '18 09:10 rakina

Good question. There's no actual entrypoint to stylesheet parsing that takes a mode as an argument, and the quirks mode bits are comefrom-monkeypatched in by https://quirks.spec.whatwg.org/#the-hashless-hex-color-quirk and https://quirks.spec.whatwg.org/#the-unitless-length-quirk

Maybe the right thing for now is to just add text to the ends of those sections (akin to the existing "must apply" and "must not be supported" bits). Sort of up to @tabatkins and @zcorpan who maintain the relevant specs how they think this should best be done.

bzbarsky avatar Oct 25 '18 09:10 bzbarsky

I'd be happy to have this more explicit as a flag on the stylesheet or so and use that in the quirks standard. @tabatkins ?

zcorpan avatar Oct 25 '18 09:10 zcorpan

How much of the Web still uses quirks mode?

Wouldn't it make sense to discourage its use by disabling the new features when rendering in quirks mode (as in, either don't provide the APIs, or provide them, but throw on call/getter access)?

It would reduce the accidental use of quirks mode in new pages/apps, and would not break Web CompatTM.

pygy avatar Feb 02 '20 22:02 pygy

@pygy 4.85% of httparchive https://twitter.com/zcorpan/status/1205242913908838400

Disabling or changing features in quirks mode is effectively adding more quirks. In the past, we have instead tried to remove quirks to reduce complexity in the implementation.

Feel free to create a new issue in https://github.com/whatwg/quirks if you'd like to discuss the idea more.

zcorpan avatar Feb 02 '20 23:02 zcorpan

How much of the Web still uses quirks mode?

A ton, because about:blank is in quirks mode and lots of sites create blank iframes and then add content to them...

bzbarsky avatar Feb 03 '20 15:02 bzbarsky