Skip to content

Commit

Permalink
Add user agent styles for <noscript> element (#260)
Browse files Browse the repository at this point in the history
  • Loading branch information
kasperisager authored Jun 10, 2020
1 parent 66a2b15 commit 6244434
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
14 changes: 14 additions & 0 deletions packages/alfa-cascade/src/user-agent.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {
Declaration,
MediaRule,
Namespace,
NamespaceRule,
Sheet,
Expand Down Expand Up @@ -45,6 +46,19 @@ export const UserAgent = Sheet.of((owner) => {
owner
),

MediaRule.of(
"(scripting)",
(self) => [
StyleRule.of(
"noscript",
(self) => [Declaration.of("display", "none", true, Option.of(self))],
owner,
Option.of(self)
),
],
owner
),

// /**
// * @see https://html.spec.whatwg.org/#the-page
// */
Expand Down
9 changes: 9 additions & 0 deletions packages/alfa-media/src/media.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,15 @@ export namespace Media {
value.type === "string" &&
value.value === device.viewport.orientation
);

case "scripting":
return device.scripting.enabled
? this._value.every(
(value) => value.type === "string" && value.value === "enabled"
)
: this._value.some(
(value) => value.type === "string" && value.value === "none"
);
}

return false;
Expand Down

0 comments on commit 6244434

Please sign in to comment.