Bug 1470150: noscript rules should not apply to non-HTML elements. r=heycam
Test Plan: wpt
Reviewers: heycam
Tags: #secure-revision
Bug #: 1470150
Differential Revision:
https://phabricator.services.mozilla.com/D1749
MozReview-Commit-ID: DPzLobkpKGT
--- a/layout/style/res/noscript.css
+++ b/layout/style/res/noscript.css
@@ -1,9 +1,11 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-/* This sheet is added to the style set for documents with script disabled */
+/* This sheet is added to the style set for documents with script enabled */
+
+@namespace url(http://www.w3.org/1999/xhtml);
noscript {
display: none !important;
}
--- a/testing/web-platform/meta/MANIFEST.json
+++ b/testing/web-platform/meta/MANIFEST.json
@@ -340920,16 +340920,22 @@
]
],
"html/rendering/replaced-elements/svg-inline-sizing/svg-inline.html": [
[
"/html/rendering/replaced-elements/svg-inline-sizing/svg-inline.html",
{}
]
],
+ "html/scripting/the-noscript-element/non-html-noscript.html": [
+ [
+ "/html/scripting/the-noscript-element/non-html-noscript.html",
+ {}
+ ]
+ ],
"html/semantics/disabled-elements/disabledElement.html": [
[
"/html/semantics/disabled-elements/disabledElement.html",
{}
]
],
"html/semantics/document-metadata/interactions-of-styling-and-scripting/conditionally-block-rendering-on-link-media-attr.html": [
[
@@ -547474,17 +547480,17 @@
"886f72b4eaa82d3aeb4de5c5b27f71369dbe0186",
"testharness"
],
"css/cssom/getComputedStyle-display-none-001.html": [
"0e1f381bb67d045c9a92461f664c3c4d61de280f",
"testharness"
],
"css/cssom/getComputedStyle-display-none-002.html": [
- "2ffac7ef0de3a2b01217be7e2700660a4f9a5d0d",
+ "23a362d9423cdfe6d8c29809fdadca525054d175",
"testharness"
],
"css/cssom/getComputedStyle-dynamic-subdoc.html": [
"3f379487727d9730de9e3569b26632c35d602d9d",
"testharness"
],
"css/cssom/getComputedStyle-pseudo.html": [
"d3ef09fb6092078562f8923879b9ece97938df47",
@@ -577805,16 +577811,20 @@
"html/rendering/unstyled-xml-documents/.gitkeep": [
"da39a3ee5e6b4b0d3255bfef95601890afd80709",
"support"
],
"html/resources/common.js": [
"0f18ee2c61b99893cfe2a3d1ff549b170a8d715d",
"support"
],
+ "html/scripting/the-noscript-element/non-html-noscript.html": [
+ "c0c5453111f29e5a0206f988f4d127ec8ebc2f13",
+ "testharness"
+ ],
"html/semantics/.gitkeep": [
"da39a3ee5e6b4b0d3255bfef95601890afd80709",
"support"
],
"html/semantics/OWNERS": [
"abd95839027a88741c4d351ff374d81b773c80fa",
"support"
],
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/html/scripting/the-noscript-element/non-html-noscript.html
@@ -0,0 +1,16 @@
+<!doctype html>
+<title>noscript rules don't apply to non-html elements</title>
+<link rel="author" title="Emilio Cobos Álvarez" href="mailto:emilio@crisal.io">
+<link rel="help" href="https://html.spec.whatwg.org/multipage/#the-noscript-element">
+<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1470150">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<body>
+<script>
+test(function() {
+ let non_html_noscript = document.createElementNS("http://www.w3.org/2000/svg", "noscript");
+ document.body.appendChild(non_html_noscript);
+ assert_not_equals(getComputedStyle(non_html_noscript).display, "none");
+}, "Non-HTML <noscript> element shouldn't be undisplayed by an UA rule");
+</script>
+</body>