diff --git a/source b/source index 086c6097f7c..25fa2c620c0 100644 --- a/source +++ b/source @@ -3328,6 +3328,7 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
  • The attribute list concept
  • The data of a CharacterData node and its replace data algorithm
  • +
  • The target of a ProcessingInstruction node
  • The child text content of a node
  • The descendant text content of a node
  • The name, @@ -134768,6 +134769,58 @@ dictionary StorageEventInit : EventInit { <!-->.

    +

    Processing instructions

    + +

    A processing instruction marks a location in a document for further processing.

    + +
    +

    Processing instructions must have the following format:

    + +
      +
    1. "<?".
    2. + +
    3. A target.
    4. + +
    5. Zero or more ASCII whitespace. If there is to be data in the next step, there must be one or more ASCII + whitespace.
    6. + +
    7. Optionally, data.
    8. + +
    9. Optionally, U+003F (?).
    10. + +
    11. U+003E (>).
    12. +
    + +

    The target consists of ASCII alphanumeric and + U+002D (-) code points. It must start with an ASCII alpha and must not equal "xml" or "xml-stylesheet".

    + +

    The data is text, with the + additional restriction that the text must not contain U+003E (>), nor end with U+003F (?).

    +
    + +
    +

    Processing instructions in the HTML syntax have some notable differences to + processing instructions in XML:

    + + +
    + +
    @@ -134946,6 +134999,15 @@ dictionary StorageEventInit : EventInit { as-is except C1 control references that are replaced according to the numeric character reference end state.

    + + disallowed-processing-instruction-target + +

    This error occurs if the parser encounters a processing + instruction target that is "xml" or "xml-stylesheet". The preceding U+003F (?) and all content that follows up to + a U+003E (>) (if present) or to the end of the input stream is treated as a + comment.

    + duplicate-attribute

    This error occurs if the parser encounters an StorageEventInit : EventInit { data-x="syntax-doctype">DOCTYPE. In such a case, if the DOCTYPE is correctly placed as a document preamble, the parser sets the Document to quirks mode.

    + + eof-in-processing-instruction +

    This error occurs if the parser encounters the end of the input stream in a + processing instruction (e.g., <? or <?marker name=). Such processing + instructions are ignored.

    + eof-in-script-html-comment-like-text @@ -135040,11 +135109,20 @@ dictionary StorageEventInit : EventInit { and if the parser cannot change the mode flag is false, sets the Document to quirks mode.

    + + invalid-first-character-of-processing-instruction-target + +

    This error occurs if the parser encounters a code point that is not an + ASCII alpha where the first code point of a processing instruction target is expected. The preceding + U+003F (?) and all content that follows up to a U+003E (>) (if present) or to the end of the + input stream is treated as a comment.

    + invalid-first-character-of-tag-name

    This error occurs if the parser encounters a code point that is not an - ASCII alpha where first code point of a start + ASCII alpha where the first code point of a start tag name or an end tag name is expected. If a start tag was expected such code point and a preceding U+003C (<) is treated as text content, and all content that follows is treated as markup. Whereas, if an end tag was @@ -135065,6 +135143,15 @@ dictionary StorageEventInit : EventInit { alpha, a wide range of code points (including ASCII digits) is allowed in subsequent positions.

    + + invalid-processing-instruction-target + +

    This error occurs if the parser encounters a code point that is not an + ASCII alphanumeric or U+002D (-) where a processing instruction target is expected. The preceding + U+003F (?) and all content that follows up to a U+003E (>) (if present) or to the end of the + input stream is treated as a comment.

    + missing-attribute-value

    This error occurs if the parser encounters a U+003E (>) code point where an @@ -135320,29 +135407,6 @@ dictionary StorageEventInit : EventInit { input stream in certain positions. In general, such code points are either ignored or, for security reasons, replaced with a U+FFFD REPLACEMENT CHARACTER.

    - - unexpected-question-mark-instead-of-tag-name - -

    This error occurs if the parser encounters a U+003F (?) code point where first - code point of a start tag name is expected. The U+003F - (?) and all content that follows up to a U+003E (>) code point (if present) or to the end of - the input stream is treated as a comment.

    - -
    -

    For example, consider the following markup:

    - -
    <?xml-stylesheet type="text/css" href="style.css"?>
    - -

    This will be parsed into:

    - -
    • #comment: ?xml-stylesheet type="text/css" href="style.css"?
    • html
      • head
      • body
    -
    - -

    The common reason for this error is an XML processing instruction (e.g., <?xml-stylesheet type="text/css" href="style.css"?>) or an XML declaration - (e.g., <?xml version="1.0" encoding="UTF-8"?>) being used in - HTML.

    - unexpected-solidus-in-tag

    This error occurs if the parser encounters a U+002F (/) code point that is @@ -137040,6 +137104,16 @@ dictionary StorageEventInit : EventInit { character token otherwise.

    +
    +

    To convert the temporary buffer to a comment, create a comment token whose data is + the concatenation of "?" and the code + points in the temporary buffer, in the order they were + added to the buffer.

    + +

    This is used when a processing instruction is found to have an invalid target and + is instead treated as a bogus comment.

    +
    +

    Before each step of the tokenizer, the user agent must first check the parser pause flag. If it is true, then the tokenizer must abort the processing of @@ -137196,10 +137270,8 @@ dictionary StorageEventInit : EventInit { the tag name state.

    U+003F QUESTION MARK (?)
    -
    This is an unexpected-question-mark-instead-of-tag-name - parse error. Create a comment token whose data is the empty string. - Reconsume in the bogus comment state.
    +
    Set the temporary buffer to the empty string. Switch to + the processing instruction open state.
    EOF
    This is an eof-before-tag-name @@ -138266,7 +138338,7 @@ dictionary StorageEventInit : EventInit {
    Switch to the data state. Emit the current comment token.
    EOF
    -
    Emit the comment. Emit an end-of-file token.
    +
    Emit the current comment token. Emit an end-of-file token.
    U+0000 NULL
    This is an StorageEventInit : EventInit { an element in the HTML namespace, then switch to the CDATA section state. Otherwise, this is a cdata-in-html-content parse - error. Create a comment token whose data is the "[CDATA[" string. Switch to the - bogus comment state.
    + error. Create a comment token whose data is "[CDATA[". Switch to + the bogus comment state.
    Anything else
    This is an StorageEventInit : EventInit { +
    Processing instruction open state
    + +
    +

    Consume the next input character:

    + +
    +
    ASCII alpha
    +
    Reconsume in the processing instruction target state. + +
    EOF
    +
    This is an eof-in-processing-instruction + parse error. Emit an end-of-file token.
    + +
    Anything else
    +
    This is an invalid-first-character-of-processing-instruction-target + parse error. Convert the temporary buffer to a comment. + Reconsume in the bogus comment state.
    +
    +
    + + + +
    Processing instruction target state
    + +
    +

    Consume the next input character:

    + +
    +
    U+0009 CHARACTER TABULATION (tab)
    +
    U+000A LINE FEED (LF)
    +
    U+000C FORM FEED (FF)
    + +
    U+0020 SPACE
    +
    U+003F QUESTION MARK (?)
    +
    U+003E GREATER-THAN SIGN (>)
    +
    +

    Let target be the temporary buffer, + converted to ASCII lowercase.

    + +

    If target is "xml" or "xml-stylesheet":

    + +
      +
    1. This is a disallowed-processing-instruction-target + parse error.

    2. + +
    3. Convert the temporary buffer to a comment.

    4. + +
    5. Reconsume in the bogus comment state.

    6. +
    + +

    Otherwise:

    + +
      +
    1. Create a processing instruction token whose target is target and data is the + empty string.

    2. + +
    3. Reconsume in the after processing instruction target + state.

    4. +
    +
    + +
    ASCII alphanumeric
    +
    U+002D HYPHEN-MINUS (-)
    +
    Append the current input character to the temporary buffer.
    + +
    EOF
    +
    This is an eof-in-processing-instruction + parse error. Emit an end-of-file token.
    + +
    Anything else
    +
    This is an invalid-processing-instruction-target + parse error. Convert the temporary buffer to a comment. + Reconsume in the bogus comment state.
    +
    +
    + + + +
    After processing instruction target state
    + +
    +

    Consume the next input character:

    + +
    +
    U+0009 CHARACTER TABULATION (tab)
    +
    U+000A LINE FEED (LF)
    +
    U+000C FORM FEED (FF)
    + +
    U+0020 SPACE
    +
    Ignore the character.
    + +
    Anything else
    +
    Reconsume in the processing instruction data state.
    +
    +
    + + + +
    Processing instruction data state
    + +
    +

    Consume the next input character:

    + +
    +
    U+003F QUESTION MARK (?)
    +
    Switch to the processing instruction questionable state.
    + +
    U+003E GREATER-THAN SIGN (>)
    +
    Switch to the data state. Emit the current processing instruction token.
    + +
    EOF
    +
    This is an eof-in-processing-instruction + parse error. Emit an end-of-file token.
    + +
    Anything else
    +
    Append the current input character to the current processing instruction token's data.
    +
    +
    + + + +
    Processing instruction questionable state
    + +
    +

    Consume the next input character:

    + +
    +
    U+003E GREATER-THAN SIGN (>)
    +
    Switch to the data state. Emit the processing instruction token.
    + +
    EOF
    +
    This is an eof-in-processing-instruction + parse error. Emit an end-of-file token.
    + +
    Anything else
    +
    Append U+003F (?) to the current processing instruction token's data. Reconsume + in the processing instruction data state.
    +
    +
    + + +
    Character reference state
    @@ -140098,6 +140314,26 @@ document.body.appendChild(text);
    +
    +

    When the steps below require the user agent to insert a processing instruction while + processing a processing instruction token, the user agent must run the following steps:

    + +
      +
    1. Let target be the target given in the processing instruction token being + processed.

    2. + +
    3. Let data be the data given in the processing instruction token being + processed.

    4. + +
    5. Create a ProcessingInstruction node whose target is target, data is data, and node document is the + same as that of the node in which the adjusted insertion location finds itself.

      + +
    6. Insert the newly created node at the adjusted insertion location.

    7. +
    +
    +
    Parsing elements that contain only text
    @@ -140178,6 +140414,12 @@ document.body.appendChild(text);

    Insert a comment as the last child of the Document object.

    +
    A processing instruction token
    +
    +

    Insert a processing instruction as the last child of the Document + object.

    +
    +
    A DOCTYPE token

    If the DOCTYPE token's name is not "html", or the token's public @@ -140321,6 +140563,12 @@ document.body.appendChild(text);

    Insert a comment as the last child of the Document object.

    +
    A processing instruction token
    +
    +

    Insert a processing instruction as the last child of the Document + object.

    +
    +
    A character token that is one of U+0009 CHARACTER TABULATION, U+000A LINE FEED (LF), U+000C FORM FEED (FF), U+000D CARRIAGE RETURN (CR), or U+0020 SPACE
    @@ -140385,6 +140633,11 @@ document.body.appendChild(text);

    Insert a comment.

    +
    A processing instruction token
    +
    +

    Insert a processing instruction.

    +
    +
    A DOCTYPE token

    Parse error. Ignore the token.

    @@ -140457,6 +140710,11 @@ document.body.appendChild(text);

    Insert a comment.

    +
    A processing instruction token
    +
    +

    Insert a processing instruction.

    +
    +
    A DOCTYPE token

    Parse error. Ignore the token.

    @@ -140861,6 +141119,11 @@ document.body.appendChild(text);

    Insert a comment.

    +
    A processing instruction token
    +
    +

    Insert a processing instruction.

    +
    +
    A DOCTYPE token

    Parse error. Ignore the token.

    @@ -140984,6 +141247,11 @@ document.body.appendChild(text);

    Insert a comment.

    +
    A processing instruction token
    +
    +

    Insert a processing instruction.

    +
    +
    A DOCTYPE token

    Parse error. Ignore the token.

    @@ -142345,6 +142613,11 @@ document.body.appendChild(text);

    Insert a comment.

    +
    A processing instruction token
    +
    +

    Insert a processing instruction.

    +
    +
    A DOCTYPE token

    Parse error. Ignore the token.

    @@ -142672,6 +142945,11 @@ document.body.appendChild(text);

    Insert a comment.

    +
    A processing instruction token
    +
    +

    Insert a processing instruction.

    +
    +
    A DOCTYPE token

    Parse error. Ignore the token.

    @@ -142986,7 +143264,7 @@ document.body.appendChild(text);
    A start tag whose tag name is one of: "caption", "col", "colgroup", "tbody", "td", "tfoot", "th", "thead", "tr"
    -

    Assert: The stack of open elements has a td or th element in table scope.