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
CharacterData node and its
replace data algorithmProcessingInstruction nodeA processing instruction marks a location in a document for further processing.
+ +Processing instructions must have the following format:
+ +<?".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:
+ +In HTML, a processing instruction can end with ">" or
+ "?>", while in XML it can only end with
+ "?>". This is for compatibility with previously specified behavior of
+ the "<?" syntax, which was treated as a bogus comment, ending with
+ ">".
In HTML, "<?xml ...?>" and
+ "<?xml-stylesheet ...?>" specifically are not parsed as processing
+ instructions but instead treated as bogus comments.
+ This is for compatibility with existing HTML content, where such syntax is relatively
+ common.
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.
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.
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.
Document
to quirks mode.
+ 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.
+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.
+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.
+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.
-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"?htmlheadbodyThe 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.
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.
[CDATA[". Switch to
+ the bogus comment state.
Consume the next input character:
+ +Consume the next input character:
+ +Let target be the temporary buffer, + converted to ASCII lowercase.
+ +If target is "xml" or "xml-stylesheet":
This is a disallowed-processing-instruction-target + parse error.
Convert the temporary buffer to a comment.
Reconsume in the bogus comment state.
Otherwise:
+ +Create a processing instruction token whose target is target and data is the + empty string.
Reconsume in the after processing instruction target + state.
Consume the next input character:
+ +Consume the next input character:
+ +Consume the next input character:
+ +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:
+ +Let target be the target given in the processing instruction token being + processed.
Let data be the data given in the processing instruction token being + processed.
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.
Insert the newly created node at the adjusted insertion location.
Insert a comment as the last child of the Document object.
Insert a processing instruction as the last child of the Document
+ object.
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.
Insert a processing instruction as the last child of the Document
+ object.
Insert a comment.
Insert a processing instruction.
+Parse error. Ignore the token.
@@ -140457,6 +140710,11 @@ document.body.appendChild(text);Insert a comment.
Insert a processing instruction.
+Parse error. Ignore the token.
@@ -140861,6 +141119,11 @@ document.body.appendChild(text);Insert a comment.
Insert a processing instruction.
+Parse error. Ignore the token.
@@ -140984,6 +141247,11 @@ document.body.appendChild(text);Insert a comment.
Insert a processing instruction.
+Parse error. Ignore the token.
@@ -142345,6 +142613,11 @@ document.body.appendChild(text);Insert a comment.
Insert a processing instruction.
+Parse error. Ignore the token.
@@ -142672,6 +142945,11 @@ document.body.appendChild(text);Insert a comment.
Insert a processing instruction.
+Parse error. Ignore the token.
@@ -142986,7 +143264,7 @@ document.body.appendChild(text);Assert: The stack of open elements has a td or th element in table scope.