w3c / csswg-drafts

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

[css-mediaqueries] @media (scripting: initial-only) is weird #8621

Open emilio opened 1 year ago

emilio commented 1 year ago

When is it supposed to match on browsers? When printing? But on implementations either reuse the document (which means script is paused, but will run again), or clone the document (which means they never run script on such document, though we probably want to match scripting: enabled to match the non-print media).

I think we could probably do without this value. I'm personally unsure on when would it be useful on browsers, though if there's a strong use-case from embedded / PDF renderers / etc I suppose we could match it.

wdyt, @frivoal?

tabatkins commented 1 year ago

It shouldn't ever match in browsers. They either run script or not, they don't have an initial phase.

CanadaHonk commented 1 year ago

@tabatkins In what situations would it match? It mentioned printing, does it mean actual printer devices, or?

Examples are printed pages, or pre-rendering network proxies that render a page on a server and send a nearly-static version of the page to the user.

tabatkins commented 1 year ago

Yeah, like book printing.

emilio commented 1 year ago

Okay, a note in the spec to that regard would be useful but otherwise I'm ok with close-no-change.

sideshowbarker commented 1 year ago

I notice Firefox passes the “Check that scripting currently matches 'enabled'” test case in https://wpt.live/css/mediaqueries/scripting.html — which I wouldn’t expect it to if it weren’t matching. Am I misunderstanding what that’s testing?

CanadaHonk commented 1 year ago

@sideshowbarker I added support for @media (scripting) in Gecko (and those WPTs) in March. Phab and intent to ship, if confused why it seems supported. Otherwise, it should match 'enabled' since (I presume) JavaScript is on in Firefox.

sideshowbarker commented 1 year ago

@sideshowbarker I added support for @media (scripting) in Gecko (and those WPTs) in March. Phab and intent to ship, if confused why it seems supported. Otherwise, it should match 'enabled' since (I presume) JavaScript is on in Firefox.

Thanks much. I’d been trying to figure out how to get the Firefox behavior in WebKit — and from looking at that Gecko patch, it’s clear to me now how to do that.