Closed Bug 1166581 Opened 9 years ago Closed 1 year ago

Implement the `scripting` media feature from Media Queries Level 5

Categories

(Core :: CSS Parsing and Computation, enhancement)

enhancement

Tracking

()

RESOLVED FIXED
113 Branch
Tracking Status
relnote-firefox --- 113+
firefox113 --- fixed

People

(Reporter: mozilla, Assigned: canadahonk, Mentored)

References

(Blocks 1 open bug, )

Details

(Keywords: dev-doc-complete)

Attachments

(1 file)

See Also: → 1171900
Status: UNCONFIRMED → NEW
Ever confirmed: true
Summary: Implement the `scripting` media feature from Media Queries Level 4 → Implement the `scripting` media feature from Media Queries Level 5

I think this is already implemented, but no statement has been given about its status.

According to the WHATWG spec, the @media (scripting) at-rule controls if <noscript> tags can appear. This is now fully supported in Firefox.

How to check:

  1. Copy-paste the following to the <body> of an HTML document:
<style>
@media not (scripting) {
    .only-js {
        display: none !important;
    }
}
</style>
<div class="only-js">This text will disappear if JavaScript is disabled.</div>
  1. Disable JavaScript through the inspector.
  2. This media argument works if the div disappears.

Sorry, but I forgot to put my navigator.userAgent here: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:100.0) Gecko/20100101 Firefox/100.0.

Nope, the media query scripting actually does not work yet.

Type: defect → enhancement

This should be reasonably straight-forward to implement.

This is what controls noscript behavior: https://searchfox.org/mozilla-central/rev/32ca4fc265150e7d3d7aa6c6abea088768cf024b/dom/base/Document.cpp#3175-3177

We could reasonably enough just call that from the media query code or so. Media queries are implemented here.

Mentor: emilio
Severity: normal → S3

Implemented the scripting media feature.

Not locked behind a pref as it does not do anything new or particularly
give new data which could be used for fingerprinting (see <noscript>, etc).

Also added new WPT tests (none previously). Not supported in any other browsers yet.

Test page: https://goose.icu/media-scripting

Attachment #9323901 - Attachment description: WIP: Bug 1166581 - Implement scripting media feature → Bug 1166581 - Implement scripting media feature
Assignee: nobody → oj
Status: NEW → ASSIGNED
Blocks: 1823525
See Also: → 1824481
Pushed by ealvarez@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/3248e098c997
Implement scripting media feature r=emilio
Status: ASSIGNED → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 113 Branch

Release Note Request (optional, but appreciated)
[Why is this notable]: New CSS media query feature now implemented and shipping on by default in 113
[Affects Firefox for Android]: Yes
[Suggested wording]: Not sure
[Links (documentation, blog post, etc)]: MDN page - https://developer.mozilla.org/en-US/docs/Web/CSS/@media/scripting

relnote-firefox: --- → ?
Blocks: 1825375

Added to the Fx113 Nightly relnotes, but right now I'm thinking that I'll probably rework this into a "here's some new CSS features we shipped" kind of roll-up note once 113 rides to Beta/Release.

The following issue can be used to track updates on MDN: https://github.com/mdn/content/issues/26150
Thank you CanadaHonk [:canadahonk] for updating the browser compat table!!
I've added an entry to the Fx113 release note.

You need to log in before you can comment on or make changes to this bug.