From 9c612ac8641b5174849a2d3cb924fe662a8d3a09 Mon Sep 17 00:00:00 2001 From: Domenic Denicola Date: Thu, 14 Sep 2017 18:42:48 +0900 Subject: [PATCH] Improve - is ignored. Otherwise, parsing behavior in those browsers - could differ substantially from the parsing behavior of HTML5. - Once everyone follows the HTML5 spec, we can drop this - requirement. - --> +

The child text content of a style element must be that of a + conformant style sheet.


-

The user agent must run the update a style block - algorithm that applies for the style sheet language specified by the style - element's type attribute, passing it the element's - style data, whenever one of the following conditions occur:

+

The user agent must run the update a style block algorithm whenever + one of the following conditions occur:

-

For styling languages that consist of pure text (as opposed to XML), a style - element's style data is the child text content of the style - element. For XML-based styling languages, the style data consists of all the child - nodes of the style element.

- -

The update a style block algorithm for CSS (text/css) is - as follows:

+

The update a style block algorithm is as follows:

    @@ -14937,15 +14895,25 @@ c-end = "-->" data-x="remove a CSS style sheet">remove the CSS style sheet in question.

  1. If element's root is neither a shadow root nor a - document, then abort these steps.

  2. + document, then return.

    +
  3. +

    If element's type attribute is present and + its value is neither the empty string nor an ASCII case-insensitive match for + "text/css", then return.

    + +

    In particular, a type value with + parameters, such as "text/css; charset=utf-8", will cause this algorithm + to return early.

    +
  4. +
  5. If the Should element's inline behavior be blocked by Content Security Policy? algorithm returns "Blocked" when executed upon the style element, "style", and the style - element's style data, then abort these steps.

  6. + element's child text content, then return.

  7. @@ -14954,7 +14922,7 @@ c-end = "-->"
    type
    -

    text/css

    +

    text/css

    owner node

    element

    @@ -14997,7 +14965,13 @@ c-end = "-->"

    Left at its default value.

    CSS rules
    -

    Left uninitialized.

    +
    +

    Left uninitialized.

    + +

    This doesn't seem right. Presumably we should be using the + element's child text content? Tracked as issue #2997.

    +
    @@ -15010,9 +14984,6 @@ c-end = "-->"
-

This specification does not define any other styling language's update a style block algorithm.

-

Once the attempts to obtain the style sheet's critical subresources, if any, are complete, or, if the style sheet has no critical subresources, once the style sheet @@ -15039,10 +15010,9 @@ c-end = "-->"

-

The media, nonce, and type IDL attributes must reflect the respective - content attributes of the same name.

+

The media and nonce IDL attributes must reflect the + respective content attributes of the same name.

@@ -24304,8 +24274,7 @@ interface HTMLHyperlinkElementUtils { link that contributes to the styling processing model. This keyword is body-ok.

-

The specified resource is a resource that describes how to present the document. Exactly how - the resource is to be processed depends on the actual type of the resource.

+

The specified resource is a CSS style sheet that describes how to present the document.

If the alternate keyword is also specified on the link element, then the link is an alternative stylesheet; in this case, @@ -24313,7 +24282,7 @@ interface HTMLHyperlinkElementUtils { element, with a non-empty value.

The default type for resources given by the stylesheet - keyword is text/css.

+ keyword is text/css.

@@ -24360,12 +24329,11 @@ interface HTMLHyperlinkElementUtils {

Quirk: If the document has been set to quirks mode, has the same origin as the URL of the external resource, and the Content-Type metadata of the external resource is not a - supported style sheet type, the user agent must instead assume it to be text/css.

+ supported style sheet type, the user agent must instead assume it to be text/css.

Once a resource has been obtained, if its Content-Type metadata is text/css, the user - agent must run these steps:

+ data-x="Content-Type">Content-Type metadata is text/css, then run these + steps:

When examining types to determine if they represent supported languages, user agents must not - ignore MIME parameters. Types are to be compared including all parameters.

+ ignore MIME parameters. Types are to be compared including all parameters.

-

For example, types that include the charset parameter will - not be recognized as referencing any of the scripting languages listed above.

+

For example, scripts with their type + attribute set to "text/javascript; charset=utf-8" will not be + evaluated.

@@ -113005,6 +112978,15 @@ if (s = prompt('What is your name?')) { data-x="">JavaScript", it has no effect), or replaced with use of the type attribute.

+

Authors should not specify a value for the type + attribute on script elements that is the empty string or an ASCII + case-insensitive match for a JavaScript MIME type. Instead, they should omit + the attribute, which has the same effect.

+ +

Authors should not specify a type attribute on a + style element. If the attribute is present, its value must be an ASCII + case-insensitive match for "text/css".

+

Authors should not specify the name attribute on a elements. If the attribute is present, its value must not be the empty string and must neither be equal to the value of any of the IDs in the @@ -113052,6 +113034,14 @@ if (s = prompt('What is your name?')) { data-x="attr-script-type">type attribute or there is and its value is an ASCII case-insensitive match for the string "text/javascript".

+
  • The presence of a type attribute on a + script element if its value is an ASCII case-insensitive match for a + JavaScript MIME type.

  • + +
  • The presence of a type attribute on a + style element if its value is an ASCII case-insensitive match for + "text/css".

  • +
  • The presence of a name attribute on an a element, if its value is not the empty string.

  • @@ -113292,6 +113282,10 @@ if (s = prompt('What is your name?')) {
    for on script elements

    Use DOM events mechanisms to register event listeners.

    +
    type on style elements (except as noted in the previous section)
    +

    Omit the attribute for CSS; for data blocks, use + script as the container instead of style.

    +
    datapagesize on table elements

    Unnecessary. Omit it altogether.

    @@ -114265,6 +114259,16 @@ interface HTMLFontElement : HTMLElement {
    +
    partial interface HTMLStyleElement {
    +  [CEReactions] attribute DOMString type;
    +};
    + +

    The type IDL attribute of the + style element must reflect the element's type content attribute.

    + +
    +
    partial interface HTMLScriptElement {
       [CEReactions] attribute DOMString event;
       [CEReactions] attribute DOMString htmlFor;
    @@ -116618,11 +116622,10 @@ interface External {
          metadata
          head;
              noscript*
    -     varies*
    +     text*
          globals;
              media;
    -         nonce;
    -         type
    +         nonce
          HTMLStyleElement
         
     
    @@ -118227,8 +118230,7 @@ interface External {
           type
           embed;
               object;
    -          source;
    -          style
    +          source
           Type of embedded resource
           Valid MIME type
         
    @@ -118249,7 +118251,7 @@ interface External {
           type
           script
           Type of script
    -      Valid MIME type; "module"
    +      "module"; a valid MIME type that is not a JavaScript MIME type
         
           typemustmatch
           object
    @@ -120077,9 +120079,6 @@ INSERT INTERFACES HERE
        
    [RFC2046]
    Multipurpose Internet Mail Extensions (MIME) Part Two: Media Types, N. Freed, N. Borenstein. IETF.
    -
    [RFC2318]
    -
    The text/css Media Type, H. Lie, B. Bos, C. Lilley. IETF.
    -
    [RFC2397]
    The "data" URL scheme, L. Masinter. IETF.