From cf222a32f3ffba0513a3f5dde1acd2a3ede794e1 Mon Sep 17 00:00:00 2001 From: Theresa O'Connor Date: Wed, 23 Jun 2021 10:02:13 -0700 Subject: [PATCH] Define media="" on Closes #6495. --- source | 59 +++++++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 46 insertions(+), 13 deletions(-) diff --git a/source b/source index ce8ad2b47f7..864792792ea 100644 --- a/source +++ b/source @@ -14035,6 +14035,7 @@ interface HTMLLinkElement : HTMLElement {
http-equiv
content
charset
+
media
Accessibility considerations:
For authors.
@@ -14048,6 +14049,7 @@ interface HTMLMetaElement : HTMLElement { [CEReactions] attribute DOMString name; [CEReactions] attribute DOMString httpEquiv; [CEReactions] attribute DOMString content; + [CEReactions] attribute DOMString media; // also has obsolete members }; @@ -14102,14 +14104,21 @@ interface HTMLMetaElement : HTMLElement { data-x="attr-meta-content">content attribute, then the value part of the metadata name-value pair is the empty string.

+

The media attribute + says which media the metadata applies to. The value must be a valid media query list. + Unless the name is theme-color, the media + attribute has no effect on the processing model and must not be used by authors.

+
-

The name and - content IDL - attributes must reflect the respective content attributes of the same name. The IDL - attribute httpEquiv must reflect the content attribute - http-equiv.

+

The name, content, and media IDL attributes + must reflect the respective content attributes of the same name. The IDL attribute + httpEquiv must + reflect the content attribute http-equiv.

@@ -14367,10 +14376,10 @@ interface HTMLMetaElement : HTMLElement { surrounding user interface. For example, a browser might color the page's title bar with the specified value, or use it as a color highlight in a tab bar or task switcher.

-

There must not be more than one meta element with its name attribute value set to an - ASCII case-insensitive match for theme-color per document.

+

Within an HTML document, the media attribute value must + be unique amongst all the meta elements with their name attribute value set to an ASCII + case-insensitive match for theme-color.

@@ -14383,6 +14392,19 @@ interface HTMLMetaElement : HTMLElement {
+

The media attribute may be used to describe the context + in which the provided color should be used.

+ +
+

If we only wanted to use "WHATWG green" as this standard's theme color in dark mode, + we could use the prefers-color-scheme media feature:

+ +
<!DOCTYPE HTML>
+<title>HTML Standard</title>
+<meta name="theme-color" content="#3c790a" media="(prefers-color-scheme: dark)">
+...
+
+

To obtain a page's theme color, user agents must run the following steps:

@@ -14404,6 +14426,11 @@ interface HTMLMetaElement : HTMLElement {

For each element in candidate elements:

    +
  1. If element has a media attribute + and the value of element's media + attribute does not match the environment, then + continue.

  2. +
  3. Let value be the result of stripping leading and trailing ASCII whitespace from the value of element's content attribute.

  4. @@ -14421,8 +14448,11 @@ interface HTMLMetaElement : HTMLElement {

    If any meta elements are inserted into the document or removed from the document, or existing meta elements have their - name or content - attributes changed, user agents must re-run the above algorithm and apply the result to any + name, content, or + media attributes changed, or if the environment changes + such that any meta element's media + attribute's value may now or may no longer match the + environment, user agents must re-run the above algorithm and apply the result to any affected UI.

@@ -120527,7 +120557,8 @@ interface MimeType { name; http-equiv; content; - charset + charset; + media HTMLMetaElement @@ -122202,6 +122233,7 @@ interface MimeType { media link; + meta; source (in picture); style Applicable media @@ -124938,6 +124970,7 @@ INSERT INTERFACES HERE Derek Guenther, Devarshi Pant, Devdatta, + Devin Rousso, Diego Ferreiro Val, Diego González Zúñiga , Diego Ponce de León,