12. ~HTMLの構文

注記: この節は、`~HTML~MIME型$とされた資源に対する規則のみを述べる。 ~XML資源に対する規則は、 ~XML構文~節 にて論じられる。 ◎ This section only describes the rules for resources labeled with an HTML MIME type. Rules for XML resources are discussed in the section below entitled "The XML syntax".

【この訳に固有の表記規約】

この訳の,~algoや定義の記述に利用されている各種記号( ~LET, 此れ, ~IF, ~THROW, 等々)の意味や定義の詳細は、~SYMBOL_DEF_REFを~~参照されたし。

用語 `文書@ は `Document$I ~objの略記として用いられるが、構文解析の文脈においては、特に指定されない限り,当の`~HTML構文解析器$に結付けられているそれを指す(この頁に現れるほとんどのそれが該当する)。 ~algoの中で宣言されずに現れる %構文解析器 は、この,`~HTML構文解析器$の~instanceを指す。

“%s ~APPEND %a ~APPEND %b ~APPEND …” という表記は、 文字列 %s の末尾に後続の[ 文字/文字列 ] %a, %b, … を示された順に付加する演算を表す。

12.1. ~HTML文書の書き方

【 この節の内容は、別ページにて。 】

12.2. ~HTML文書の構文解析-法

この節が適用されるのは、[ ~UA, ~data集析~tool, 適合性~検査器 ]に限られる。 ◎ This section only applies to user agents, data mining tools, and conformance checkers.

注記: ~XML文書を構文解析して~DOM木にするための規則は、次~節の`~XML構文$が受持つ。 ◎ The rules for parsing XML documents into DOM trees are covered by the next section, entitled "The XML syntax".

~UAは、 `text/html$mt 資源から~DOM木を生成するときは,この節に述べる構文解析~規則を利用し~MUST。 これらの規則は,~~同時に `~HTML構文解析器@ と称されるものも定義する。 ◎ User agents must use the parsing rules described in this section to generate the DOM trees from text/html resources. Together, these rules define what is referred to as the HTML parser.

注記: この仕様に述べる~HTML構文は、~SGMLや~XMLに近い類似性を~~保ち続けてはいるが,自前の構文解析~規則を備える別々の言語である。 ◎ While the HTML syntax described in this specification bears a close resemblance to SGML and XML, it is a separate language with its own parsing rules.

~HTMLの早期の~versionのうち一部(特に HTML2 〜 HTML4)は、~SGMLに基づいていたため,~SGML構文解析~規則を利用していた。 しかしながら、~HTML文書に対し真の~SGML構文解析を実装したことがある~web~browserは,(あっても)少数に限られている。 歴史的に,~HTMLを厳格に~SGML~appとして取扱っていた~UAは、検証器に限られる。 その結果、検証器が主張していた 文書が持つべきとされる表現と,広く配備された~Web~browserが相互運用可能に実装していた表現とが異なっていたことによる混同は、何十年もの間,生産性を浪費していた。 したがって,この~versionの~HTMLでは、戻って,非~SGMLを基礎に置く。 ◎ Some earlier versions of HTML (in particular from HTML2 to HTML4) were based on SGML and used SGML parsing rules. However, few (if any) web browsers ever implemented true SGML parsing for HTML documents; the only user agents to strictly handle HTML as an SGML application have historically been validators. The resulting confusion — with validators claiming documents to have one representation while widely deployed Web browsers interoperably implemented a different representation — has wasted decades of productivity. This version of HTML thus returns to a non-SGML basis.

~SGML~toolを著作~pipelineに利用することに関心がある作者には、~XML~toolと~XML直列化による~HTMLを利用することが奨励される。 ◎ Authors interested in using SGML tools in their authoring pipeline are encouraged to use XML tools and the XML serialization of HTML.

適合性~検査器の目的においては、`~HTML構文$であると決定された資源は,`~HTML文書$とされる。 ◎ For the purposes of conformance checkers, if a resource is determined to be in the HTML syntax, then it is an HTML document.

注記: ~XMLとの互換性 節にて言明したように、名前空間を明示的に指定していない`要素~型$への参照は、常に`~HTML名前空間$に属する要素を指す。 例えば,仕様にて “`menu$e 要素” と記された所では、その要素の 局所~名は `menu^l, 名前空間は `http://www.w3.org/1999/xhtml^l, ~interfaceは `HTMLMenuElement$I になる。 可能な所では、そのような要素への参照には,その定義への~hyperlinkが付与される。 ◎ As stated in the terminology section, references to element types that do not explicitly specify a namespace always refer to elements in the HTML namespace. For example, if the spec talks about "a menu element", then that is an element with the local name "menu", the namespace "http://www.w3.org/1999/xhtml", and the interface HTMLMenuElement. Where possible, references to such elements are hyperlinked to their definition.

12.2.1. 構文解析~modelの概観

~network
~byte~stream~復号器
入力~stream前処理器
~tokenizer
木~構築
~script実行
document.write()
~DOM

~HTML構文解析~処理-の入力は,一連の`~cp$からなる~streamであり、`~token化~段階$, `木~構築~段階$を順に通過し、その出力は`文書$になる。 ◎ The input to the HTML parsing process consists of a stream of code points, which is passed through a tokenization stage followed by a tree construction stage. The output is a Document object.

注記: 実装は、`~scriptingを~supportしない$ならば`文書$を実際に作成する必要はないが、そのような事例であっても依然として,~DOM木は,この仕様の残りの部分のための~modelとして利用される。 ◎ Implementations that do not support scripting do not have to actually create a DOM Document object, but the DOM tree in such cases is still used as the model for the rest of the specification.

~token化~段階で取扱われる~dataは、共通的な事例では~networkから来るが,~UA内で走っている ~scriptから — 例えば `document.write()$m ~APIを利用して — 来ることもある。 ◎ In the common case, the data handled by the tokenization stage comes from the network, but it can also come from script running in the user agent, e.g. using the document.write() API.

~tokenizer段階も, 木~構築~段階も,とり得る状態の集合は 1 つだけであるが、木~構築~段階は再入的である — すなわち,木~構築~段階が ある~tokenを取扱っている間に、~tokenizerが再開され,その~tokenの処理が完了する前に別の~tokenを更に発して処理させることもある。 ◎ There is only one set of states for the tokenizer stage and the tree construction stage, but the tree construction stage is reentrant, meaning that while the tree construction stage is handling one token, the tokenizer might be resumed, causing further tokens to be emitted and processed before the first token's processing is complete.

次の例では、 `script^l 終了tag~tokenを取扱っている間に、 `p^l 開始tag~tokenを取扱うため,木~構築~段階が~callされることになる: ◎ In the following example, the tree construction stage will be called upon to handle a "p" start tag token while handling the "script" end tag token:

...
<script>

document.write('<p>');
</script>
...

これらの事例を取扱うため、各 構文解析器は,次のものを持つ:

`~script入子~level@
初期~時には 0 に設定され~MUST。
`静止~flag@
初期~時には ~F に設定され~MUST。
◎ To handle these cases, parsers have a script nesting level, which must be initially set to zero, and a parser pause flag, which must be initially set to false.

12.2.2. ~perror

この仕様は、~HTML文書に対する構文解析~規則, および それが構文的に正しいか否かを定義する。 構文解析~algoにおける一定の箇所では、`~perror$と記される。 ~perrorによる~errorの取扱いは,きちんと定義されるが(処理~規則は,この仕様~全体を通して述べる)、~UAは,~HTML文書を構文解析している間に遭遇した`~perror$のうち,この仕様に述べる規則を適用したいと望まない最初の所で`構文解析器を中止-$しても~MAY。 ◎ This specification defines the parsing rules for HTML documents, whether they are syntactically correct or not. Certain points in the parsing algorithm are said to be parse errors. The error handling for parse errors is well-defined (that's the processing rules described throughout this specification), but user agents, while parsing an HTML document, may abort the parser at the first parse error that they encounter for which they do not wish to apply the rules described in this specification.

適合性~検査器は、文書~内に~perrorを生じさせる条件が:

  • 存在しない場合、利用者に~perrorを報告しては~MUST_NOT。
  • 存在する場合、それらのうち 1 個~以上は利用者に報告し~MUST。
  • 複数個~存在する場合、それらのうち 2 個~以上を利用者に報告して~MAY。
◎ Conformance checkers must report at least one parse error condition to the user if one or more parse error conditions exist in the document and must not report parse error conditions if none exist in the document. Conformance checkers may report more than one parse error condition if more than one parse error condition exists in the document.

注記: ~perrorは、~HTML構文に限られる~errorである。 適合性~検査器は、~perrorを検査することに加え,[ 文書は,この仕様に述べる他のすべての適合性~要件を順守するかどうか ]も検証yすることになる。 ◎ Parse errors are only errors with the syntax of HTML. In addition to checking for parse errors, conformance checkers will also verify that the document obeys all the other conformance requirements described in this specification.

一部の~perrorには、以下に概説される専用の~codeがある — 適合性~検査器は,報告-内にそれらを利用するべきである。 ◎ Some parse errors have dedicated codes outlined in the table below that should be used by conformance checkers in reports.

以下の~listにおける~errorの記述は、規範的でない — 各~errorにおいては:

  • “誘因” と記される項目に、構文解析器がどこで何に遭遇したとき,当の~errorが生じるかを述べる。
  • “例” と記される項目に、当の~errorを生じさせる~code例を示す。
  • “処置” と記される項目に、遭遇した~errorを構文解析器がどう取扱うかを述べる。

【 これらの項目名の付与は、この訳による。 それに伴い、これらの~errorは — 原文では~table~markupで与えられているが — ~listによる~markupで与えることにする。 】

◎ Error descriptions in the table below are non-normative. ◎ Code | Description
`abrupt-closing-of-empty-comment@pE
誘因: 中途で `003E^U で閉じられた空`~comment$に遭遇した。 ◎ This error occurs if the parser encounters an empty comment that is abruptly closed by a U+003E (>) code point\
例: `<!-->^c / `<!--->^c (これら以外にない) ◎ (i.e., <!--> or <!--->).\
処置: 当の~commentは正しく閉じられたかのように挙動する。 ◎ The parser behaves as if the comment is closed correctly.
`abrupt-doctype-public-identifier@pE
誘因: `~DOCTYPE$の~publicID内で `003E^U に遭遇した。 ◎ This error occurs if the parser encounters a U+003E (>) code point in the DOCTYPE public identifier\
例: `<!DOCTYPE html PUBLIC "foo>^c ◎ (e.g., <!DOCTYPE html PUBLIC "foo>).\
処置: ~DOCTYPEが文書の前置きとして正しく設置されているならば、[ `文書$の`~mode$doc ~SET `quirks^l ]にする。 ◎ In such a case, if the DOCTYPE is correctly placed as a document preamble, the parser sets the Document to quirks mode.
`abrupt-doctype-system-identifier@pE
誘因: `~DOCTYPE$の~systemID内で `003E^U に遭遇した ◎ This error occurs if the parser encounters a U+003E (>) code point in the DOCTYPE system identifier\
例: `<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "foo>^c ◎ (e.g., <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "foo>).\
処置: ~DOCTYPEが文書の前置きとして正しく設置されているならば、[ `文書$の`~mode$doc ~SET `quirks^l ]にする。 ◎ In such a case, if the DOCTYPE is correctly placed as a document preamble, the parser sets the Document to quirks mode.
`absence-of-digits-in-numeric-character-reference@pE
誘因: 数字を包含しない,数的な`文字~参照$に遭遇した。 ◎ This error occurs if the parser encounters a numeric character reference that doesn't contain any digits\
例: `&#qux;^c ◎ (e.g., &#qux;).\
処置: そのような文字~参照は、解決しない。 ◎ In this case the parser doesn't resolve the character reference.
`cdata-in-html-content@pE
誘因: 外来~内容(~SVG/~MathML)の外側で,`~CDATAsec$に遭遇した。 ◎ This error occurs if the parser encounters a CDATA section outside of foreign content (SVG or MathML).\
処置: そのような~CDATAsecは、~commentとして扱う(頭部の `[CDATA[^l と尾部の `]]^l も含めて)。 ◎ The parser treats such CDATA sections (including leading "[CDATA[" and trailing "]]" strings) as comments.
`character-reference-outside-unicode-range@pE
誘因: 妥当な~Unicode範囲を超える`~cp$を参照する,数的な`文字~参照$に遭遇した。 ◎ This error occurs if the parser encounters a numeric character reference that references a code point that is greater than the valid Unicode range.\
処置: そのような文字~参照は、 `FFFD^U に解決する。 ◎ The parser resolves such a character reference to a U+FFFD REPLACEMENT CHARACTER.
`control-character-in-input-stream@pE
誘因: `入力~stream$は、次の`~cp$を包含している ⇒ [ `~ASCII空白$/ `0000^U ]以外の`制御文字$ ◎ This error occurs if the input stream contains a control code point that is not ASCII whitespace or U+0000 NULL.\
処置: そのような`~cp$は,そのままに構文解析され、通例的には — すなわち、構文解析~規則が他に制約を適用しない所では — ~DOMに流し込まれる。 ◎ Such code points are parsed as-is and usually, where parsing rules don't apply any additional restrictions, make their way into the DOM.
`control-character-reference@pE
誘因: 次の`~cp$を参照する,数的な`文字~参照$に遭遇した ⇒ [ `~ASCII空白$ / `000D^U / `0000^U ]以外の`制御文字$ ◎ This error occurs if the parser encounters a numeric character reference that references a control code point that is not ASCII whitespace, a U+000D CARRIAGE RETURN, or U+0000 NULL.\
処置: そのような文字~参照は、そのままに解決する — `数的な文字~参照~終端$stに則って置換されるような~C1制御文字~参照を除いて。 ◎ The parser resolves such character references as-is except C1 control references that are replaced according to the numeric character reference end state.
`end-tag-with-attributes@pE
誘因: `属性$を伴う`終了tag$に遭遇した。 ◎ This error occurs if the parser encounters an end tag with attributes.\
処置: 終了tag内の属性は、完全に無視される — ~DOMに流し込まれることはない。 ◎ Attributes in end tags are completely ignored and do not make their way into the DOM.
`duplicate-attribute@pE
誘因: 同じ~tag内にすでにある属性と同じ名前の`属性$に遭遇した。 ◎ This error occurs if the parser encounters an attribute in a tag that already has an attribute with the same name.\
処置: そのような重複する属性は、無視する。 ◎ The parser ignores all such duplicate occurrences of the attribute.
`end-tag-with-trailing-solidus@pE
誘因: `終了tag$を閉じる `003E^U が期待される所で, `002F^U に遭遇した。 ◎ This error occurs if the parser encounters an end tag that has a U+002F (/) code point right before the closing U+003E (>) code point\
例: `</div/>^c ◎ (e.g., </div/>).\
処置: そのような~tagは、定例の終了tagとして扱う。 ◎ Such a tag is treated as a regular end tag.
`eof-before-tag-name@pE
誘因: ~tag名が期待される所で,`入力~stream$の終端に遭遇した。 ◎ This error occurs if the parser encounters the end of the input stream where a tag name is expected.\
処置: ~tagの始まり(すなわち, `開始tag$に対しては `<^l / `終了tag$に対しては `</^l )を~text内容として扱う。 ◎ In this case the parser treats the beginning of a start tag (i.e., <) or an end tag (i.e., </) as text content.
`eof-in-cdata@pE
誘因: `~CDATAsec$内で,`入力~stream$の終端に遭遇した。 ◎ This error occurs if the parser encounters the end of the input stream in a CDATA section.\
処置: そのような~CDATAsecは、入力~streamの終端の直前で閉じられたかのように扱う。 ◎ The parser treats such CDATA sections as if they are closed immediately before the end of the input stream.
`eof-in-comment@pE
誘因: `~comment$内で,`入力~stream$の終端に遭遇した。 ◎ This error occurs if the parser encounters the end of the input stream in a comment.\
処置: そのような~commentは、入力~streamの終端の直前で閉じられたかのように扱う。 ◎ The parser treats such comments as if they are closed immediately before the end of the input stream.
`eof-in-doctype@pE
誘因: `~DOCTYPE$内で,入力~streamの終端に遭遇した。 ◎ This error occurs if the parser encounters the end of the input stream in a DOCTYPE.\
処置: ~DOCTYPEが文書の前置きとして正しく設置されているならば、[ `文書$の`~mode$doc ~SET `quirks^l ]にする。 ◎ In such a case, if the DOCTYPE is correctly placed as a document preamble, the parser sets the Document to quirks mode.
`eof-in-script-html-comment-like-text@pE
誘因: `script$e 要素~内容の内側の`~comment$を真似る~text内で,`入力~stream$の終端に遭遇した。 ◎ This error occurs if the parser encounters the end of the input stream in text that resembles an HTML comment inside script element content\
例: `<script><!-- foo^c ◎ (e.g., <script><!-- foo).
処置: 【次の注記。】
注記: `script$e 要素~内の~HTML~commentを真似る構文的~構造は、~text内容として構文解析される。 それらは[ ~script用~言語に特有の構文的~構造の一部を成す/ ~HTML似の~commentとして扱われる ]こともある — ~script用~言語がそれらを~supportするならば(例:~HTML似の~comment用の構文解析~規則は、~JS仕様の Annex B にて見出せる)。 この~errorを生じさせる共通的な理由は、 `script^e 要素の内容に課される制約 に対する違反である。 `JAVASCRIPT$r ◎ Syntactic structures that resemble HTML comments in script elements are parsed as text content. They can be a part of a scripting language-specific syntactic structure or be treated as an HTML-like comment, if the scripting language supports them (e.g., parsing rules for HTML-like comments can be found in Annex B of the JavaScript specification). The common reason for this error is a violation of the restrictions for contents of script elements. [JAVASCRIPT]
`eof-in-tag@pE
誘因: [ `開始tag$/`終了tag$ ]内で,`入力~stream$の終端に遭遇した。 ◎ This error occurs if the parser encounters the end of the input stream in a start tag or an end tag\
例: `<div id=^c ◎ (e.g., <div id=).\
処置: そのような~tagは、完全に無視する。 ◎ Such a tag is completely ignored.
`incorrectly-closed-comment@pE
誘因: `--!>^l `~cp$列により閉じられた`~comment$に遭遇した。 ◎ This error occurs if the parser encounters a comment that is closed by the "--!>" code point sequence.\
処置: そのような~commentは、 `-->^l ~cp列により正しく閉じられたかのように扱う。 ◎ The parser treats such comments as if they are correctly closed by the "-->" code point sequence.
`incorrectly-opened-comment@pE
誘因: 次のいずれも満たさない`~cp$列 `<!^l に遭遇した:
  • 直後に 2 個の `002D^U が続く
  • `~DOCTYPE$を開始させる
  • `~CDATAsec$を開始させる
◎ This error occurs if the parser encounters the "<!" code point sequence that is not immidiately followed by two U+002D (-) code points and that is not the start of a DOCTYPE or a CDATA section.\
処置: そのような~cp列に後続する[ 最初の `003E^U (無ければ `入力~stream$の終端) ]までのすべての内容を,~commentとして扱う。 ◎ All content that follows the "<!" code point sequence up to a U+003E (>) code point (if present) or to the end of the input stream is treated as a comment.
注記: 例えば,~HTML内で~XML~markup宣言(例: `<!ELEMENT br EMPTY>^c )を利用した場合、この~errorが生じる。 ◎ One possible cause of this error is using an XML markup declaration (e.g., <!ELEMENT br EMPTY>) in HTML.
`invalid-character-sequence-after-doctype-name@pE
誘因: `~DOCTYPE$ の名前の後にて,[ `PUBLIC^l / `SYSTEM^l ]~keyword以外の`~cp$列に遭遇した。 ◎ This error occurs if the parser encounters any code point sequence other than "PUBLIC" and "SYSTEM" keywords after a DOCTYPE name.\
処置: 後続する[ ~publicID/~systemID ]は無視した上で、~DOCTYPEが文書の前置きとして正しく設置されているならば,[ `文書$の`~mode$doc ~SET `quirks^l ]にする。 ◎ In such a case, the parser ignores any following public or system identifiers, and if the DOCTYPE is correctly placed as a document preamble, sets the Document to quirks mode.
`invalid-first-character-of-tag-name@pE
誘因: [ `開始tag$/`終了tag$ ]の名前の最初の~cpが期待される所で,`~ASCII英字$でない`~cp$に遭遇した。 ◎ This error occurs if the parser encounters a code point that is not an ASCII alpha where first code point of a start tag name or an end tag name is expected.\
処置: 開始tagに対しては、名前に先行する `003C^U を~text内容として扱い,後続する内容は~markupとして扱う。 終了tagに対しては、そのような~cpから[ それに後続する最初の `003E^U (無ければ `入力~stream$の終端) ]までのすべての内容を,~commentとして扱う。 ◎ 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 expected, such code point 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.

例えば次の~markupを考える: ◎ For example, consider the following markup:

<42></42>

これは、次のように構文解析されることになる: ◎ This will be parsed into:

  • `html$e
    • `head$e
    • `body$e
      • `#text$: <42>
      • `#comment$: 42
注記: ~tag名の最初の~cpは,`~ASCII英字$に制限される一方、後続の~cpには(`~ASCII数字$を含め)広~範囲の~cpが許容される。 ◎ While the first code point of a tag name is limited to an ASCII alpha, a wide range of code points (including ASCII digits) is allowed in subsequent positions.
`missing-attribute-value@pE
誘因: `属性$値が期待される所で,`003E^U に遭遇した。 ◎ This error occurs if the parser encounters a U+003E (>) code point where an attribute value is expected\
例: `<div id=>^c ◎ (e.g., <div id=>).
処置: そのような属性の値は、空であるものと扱う。 ◎ The parser treats the attribute as having an empty value.
`missing-doctype-name@pE
誘因: 名前のない`~DOCTYPE$に遭遇した。 ◎ This error occurs if the parser encounters a DOCTYPE that is missing a name\
例: `<!DOCTYPE>^c ◎ (e.g., <!DOCTYPE>).\
処置: ~DOCTYPEが文書の前置きとして正しく設置されているならば、[ `文書$の`~mode$doc ~SET `quirks^l ]にする。 ◎ In such a case, if the DOCTYPE is correctly placed as a document preamble, the parser sets the Document to quirks mode.
`missing-doctype-public-identifier@pE
誘因: `~DOCTYPE$ ~publicIDの開始-が期待される所で, `003E^U に遭遇した。 ◎ This error occurs if the parser encounters a U+003E (>) code point where start of the DOCTYPE public identifier is expected\
例: `<!DOCTYPE html PUBLIC >^c ◎ (e.g., <!DOCTYPE html PUBLIC >).\
処置: ~DOCTYPEが文書の前置きとして正しく設置されているならば、[ `文書$の`~mode$doc ~SET `quirks^l ]にする。 ◎ In such a case, if the DOCTYPE is correctly placed as a document preamble, the parser sets the Document to quirks mode.
`missing-doctype-system-identifier@pE
誘因: `~DOCTYPE$ ~systemIDの開始-が期待される所で, `003E^U に遭遇した。 ◎ This error occurs if the parser encounters a U+003E (>) code point where start of the DOCTYPE system identifier is expected\
例: `<!DOCTYPE html SYSTEM >^c ◎ (e.g., <!DOCTYPE html SYSTEM >).\
処置: ~DOCTYPEが文書の前置きとして正しく設置されているならば、[ `文書$の`~mode$doc ~SET `quirks^l ]にする。 ◎ In such a case, if the DOCTYPE is correctly placed as a document preamble, the parser sets the Document to quirks mode.
`missing-end-tag-name@pE
誘因: `終了tag$の名前が期待される所で, `003E^U に遭遇した。 ◎ This error occurs if the parser encounters a U+003E (>) code point where an end tag name is expected,\
例: `</>^c (これ以外にない) ◎ i.e., </>.\
処置: ~cp列 `</>^l 全体を、完全に無視する。 ◎ The parser completely ignores whole "</>" code point sequence.
`missing-quote-before-doctype-public-identifier@pE
誘因: 引用符が先行していない `~DOCTYPE$ ~publicIDに遭遇した。 ◎ This error occurs if the parser encounters the DOCTYPE public identifier that is not preceded by a quote\
例: `<!DOCTYPE html PUBLIC -//W3C//DTD HTML 4.01//EN">^c ◎ (e.g., <!DOCTYPE html PUBLIC -//W3C//DTD HTML 4.01//EN">).\
処置: そのような~publicIDは無視した上で、~DOCTYPEが文書の前置きとして正しく設置されているならば,[ `文書$の`~mode$doc ~SET `quirks^l ]にする。 ◎ In such a case, the parser ignores the public identifier, and if the DOCTYPE is correctly placed as a document preamble, sets the Document to quirks mode.
`missing-quote-before-doctype-system-identifier@pE
誘因: 引用符が先行していない `~DOCTYPE$ ~systemIDに遭遇した。 ◎ This error occurs if the parser encounters the DOCTYPE system identifier that is not preceded by a quote\
例: `<!DOCTYPE html SYSTEM http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">^c ◎ (e.g., <!DOCTYPE html SYSTEM http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">).\
処置: そのような~systemIDは無視した上で、~DOCTYPEが文書の前置きとして正しく設置されているならば,[ `文書$の`~mode$doc ~SET `quirks^l ]にする。 ◎ In such a case, the parser ignores the system identifier, and if the DOCTYPE is correctly placed as a document preamble, sets the Document to quirks mode.
`missing-semicolon-after-character-reference@pE
誘因: `003B^U で終了されない`文字~参照$に遭遇した。 ◎ This error occurs if the parser encounters a character reference that is not terminated by a U+003B (;) code point.\
処置: 通例的には、文字~参照は `003B^U で終了されたかのように挙動する。 しかしながら,多義的になる事例もあり、そこでは,後続の~cpを文字~参照~内に含める。 ◎ Usually the parser behaves as if character reference is terminated by the U+003B (;) code point; however, there are some ambiguous cases in which the parser includes subsequent code points in the character reference.
例えば `&not;in^c は `¬in^l に構文解析されることになる一方で `&notin^c は `∉^l に構文解析されることになる。 ◎ For example, &not;in will be parsed as "¬in" whereas &notin will be parsed as "∉".
`missing-whitespace-after-doctype-public-keyword@pE
誘因: `~DOCTYPE$における `PUBLIC^l ~keywordの後に,`~ASCII空白$で分離されていない~publicIDに遭遇した。 ◎ This error occurs if the parser encounters a DOCTYPE whose "PUBLIC" keyword and public identifier are not separated by ASCII whitespace.\
処置: ~ASCII空白が在るかのように挙動する。 ◎ In this case the parser behaves as if ASCII whitespace is present.
`missing-whitespace-after-doctype-system-keyword@pE
誘因: `~DOCTYPE$における `SYSTEM^l ~keywordの後に,`~ASCII空白$で分離されていない~systemIDに遭遇した。 ◎ This error occurs if the parser encounters a DOCTYPE whose "SYSTEM" keyword and system identifier are not separated by ASCII whitespace.\
処置: ~ASCII空白が在るかのように挙動する。 ◎ In this case the parser behaves as if ASCII whitespace is present.
`missing-whitespace-before-doctype-name@pE
誘因: `~DOCTYPE$における `DOCTYPE^l ~keywordの後に,`~ASCII空白$で分離されていない名前に遭遇した。 ◎ This error occurs if the parser encounters a DOCTYPE whose "DOCTYPE" keyword and name are not separated by ASCII whitespace.\
処置: ~ASCII空白が在るかのように挙動する。 ◎ In this case the parser behaves as if ASCII whitespace is present.
`missing-whitespace-between-attributes@pE
誘因: `~ASCII空白$で分離されてない`属性$たちに遭遇した。 ◎ This error occurs if the parser encounters attributes that are not separated by ASCII whitespace\
例: `<div id="foo"class="bar">^c ◎ (e.g., <div id="foo"class="bar">).\
処置: ~ASCII空白が在るかのように挙動する。 ◎ In this case the parser behaves as if ASCII whitespace is present.
`missing-whitespace-between-doctype-public-and-system-identifiers@pE
誘因: `~DOCTYPE$において,`~ASCII空白$で分離されてない~publicIDと~systemIDに遭遇した。 ◎ This error occurs if the parser encounters a DOCTYPE whose public and system identifiers are not separated by ASCII whitespace.\
処置: ~ASCII空白が在るかのように挙動する。 ◎ In this case the parser behaves as if ASCII whitespace is present.
`nested-comment@pE
誘因: 入子の`~comment$に遭遇した。 ◎ This error occurs if the parser encounters a nested comment\
例: `<!-- <!-- 入子の~comment --> -->^c ◎ (e.g., <!-- <!-- nested --> -->).\
処置: そのような~commentは,最初に生じた `-->^l `~cp$列で閉じる — 後続するものは、何であれ~markupとして扱われることになる。 ◎ Such a comment will be closed by the first occuring "-->" code point sequence and everything that follows will be treated as markup.
`noncharacter-character-reference@pE
誘因: `非文字$を参照する,数的な`文字~参照$に遭遇した。 ◎ This error occurs if the parser encounters a numeric character reference that references a noncharacter.\
処置: そのような文字~参照は、そのままに解決する。 ◎ The parser resolves such character references as-is.
`noncharacter-in-input-stream@pE
誘因: `入力~stream$が`非文字$を包含している。 ◎ This error occurs if the input stream contains a noncharacter.\
処置: そのような`~cp$は,そのままに構文解析され、通例的には — すなわち、構文解析~規則が他に制約を適用しない所では — ~DOMに流し込まれる。 ◎ Such code points are parsed as-is and usually, where parsing rules don't apply any additional restrictions, make their way into the DOM.
`non-void-html-element-start-tag-with-trailing-solidus@pE
誘因:[ 次のいずれにも該当しない要素 ]の`開始tag$を閉じる `003E^U の直前にて, `002F^U に遭遇した ⇒ `~void要素$/ 外来~内容の一部である要素(すなわち,~SVG/~MathML要素) ◎ This error occurs if the parser encounters a start tag for an element that is not in the list of void elements or is not a part of foreign content (i.e., not an SVG or MathML element) that has a U+002F (/) code point right before the closing U+003E (>) code point.\
処置: この `002F^U は無かったかのように挙動する。 ◎ The parser behaves as if the U+002F (/) is not present.

例えば次の~markupを考える: ◎ For example, consider the following markup:

<div/><span></span><span></span>

これは、次のように構文解析されることになる: ◎ This will be parsed into:

  • `html$e
    • `head$e
    • `body$e
      • `div$e
        • `span$e
        • `span$e
注記: 開始tagの名前~内の尾部に `002F^U を利用できるのは 自己閉じ~tagを指定する外来~内容~内に限られる。 (~HTMLには自己閉じ~tagは存在しない。) それは,`~void要素$にも許容されるが、この事例では,何ら効果はない。 ◎ The trailing U+002F (/) in a start tag name can be used only in foreign content to specify self-closing tags. (Self-closing tags don't exist in HTML.) It is also allowed for void elements, but doesn't have any effect in this case.
`null-character-reference@pE
誘因: `0000^U を参照する,数的な`文字~参照$に遭遇した。 ◎ This error occurs if the parser encounters a numeric character reference that references a U+0000 NULL code point.\
処置: そのような文字~参照は、 `FFFD^U に解決する。 ◎ The parser resolves such character references to a U+FFFD REPLACEMENT CHARACTER.
`surrogate-character-reference@pE
誘因: `~surrogate$を参照する,数的な`文字~参照$に遭遇した。 ◎ This error occurs if the parser encounters a numeric character reference that references a surrogate.\
処置: そのような文字~参照は、 `FFFD^U に解決する。 ◎ The parser resolves such character references to a U+FFFD REPLACEMENT CHARACTER.
`surrogate-in-input-stream@pE
誘因: `入力~stream$は`~surrogate$を包含している。 ◎ This error occurs if the input stream contains a surrogate.\
処置: そのような`~cp$は,そのままに構文解析され、通例的には — すなわち、構文解析~規則が他に制約を適用しない所では — ~DOMに流し込まれる。 ◎ Such code points are parsed as-is and usually, where parsing rules don't apply any additional restrictions, make their way into the DOM.
注記: ~surrogateが入力~streamの中に生じるのは、 `document.write()$m などの~script~APIを介した場合に限られる。 ◎ Surrogates can only find their way into the input stream via script APIs such as document.write().
`unexpected-character-after-doctype-system-identifier@pE
誘因: `~DOCTYPE$における~systemIDの後にて,次に挙げるもの以外の`~cp$に遭遇した ⇒ `~ASCII空白$ / ~DOCTYPEを閉じる `003E^U ◎ This error occurs if the parser encounters any code points other than ASCII whitespace or closing U+003E (>) after the DOCTYPE system identifier.\
処置: そのような~cpは、無視する。 ◎ The parser ignores these code points.
`unexpected-character-in-attribute-name@pE
誘因: `属性~名$内で,次のいずれかの`~cp$に遭遇した ⇒ `0022^U / `0027^U / `003C^U ◎ This error occurs if the parser encounters a U+0022 ("), U+0027 ('), or U+003C (<) code point in an attribute name.\
処置: そのような~cpは、属性~名に含ませる。 ◎ The parser includes such code points in the attribute name.
注記: この~errorを誘発する~cpは、通例的には別の構文的~構成子の一部である — 属性~名~周りの誤記の表れを示すものなど。 ◎ Code points that trigger this error are usually a part of another syntactic construct and can be a sign of a typo around the attribute name.

例えば,次の~markupを考える: ◎ For example, consider the following markup:

<div foo<div>

`foo^c の後に `003E^U を忘れたことに因り、構文解析器は この~markupを `foo<div^l 属性を伴う 1 個の `div$e 要素として扱う。 ◎ Due to a forgotten U+003E (>) code point after foo the parser treats this markup as a single div element with a "foo<div" attribute.

この~errorの別の例として、次の~markupを考える: ◎ As another example of this error, consider the following markup:

<div id'bar'>

属性~名と値の合間に `003D^U を忘れたことに因り、構文解析器は, この~markupを[ 値が空にされた属性 `id'bar'^l ]を伴う `div$e 要素として扱う。 ◎ Due to a forgotten U+003D (=) code point between an attribute name and value the parser treats this markup as a div element with the attribute "id'bar'" that has an empty value.

`unexpected-character-in-unquoted-attribute-value@pE
誘因: 引用符無しの`属性~値$内で,次のいずれかの`~cp$に遭遇した ⇒ `0022^U / `0027^U / `003C^U / `003D^U / `0060^U ◎ This error occurs if the parser encounters a U+0022 ("), U+0027 ('), U+003C (<), U+003D (=), or U+0060 (`) code point in an unquoted attribute value.\
処置: そのような~cpは、属性~値に含ませる。 ◎ The parser includes such code points in the attribute value.
注記: この~errorを誘発する~cpは、通例的には別の構文的~構成子の一部である — 属性~値~周りの誤記の表れを示すものなど。 ◎ Code points that trigger this error are usually a part of another syntactic construct and can be a sign of a typo around the attribute value.
注記: `0060^U は、この~errorを誘発する~cpの一つである — ある種の旧来の~UAは、それを引用符として扱うので。 ◎ U+0060 (`) is in the list of code points that trigger this error because certain legacy user agents treat it as a quote.

例えば,次の~markupを考える: ◎ For example, consider the following markup:

<div foo=b'ar'>

誤って置かれた `0027^U に因り、構文解析器は `foo^l 属性の値を `b'ar'^l に設定する。 ◎ Due to a misplaced U+0027 (') code point the parser sets the value of the "foo" attribute to "b'ar'".

`unexpected-equals-sign-before-attribute-name@pE
誘因: 属性~名の前で `003D^U に遭遇した。 ◎ This error occurs if the parser encounters a U+003D (=) code point before an attribute name.\
処置: `003D^U を属性~名の最初の~cpとして扱う。 ◎ In this case the parser treats U+003D (=) as the first code point of the attribute name.
注記: この~errorに共通的な理由は、属性~名を忘れたときである。 ◎ The common reason for this error is a forgotten attribute name.

例えば,次の~markupを考える: ◎ For example, consider the following markup:

<div foo="bar" ="baz">

属性~名を忘れたことに因り、構文解析器は,この~markupを 2 個の属性 — 値 `bar^lにされた `foo^l 属性, 値は空にされた `="baz"^l 属性 — を伴う `div$e 要素として扱う。 ◎ Due to a forgotten attribute name the parser treats this markup as a div element with two attributes: a "foo" attribute with a "bar" value and a "="baz"" attribute with an empty value.

`unexpected-null-character@pE
誘因: `入力~stream$内の一定の位置で, `0000^U に遭遇した。 ◎ This error occurs if the parser encounters a U+0000 NULL code point in the input stream in certain positions.\
処置: 一般に,そのような~cpは完全に無視されるが、~security上の理由から `FFFD^U に置換されることもある。 ◎ In general, such code points are either completely ignored or, for security reasons, replaced with a U+FFFD REPLACEMENT CHARACTER.
`unexpected-question-mark-instead-of-tag-name@pE
誘因: `開始tag$の名前の最初の~cpが期待される所で, `003F^U に遭遇した。 ◎ This error occurs if the parser encounters a U+003F (?) code point where first code point of a start tag name is expected.\
処置: `003F^U から[ それに後続する最初の `003E^U (無ければ `入力~stream$の終端) ]までのすべての内容を,~commentとして扱う。 ◎ 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.

例えば,次の~markupを考える: ◎ 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$e
    • `head$e
    • `body$e
注記: この~errorに共通的な理由は、~HTML内で,~XML処理命令(例: `<?xml-stylesheet type="text/css" href="style.css"?>^c ) / ~XML宣言(例: `<?xml version="1.0" encoding="UTF-8" ?>^c )が利用されているときである。 ◎ 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@pE
誘因: ある~tag内で, `002F^U に遭遇したが、[ それは引用符~付きの`属性$値の一部でない ]~AND[ その直後の~cpは `003E^U でない ]。 ◎ This error occurs if the parser encounters a U+002F (/) code point that is not a part of a quoted attribute value and not immediately followed by a U+003E (>) code point in a tag\
例: `<div / id="foo">^c ◎ (e.g., <div / id="foo">).\
処置: `~ASCII空白$に遭遇したかのように挙動する。 ◎ In this case the parser behaves as if it encountered ASCII whitespace.
`unknown-named-character-reference@pE
誘因: `多義的amp$に遭遇した。 ◎ This error occurs if the parser encounters an ambiguous ampersand.\
処置: そのような`文字~参照$は、解決しない。 ◎ In this case the parser doesn't resolve the character reference.

12.2.3. 入力~byte~stream

~token化~段階への入力を成す~cp~streamは、~UAからは初期~時には~byte列~streamとして見えることになる(概して,~network越しに, または局所~file~systemから来ている)。 そのような~byte列は,実際の文字~並びを特定0の `符号化法^i に則って符号化した結果であり、~UAは,その符号化法を利用して~byte列を文字~並びに復号する。 ◎ The stream of code points that comprises the input to the tokenization stage will be initially seen by the user agent as a stream of bytes (typically coming over the network or from the local file system). The bytes encode the actual characters according to a particular character encoding, which the user agent uses to decode the bytes into characters.

注記: ~XML文書に対しては、[ 符号化法を決定するために利用するよう,~UAに要求される~algo ]は,~XML仕様が与える。 この節は、~XML文書には適用されない。 `XML$r ◎ For XML documents, the algorithm user agents are required to use to determine the character encoding is given by the XML specification. This section does not apply to XML documents. [XML]

通例的には,符号化法を決定するためには、下に定義する`符号化法を~sniffする~algo$を利用する。 ◎ Usually, the encoding sniffing algorithm defined below is used to determine the character encoding.

`入力~byte~stream$内の~byte列は、次の結果による文字~並びに変換した上で,~tokenizerの`入力~stream$に渡され~MUST ⇒ `~Unicodeに復号する$( 所与の符号化法, ~byte列 ) ◎ Given a character encoding, the bytes in the input byte stream must be converted to characters for the tokenizer's input stream, by passing the input byte stream and character encoding to decode.

注記: 頭部の~BOM( Byte Order Mark)がある場合、符号化法~引数は無視され,~BOM自身も飛ばされることになる。 ◎ A leading Byte Order Mark (BOM) causes the character encoding argument to be ignored and will itself be skipped.

注記: 元の~byte~stream内の ~byte/~byte列 のうち `ENCODING$r 標準に適合しないもの(例:~UTF-8入力~byte~stream内の妥当でない~UTF-8~byte列)は,~errorであり、適合性~検査器には,それを報告することが期待される。 ◎ Bytes or sequences of bytes in the original byte stream that did not conform to the Encoding standard (e.g. invalid UTF-8 byte sequences in a UTF-8 input byte stream) are errors that conformance checkers are expected to report. [ENCODING]

復号器~algoは、妥当でない入力を取扱う方法を述べる。 ~security上の理由から、この規則には精確に従うことは,~~必須とされる。 妥当でない~byte列を取扱う方法における相違は、他の問題もあるが,~script注入( “XSS” )の脆弱性をもたらし得る。 ◎ The decoder algorithms describe how to handle invalid input; for security reasons, it is imperative that those rules be followed precisely. Differences in how invalid byte sequences are handled can result in, amongst other problems, script injection vulnerabilities ("XSS").

~HTML構文解析器は、入力~byte~streamを復号する際に 符号化法と `確度@ ~IN { `暫定的^i, `確か^i, `無関係^i } を利用する。 利用される符号化法, および その符号化法における確度が[ `暫定的^i, `確か^i ]のどちらになるかは、`符号化法を変更する$かどうか決定するために 構文解析の間に利用される。 符号化法は必要とされない場合、 `確度$は `無関係^i とする — 例: 構文解析器は ~Unicode~stream上で演算していて,符号化法を利用する必要はまったくないなど。 ◎ When the HTML parser is decoding an input byte stream, it uses a character encoding and a confidence. The confidence is either tentative, certain, or irrelevant. The encoding used, and whether the confidence in that encoding is tentative or certain, is used during the parsing to determine whether to change the encoding. If no encoding is necessary, e.g. because the parser is operating on a Unicode stream and doesn't have to use a character encoding at all, then the confidence is irrelevant.

注記: 一部の~algoは、~byte列を`入力~byte~stream$に追加することなく,`入力~stream$に直に 文字たちを追加することにより,構文解析器に給する。 ◎ Some algorithms feed the parser by directly adding characters to the input stream rather than adding bytes to the input byte stream.

12.2.3.1. 既知の符号化法による構文解析

~HTML構文解析器が `既知の確定的な符号化法@ を伴う入力~byte~stream上で演算するときの ( 符号化法, `確度$ ) は、 ( その符号化法, `確か^i ) になるとする。 ◎ When the HTML parser is to operate on an input byte stream that has a known definite encoding, then the character encoding is that encoding and the confidence is certain.

12.2.3.2. 符号化法の決定-法

文書を構文解析する前に符号化法を一義的に決定するのは、実用的でない事例もあるかもしれない。 そのため,この仕様は、 2 周回の仕組みを供する: ◎ In some cases, it might be impractical to unambiguously determine the encoding before parsing the document. Because of this, this specification provides for a two-pass mechanism with an optional pre-scan.\

  1. 1 周回~目の予走査は、任意選択である — 実装には、文書を構文解析し始める前に可用な~byte列に,それが何であれ[ 下に述べる,単純~化された構文解析~algoを適用する ]ことも許容される。 ◎ Implementations are allowed, as described below, to apply a simplified parsing algorithm to whatever bytes they have available before beginning to parse the document.\
  2. 2 周回~目の本番の構文解析器は、[ 予走査から導出された暫定的な符号化法と,他の帯域外の~metadata ]を利用して開始される。 文書が読込まれている間に,~UAがこの情報と競合するような符号化法~宣言を発見した場合、構文解析器は — 文書の構文解析-を,本番の符号化法の下で遂行するようにしておく下で — 再び呼出されることになる。 ◎ Then, the real parser is started, using a tentative encoding derived from this pre-parse and other out-of-band metadata. If, while the document is being loaded, the user agent discovers a character encoding declaration that conflicts with this information, then the parser can get reinvoked to perform a parse of the document with the real encoding.

~UAは 1 周回~目にて,文書の復号-時に利用する符号化法を決定するときには、次に与える `符号化法を~sniffする~algo@ を利用し~MUST。 この~algoは、所与の[ それまでに可用なすべての~byte列, ~UAに可用な帯域外の~metadata(もしあれば — 例:文書の`~Content-Type~metadata$) ]に対し, ( 符号化法, `確度$ ~IN { `暫定的^i, `確か^i } ) の組を返す: ◎ User agents must use the following algorithm, called the encoding sniffing algorithm, to determine the character encoding to use when decoding a document in the first pass. This algorithm takes as input any out-of-band metadata available to the user agent (e.g. the Content-Type metadata of the document) and all the bytes available so far, and returns a character encoding and a confidence that is either tentative or certain.

  1. ~IF[ 利用者は、文書の符号化法を 特定の符号化法で上書きするよう,明示的に~UAに指図した ] ⇒ ~UAの任意選択で ⇒ ~RET ( その符号化法, `確か^i ) ◎ If the user has explicitly instructed the user agent to override the document's character encoding with a specific encoding, optionally return that encoding with the confidence certain.

    注記: ~UAは概して、利用者からのそのような要請を複数~sessionにわたって覚える。 また、一部の事例では `iframe$e 内の文書にもそれらを適用する。 ◎ Typically, user agents remember such user requests across sessions, and in some cases apply them to documents in iframes as well.

  2. ~UAは、[ この~algoの,この段も含む以降の各~段 ]にて,資源の~byte列が更に可用になるまで待機して~MAY。 具体例として,~UAは、[ 500ms 経つか, 1024 ~byte得られるか ]いずれか早い方まで待機するかもしれない。 一般に,符号化法を見出すために~sourceを予め構文解析すれば、処理能は改善される — そうすれば、符号化法~情報が見出されたとき,構文解析-時に利用した~data構造を棄てる必要は抑制されるので。 しかしながら、この処理能の改善より,[ 符号化法を決定するための~dataを得るために,~UAが遅延し過ぎることによる~cost ]の方が重くなることもある。 ◎ The user agent may wait for more bytes of the resource to be available, either in this step or at any later step in this algorithm. For instance, a user agent might wait 500ms or 1024 bytes, whichever came first. In general preparsing the source to find the encoding improves performance, as it reduces the need to throw away the data structures used when parsing upon finding the encoding information. However, if the user agent delays too long to obtain data to determine the encoding, then the cost of the delay could outweigh any performance improvements from the preparse.

    注記: 符号化法~宣言に対する著作~適合性~要件は、それを 最初の 1024 ~byteまで に現れるものに制限する。 したがって,~UAには、下に示す予走査~algoを最初の 1024 ~byteまでに限って(この手続きが呼出すように)利用し,それを超えて停滞しないことが奨励される。 ◎ The authoring conformance requirements for character encoding declarations limit them to only appearing in the first 1024 bytes. User agents are therefore encouraged to use the prescan algorithm below (as invoked by these steps) on the first 1024 bytes, but not to stall beyond that.

  3. ~IF[ ~transport層は、~supportされる符号化法を指定している ] ⇒ ~RET ( その符号化法, `確か^i ) ◎ If the transport layer specifies a character encoding, and it is supported, return that encoding with the confidence certain.
  4. ~UAの任意選択で、次を走らす — ~UAは,~byteをまったく走査しない方が効率的であると決めて~MAY — その場合、この段は まるごと飛ばされる: ◎ Optionally\

    1. `~byte~streamを予走査して符号化法を決定する$ — その %終端~条件 は、~UAが[ それ以上~byteを走査しても効率的にならない ]と決める所までとする。 ~UAには、最初の 1024~byteのみ予走査することが奨励される。 ◎ prescan the byte stream to determine its encoding. The end condition is that the user agent decides that scanning further bytes would not be efficient. User agents are encouraged to only prescan the first 1024 bytes. User agents may decide that scanning any bytes is not efficient, in which case these substeps are entirely skipped.
    2. ~IF[ 前~段にて成功裡に符号化法が得られた ] ⇒# ~RET ( その符号化法, `暫定的^i ) ◎ The aforementioned algorithm either aborts unsuccessfully or returns a character encoding. If it returns a character encoding, then return the same encoding, with confidence tentative.
  5. ~IF[[ この~algoを走らせている`~HTML構文解析器$を結付けている`文書$ %新たな文書 ]が`属する閲覧文脈$ %B は,ある`文書$ %親~文書 を`通して入子にされて$いる( %親~文書 は %B の`親~閲覧文脈$にて`作動中の文書$である) ]: ◎ If the HTML parser for which this algorithm is being run is associated with a Document that is itself in a nested browsing context, run these substeps: ◎ Let new document be the Document with which the HTML parser is associated. ◎ Let parent document be the Document through which new document is nested (the active document of the parent browsing context of new document).

    1. ~IF[ ( %親~文書 の`生成元$, %新たな文書 の`生成元$ ) は、`同一生成元$である ]~AND[ %親~文書 の`符号化法$docは`~ASCII互換な符号化法$である ] ⇒ ~RET ( %親~文書 の`符号化法$doc, `暫定的^i ) ◎ If parent document's origin is same origin with new document's origin, and parent document's character encoding is an ASCII-compatible encoding, then return parent document's character encoding, with the confidence tentative.
  6. ~ELIF[ ~UAは、当の頁に見込まれる符号化法の情報を有する — 例:最後に訪問したときの頁の符号化法に基づくものなど ] ⇒ ~RET ( その符号化法, `暫定的^i ) ◎ Otherwise, if the user agent has information on the likely encoding for this page, e.g. based on the encoding of the page when it was last visited, then return that encoding, with the confidence tentative.
  7. ~UAの任意選択で、次を走らす:

    1. ~data~streamに頻度解析その他の~algoを適用して,符号化法を自動検出しようと試みる — そのような~algoは、資源の内容の他にも資源についての情報(例:資源の~address)があれば,それを利用して~MAY `UNIVCHARDET$r ◎ The user agent may attempt to autodetect the character encoding from applying frequency analysis or other algorithms to the data stream. Such algorithms may use information about the resource other than the resource's contents, including the address of the resource.\
    2. ~IF[ 前~段にて符号化法を決定するのに成功した ]~AND[ 結果の符号化法は~supportされる符号化法である ] ⇒ ~RET ( 結果の符号化法, `暫定的^i ) ◎ If autodetection succeeds in determining a character encoding, and that encoding is a supported encoding, then return that encoding, with the confidence tentative. [UNIVCHARDET]

    注記: ~UAには、~network越しに得られた資源に対しては,符号化法を自動検出しようと試みないことが一般に奨励される — そうすることは、内来的に相互運用可能でない経験則を孕むので。 符号化法を~HTML文書の前置きに基づいて検出しようと試みるのは、とりわけ込み入っている — ~HTML~markupは,概して~ASCII文字のみを利用しており、~HTML文書は,~text内容に~~先立って多量の~markupから始まる傾向にあるので。 ◎ User agents are generally discouraged from attempting to autodetect encodings for resources obtained over the network, since doing so involves inherently non-interoperable heuristics. Attempting to detect encodings based on an HTML document's preamble is especially tricky since HTML markup typically uses only ASCII characters, and HTML documents tend to begin with a lot of markup rather than with text content.

    注記: ~UTF-8符号化法の~bit~patternは、非常に検出し易い。 局所~file~systemからの~fileは、[ 値が `7F^X より大きく, ~UTF-8~patternに合致するような,~byte列 ]を包含しているならば,およそ ~UTF-8と見込まれる一方で、合致しない~byte列を伴う文書は,およそ そうでないと見込まれる。 ~UAは,前置きのみならず~file全体を精査できるなら、特に~UTF-8を検出することが,とりわけ効果的になり得る。 `PPUTF8$r `UTF8DET$r ◎ The UTF-8 encoding has a highly detectable bit pattern. Files from the local file system that contain bytes with values greater than 0x7F which match the UTF-8 pattern are very likely to be UTF-8, while documents with byte sequences that do not match it are very likely not. When a user agent can examine the whole file, rather than just the preamble, detecting for UTF-8 specifically can be especially effective. [PPUTF8] [UTF8DET]

  8. ~RET ( [ 実装により定義される/利用者により指定される ]既定の符号化法, `暫定的^i ) ◎ Otherwise, return an implementation-defined or user-specified default character encoding, with the confidence tentative.

    • 制御~下にある環境や,文書の符号化法が 制定-済みの環境(例えば,新たな~networkに専用の利用が意図される~UA用の)に対しては、包括的 `UTF-8^enc 符号化法が示唆される。 ◎ In controlled environments or in environments where the encoding of documents can be prescribed (for example, for user agents intended for dedicated use in new networks), the comprehensive UTF-8 encoding is suggested.
    • 他の環境においては、既定の符号化法は,概して利用者の~localeに依存する(~localeとは、利用者が 頁たちにわたって頻用すると見込まれる言語の近似であり、符号化法も その言語から~~導出されることが多い)。 次の表に、旧来の内容との互換性のために,利用者の~localeに基づいて示唆される既定の符号化法を与える: ◎ In other environments, the default encoding is typically dependent on the user's locale (an approximation of the languages, and thus often encodings, of the pages that the user is likely to frequent). The following table gives suggested defaults based on the user's locale, for compatibility with legacy content. Locales are identified by BCP 47 language tags. [BCP47] [ENCODING]

      言語~tag `BCP47$r ~locale言語 ◎ Locale language 示唆される既定の符号化法 `ENCODING$r ◎ Suggested default encoding
      ar Arabic `windows-1256$enc
      ba Bashkir `windows-1251$enc
      be Belarusian `windows-1251$enc
      bg Bulgarian `windows-1251$enc
      cs Czech `windows-1250$enc
      el Greek `ISO-8859-7$enc
      et Estonian `windows-1257$enc
      fa Persian `windows-1256$enc
      he Hebrew `windows-1255$enc
      hr Croatian `windows-1250$enc
      hu Hungarian `ISO-8859-2$enc
      ja Japanese `Shift_JIS$enc
      kk Kazakh `windows-1251$enc
      ko Korean `EUC-KR$enc
      ku Kurdish `windows-1254$enc
      ky Kyrgyz `windows-1251$enc
      lt Lithuanian `windows-1257$enc
      lv Latvian `windows-1257$enc
      mk Macedonian `windows-1251$enc
      pl Polish `ISO-8859-2$enc
      ru Russian `windows-1251$enc
      sah Yakut `windows-1251$enc
      sk Slovak `windows-1250$enc
      sl Slovenian `ISO-8859-2$enc
      sr Serbian `windows-1251$enc
      tg Tajik `windows-1251$enc
      th Thai `windows-874$enc
      tr Turkish `windows-1254$enc
      tt Tatar `windows-1251$enc
      uk Ukrainian `windows-1251$enc
      vi Vietnamese `windows-1258$enc
      zh-CN Chinese (People's Republic of China) `gb18030$enc
      zh-TW Chinese (Taiwan) `Big5$enc
      他のすべての~locale ◎ All other locales `windows-1252$enc

      この表の内容は、 Windows, Chrome, Firefox による既定~のそれらの共通部分から導出されている。 ◎ The contents of this table are derived from the intersection of Windows, Chrome, and Firefox defaults.

文書の`符号化法$docは、即時に,この~algoから返される値に設定され~MUST — ~UAが,返された値を利用して[ 入力~byte~stream用に利用する復号器 ]を選定するときと同時に。 ◎ The document's character encoding must immediately be set to the value returned from this algorithm, at the same time as the user agent uses the returned value to select the decoder to use for the input byte stream.



~UAは、 `~byte~streamを予走査して符号化法を決定する@ ときは、以下に与える手続きを走らせ~MUST — この手続きは:

  • 符号化法を返すか, 不成功として中止する。
  • 入力~byte~stream内のどこかを指す, %位置 と記される~pointerを利用する — 初期~時には最初の~byteを指しているとする。 また, %位置↗ という表記は、 %位置 が指している~byteを表すとする。
  • ある定義-済みの %終端~条件 が与えられる。 ~UAは、[ この手続きの間のある地点にて(この手続きが呼出す`属性を取得する$も含めて), %終端~条件 に達した場合、この~algoを不成功として中止する — ~byte列が尽きた場合も %終端~条件 に達したものと見なす。 すなわち, %終端~条件 は、手続き内の %位置↗ が現れるすべての箇所で検査され,達した時点で中止する。
  • この手続きの目的における `空白~byte^i は、次に挙げる~byteの総称とする ⇒ `09^X (HT), `0A^X (LF), `0C^X (FF), `0D^X (CR), `20^X (SP)
◎ When an algorithm requires a user agent to prescan a byte stream to determine its encoding, given some defined end condition, then it must run the following steps. These steps either abort unsuccessfully or return a character encoding. If at any point during these steps (including during instances of the get an attribute algorithm invoked by this one) the user agent either runs out of bytes (meaning the position pointer created in the first step below goes beyond the end of the byte stream obtained so far) or reaches its end condition, then abort the prescan a byte stream to determine its encoding algorithm unsuccessfully. ◎ Let position be a pointer to a byte in the input byte stream, initially pointing at the first byte.
  1. ~WHILE[ %位置↗ ~NEQ `3C^X ( `<^bl ) ] ⇒ %位置 ~INCBY 1 ◎ ↓
  2. ~IF[ 次の表の中に[ `~byte小文字~化する$( 入力~byte~streamの ( %位置 ~PLUS 1 ) から 5 個までの~byte ) ]の結果を成す~byteたちに合致する行はある ] ⇒ [ 最初に合致した行の~label列に与える~label ]に対応する[ 表の下に与える手続き ]を走らす:

    表内の `小文字^i は `61^X 〜 `7A^X を表す/ 空欄は無条件を表す(当の~byteが存在しない場合も含め)。
    1 個目 2 個目 3 個目 4 個目 5 個目 ~label
    `21^X (`!^bl) `2D^X (`-^bl) `2D^X (`-^bl) `~comment^i
    `6D^X (`m^bl) `65^X (`e^bl) `74^X (`t^bl) `61^X (`a^bl) `空白~byte^i, `2F^X (`/^bl) `meta^i
    `小文字^i `他の~tag^i
    `2F^X (`/^bl) `小文字^i `他の~tag^i
    `21^X (`!^bl), `2F^X (`/^bl), `3F^X (`?^bl) `他の~mark^i
    ◎ Loop: If position points to:
    `~comment^i ◎ A sequence of bytes starting with: 0x3C 0x21 0x2D 0x2D (`<!--`)
    1. ~WHILE[ 入力~byte~streamの %位置 から 3 個までの~byteが成す~byte列 ~NEQ `2D^X `2D^X `3E^X ( `-->^bl ) † ] ⇒ %位置 ~INCBY 1
    2. %位置 ~INCBY 2
    († 2 個の `2D^X ~byteは、合致した `!--^bl と重なり得る) ◎ Advance the position pointer so that it points at the first 0x3E byte which is preceded by two 0x2D bytes (i.e. at the end of an ASCII '-->' sequence) and comes after the 0x3C byte that was found. (The two 0x2D bytes can be the same as those in the '<!--' sequence.)
    `meta^i ◎ A sequence of bytes starting with: 0x3C, 0x4D or 0x6D, 0x45 or 0x65, 0x54 or 0x74, 0x41 or 0x61, and one of 0x09, 0x0A, 0x0C, 0x0D, 0x20, 0x2F (case-insensitive ASCII '<meta' followed by a space or slash)
    1. %位置 ~INCBY 5 ◎ Advance the position pointer so that it points at the next 0x09, 0x0A, 0x0C, 0x0D, 0x20, or 0x2F byte (the one in sequence of characters matched above).
    2. %属性~list ~LET (文字列からなる)空~list ◎ Let attribute list be an empty list of strings.
    3. %~pragmaは得られた ~LET ~F ◎ Let got pragma be false.
    4. %~pragmaが必要 ~LET ~NULL ◎ Let need pragma be null.
    5. %~charset ~LET ~NULL (この値は、この~algoの目的においては[ 認識されない符号化法/空~文字列 ]とは別個である。) ◎ Let charset be the null value (which, for the purposes of this algorithm, is distinct from an unrecognized encoding or the empty string).
    6. ~WHILE 無条件: ◎ Attributes:\

      1. ( %属性~名, %属性~値 ) ~LET `属性を取得する$ ◎ Get an attribute and its value.\
      2. ~IF[ %属性~名 ~EQ ε ] ⇒ ~BREAK ◎ If no attribute was sniffed, then jump to the processing step below.
      3. ~IF[ %属性~名 ~IN %属性~list ] ⇒ ~CONTINUE ◎ If the attribute's name is already in attribute list, then return to the step labeled attributes.
      4. %属性~list に %属性~名 を追加する ◎ Add the attribute's name to attribute list.
      5. %属性~名 に応じて: ◎ Run the appropriate step from the following list, if one applies:

        `http-equiv^l ◎ If the attribute's name is "http-equiv"
        ~IF[ %属性~値 ~EQ `content-type^l ] ⇒ %~pragmaは得られた ~SET ~T ◎ If the attribute's value is "content-type", then set got pragma to true.
        `content^l ◎ If the attribute's name is "content"
        1. ~IF[ %~charset ~NEQ ~NULL ] ⇒ ~CONTINUE
        2. %符号化法 ~LET `~meta要素から符号化法を抽出する$( %属性~値 )
        3. ~IF[ %符号化法 ~EQ ε ] ⇒ ~CONTINUE
        4. %~charset ~LET %符号化法
        5. %~pragmaが必要 ~SET ~T
        ◎ Apply the algorithm for extracting a character encoding from a meta element, giving the attribute's value as the string to parse. If a character encoding is returned, and if charset is still set to null, let charset be the encoding returned, and set need pragma to true.
        `charset^l ◎ If the attribute's name is "charset"
        1. %~charset ~LET `~labelから符号化法を取得する$( %属性~値 )
        2. %~pragmaが必要 ~SET ~F
        ◎ Let charset be the result of getting an encoding from the attribute's value, and set need pragma to false.
      6. ( ~CONTINUE ) ◎ Return to the step labeled attributes.
    7. ~IF[ %~pragmaが必要 ~EQ ~NULL ] ⇒ ~GOTO `次n~byte^i ◎ Processing: If need pragma is null, then jump to the step below labeled next byte.
    8. ~IF[ %~pragmaが必要 ~EQ ~T ]~AND[ %~pragmaは得られた ~EQ ~F ] ⇒ ~GOTO `次n~byte^i ◎ If need pragma is true but got pragma is false, then jump to the step below labeled next byte.
    9. ~IF[ %~charset ~EQ 失敗 ] ⇒ ~GOTO `次n~byte^i ◎ If charset is failure, then jump to the step below labeled next byte.
    10. ~IF[ %~charset は`~UTF-16$である ] ⇒ %~charset ~SET `UTF-8$enc ◎ If charset is a UTF-16 encoding, then set charset to UTF-8.
    11. ~IF[ %~charset ~EQ `x-user-defined$enc ] ⇒ %~charset ~SET `windows-1252$enc ◎ If charset is x-user-defined, then set charset to windows-1252.
    12. ~RET %~charset ◎ Abort the prescan a byte stream to determine its encoding algorithm, returning the encoding given by charset.
    `他の~tag^i ◎ A sequence of bytes starting with a 0x3C byte (<), optionally a 0x2F byte (/), and finally a byte in the range 0x41-0x5A or 0x61-0x7A (A-Z or a-z)
    1. ~WHILE[ %位置↗ ~NIN { `空白~byte^i, `3E^X (`>^bl) } ] ⇒ %位置 ~INCBY 1 ◎ Advance the position pointer so that it points at the next 0x09 (HT), 0x0A (LF), 0x0C (FF), 0x0D (CR), 0x20 (SP), or 0x3E (>) byte.
    2. ~WHILE [ `属性を取得する$の結果 ~NEQ ( ε, ε ) ] ⇒ (何もしない) ◎ Repeatedly get an attribute until no further attributes can be found, then\ ◎ jump to the step below labeled next byte.
    `他の~mark^i ◎ A sequence of bytes starting with: 0x3C 0x21 (`<!`) ◎ A sequence of bytes starting with: 0x3C 0x2F (`</`) ◎ A sequence of bytes starting with: 0x3C 0x3F (`<?`)
    ~WHILE[ %位置↗ ~NEQ `3E^X ( `>^bl ) ] ⇒ %位置 ~INCBY 1 ◎ Advance the position pointer so that it points at the first 0x3E byte (>) that comes after the 0x3C byte that was found.
  3. `次n~byte^i ⇒# %位置 ~INCBY 1; ~GOTO この手続きの最初の段 ◎ Any other byte • Do nothing with that byte. ◎ Next byte: Move position so it points at the next byte in the input byte stream, and return to the step above labeled loop.

上の~algoにおける `属性を取得する@ 下位手続きは、次を走らす: ◎ When the prescan a byte stream to determine its encoding algorithm says to get an attribute, it means doing this:

  1. ~WHILE[ %位置↗ ~IN { `空白~byte^i, `2F^X (`/^bl) } ] ⇒ %位置 ~INCBY 1 ◎ If the byte at position is one of 0x09 (HT), 0x0A (LF), 0x0C (FF), 0x0D (CR), 0x20 (SP), or 0x2F (/) then advance position to the next byte and redo this step.
  2. ~IF[ %位置↗ ~EQ `3E^X (`>^bl) ] ⇒ ~RET ( ε, ε ) ◎ If the byte at position is 0x3E (>), then abort the get an attribute algorithm. There isn't one.
  3. ~Assert: %位置 は属性~名の始端を指す。 ◎ Otherwise, the byte at position is the start of the attribute name.\
  4. %属性~名~LET 空~文字列 ◎ Let attribute name and attribute value be the empty string.
  5. ~WHILE[ %位置↗ ~NIN { `空白~byte^i } ]:

    1. %位置↗ に応じて: ◎ Process the byte at position as follows:

      `3D^X (`=^bl) ◎ If it is 0x3D (=), and the attribute name is longer than the empty string
      1. ~IF[ %属性~名 ~EQ 空~文字列 ] ⇒ ~GOTO ~AnyElse
      2. %位置 ~INCBY 1
      3. ~GOTO `値^i
      ◎ Advance position to the next byte and jump to the step below labeled value. ◎ ↑If it is 0x09 (HT), 0x0A (LF), 0x0C (FF), 0x0D (CR), or 0x20 (SP) • Jump to the step below labeled spaces.
      `2F^X (`/^bl)
      `3E^X (`>^bl)
      ~RET ( %属性~名, 空~文字列 ) ◎ If it is 0x2F (/) or 0x3E (>) ◎ Abort the get an attribute algorithm. The attribute's name is the value of attribute name, its value is the empty string.
      ~AnyElse
      %属性~名 ~APPEND ~cp( `~byte小文字~化する$( %位置↗ ) ) ◎ If it is in the range 0x41 (A) to 0x5A (Z) • Append the code point b+0x20 to attribute name (where b is the value of the byte at position). (This converts the input to lowercase.) ◎ Anything else • Append the code point with the same value as the byte at position to attribute name.\
      (~ASCII範囲の外側にある~byteが ここでどう取扱われるかは、実際に問われることはない — ~ASCII~byteのみが符号化法の検出に寄与し得るので。) ◎ (It doesn't actually matter how bytes outside the ASCII range are handled here, since only ASCII bytes can contribute to the detection of a character encoding.)
    2. %位置 ~INCBY 1 ◎ Advance position to the next byte and return to the previous step.
  6. ~WHILE[ %位置↗ ~IN { `空白~byte^i } ] ⇒ %位置 ~INCBY 1 ◎ Spaces: If the byte at position is one of 0x09 (HT), 0x0A (LF), 0x0C (FF), 0x0D (CR), or 0x20 (SP) then advance position to the next byte, then, repeat this step.
  7. ~IF[ %位置↗ ~NEQ `3D^X (`=^bl) ] ⇒ ~RET ( %属性~名, 空~文字列 ) ◎ If the byte at position is not 0x3D (=), abort the get an attribute algorithm. The attribute's name is the value of attribute name, its value is the empty string.
  8. ~WHILE[ %位置↗ ~EQ `3D^X (`=^bl) ] ⇒ %位置↗ ~INCBY 1 ◎ Advance position past the 0x3D (=) byte.
  9. `値^i : ~WHILE[ %位置↗ ~IN { `空白~byte^i } ] ⇒ %位置 ~INCBY 1 ◎ Value: If the byte at position is one of 0x09 (HT), 0x0A (LF), 0x0C (FF), 0x0D (CR), or 0x20 (SP) then advance position to the next byte, then, repeat this step.
  10. %属性~値 ~LET 空~文字列 ◎ ↑
  11. ~IF[ %位置↗ ~IN { `22^X (`"^bl), `27^X (`'^bl) } ]: ◎ Process the byte at position as follows: ◎ If it is 0x22 (") or 0x27 (')

    1. %引用符 ~LET %位置↗ ◎ Let b be the value of the byte at position.
    2. ~WHILE 無条件: ◎ Quote loop:\

      1. %位置 ~INCBY 1 ◎ Advance position to the next byte.
      2. ~IF[ %位置↗ ~EQ %引用符 ]:

        1. %位置 ~INCBY 1
        2. ~RET ( %属性~名, %属性~値 )
        ◎ If the value of the byte at position is the value of b, then advance position to the next byte and abort the "get an attribute" algorithm. The attribute's name is the value of attribute name, and its value is the value of attribute value.
      3. ~ELSE ⇒ %属性~値 ~APPEND ~cp( `~byte小文字~化する$( %位置↗ ) ) ◎ Otherwise, if the value of the byte at position is in the range 0x41 (A) to 0x5A (Z), then append a code point to attribute value whose value is 0x20 more than the value of the byte at position. ◎ Otherwise, append a code point to attribute value whose value is the same as the value of the byte at position. ◎ Return to the step above labeled quote loop.
  12. ~Assert: %位置↗ ~NIN { `空白~byte^i } ◎ (これらの段は後続の段で吸収されるので不要) ◎ If it is 0x3E (>) • Abort the get an attribute algorithm. The attribute's name is the value of attribute name, its value is the empty string. ◎ If it is in the range 0x41 (A) to 0x5A (Z) • Append a code point b+0x20 to attribute value (where b is the value of the byte at position). Advance position to the next byte. ◎ Anything else • Append a code point with the same value as the byte at position to attribute value. Advance position to the next byte.
  13. ~WHILE 無条件:

    1. %位置↗ に応じて: ◎ Process the byte at position as follows:

      `空白~byte^i
      `3E^X (`>^bl) ◎ If it is 0x09 (HT), 0x0A (LF), 0x0C (FF), 0x0D (CR), 0x20 (SP), or 0x3E (>)
      ~RET ( %属性~名, %属性~値 ) ◎ Abort the get an attribute algorithm. The attribute's name is the value of attribute name and its value is the value of attribute value.
      ~AnyElse
      %属性~値 ~APPEND ~cp( `~byte小文字~化する$( %位置↗ ) ) ◎ If it is in the range 0x41 (A) to 0x5A (Z) • Append a code point b+0x20 to attribute value (where b is the value of the byte at position). ◎ Anything else • Append a code point with the same value as the byte at position to attribute value.
    2. %位置 ~INCBY 1 ◎ Advance position to the next byte and return to the previous step.

相互運用性のため、~UAは,上に述べたものと異なる結果を返すような予走査~algoを利用するべきでない。 (もし,そうする場合は、少なくとも我々に知らしめたし — 我々がこの~algoを改善して誰もが便益を得られるよう... ) ◎ For the sake of interoperability, user agents should not use a pre-scan algorithm that returns different results than the one described above. (But, if you do, please at least let us know, so that we can improve this algorithm and benefit everyone...)

12.2.3.3. 符号化法

~UAは、 `ENCODING$r 標準に定義される各種~符号化法 — 例えば前~節の表に挙げたもの — は~supportし~MUST。 他の符号化法は~supportしては~MUST_NOT。 ◎ User agents must support the encodings defined in the WHATWG Encoding standard, including, but not limited to, UTF-8, ISO-8859-2, ISO-8859-7, ISO-8859-8, windows-874, windows-1250, windows-1251, windows-1252, windows-1254, windows-1255, windows-1256, windows-1257, windows-1258, gb18030, Big5, ISO-2022-JP, Shift_JIS, EUC-KR, UTF-16BE, UTF-16LE, and x-user-defined. User agents must not support other encodings.

注記: 例えば、次の~supportは禁制される: CESU-8, UTF-7, BOCU-1, SCSU, EBCDIC, UTF-32 。 この仕様は、禁制されるどの符号化法も,~algo内で~supportしようと試みることはない。 そのような符号化法を~supportしたり利用した場合、予期されない挙動をもたらすことになる。 `CESU8$r `UTF7$r `BOCU1$r `SCSU$r ◎ The above prohibits supporting, for example, CESU-8, UTF-7, BOCU-1, SCSU, EBCDIC, and UTF-32. This specification does not make any attempt to support prohibited encodings in its algorithms; support and use of prohibited encodings would thus lead to unexpected behavior. [CESU8] [UTF7] [BOCU1] [SCSU]

12.2.3.4. 構文解析-中における符号化法の変更-法

~UAは、 `符号化法を変更する@ よう構文解析器から要求されたときは、所与の ( %新~符号化法 ) に対し,次の手続きを走らせ~MUST。 これが起こり得るのは、`符号化法を~sniffする~algo$にて,[ 符号化法を見出すのに失敗した場合/ 見出された符号化法は ~fileの実際の符号化法でなかった場合 ]である: ◎ When the parser requires the user agent to change the encoding, it must run the following steps. This might happen if the encoding sniffing algorithm described above failed to find a character encoding, or if it found a character encoding that was not the actual encoding of the file.

  1. %現~符号化法 ~LET 入力~streamを解釈するために利用していた符号化法 ◎ ↓
  2. ~IF[ %現~符号化法 は`~UTF-16$である ] ⇒# `確度$ ~SET `確か^i; ~RET

    %新~符号化法 は無視する — それが~UTF-16でないならば、明らかに不正なので。

    ◎ If the encoding that is already being used to interpret the input stream is a UTF-16 encoding, then set the confidence to certain and return. The new encoding is ignored; if it was anything but the same encoding, then it would be clearly incorrect.
  3. ~IF[ %新~符号化法 は`~UTF-16$である ] ⇒ %新~符号化法 ~SET `UTF-8$enc ◎ If the new encoding is a UTF-16 encoding, then change it to UTF-8.
  4. ~IF[ %新~符号化法 ~EQ `x-user-defined$enc ] ⇒ %新~符号化法 ~SET `windows-1252$enc ◎ If the new encoding is x-user-defined, then change it to windows-1252.
  5. ~IF[ %新~符号化法 は %現~符号化法 に一致するか等価である ] ⇒# `確度$ ~SET `確か^i; ~RET ◎ If the new encoding is identical or equivalent to the encoding that is already being used to interpret the input stream, then set the confidence to certain and return.\

    これは、次のときに起こる: ◎ This happens when\

    • [ ~file内に見出された符号化法~情報 ]は[ `符号化法を~sniffする~algo$が決定した符号化法 ]に合致するとき ◎ the encoding information found in the file matches what the encoding sniffing algorithm determined to be the encoding, and\
    • 構文解析器が, 1 周回~目で[ `符号化法を~sniffする~algo$が,~~正しい符号化法を見出すのに失敗した ]場合の, 2 周回~目 ◎ in the second pass through the parser if the first pass found that the encoding sniffing algorithm described in the earlier section failed to find the right encoding.
  6. ~UAの任意選択で — ~UAは 符号化法を “その場で変更する” ことを~supportするならば:

    1. %~byte列 ~LET この~algoを呼出した時点までに %現~符号化法 の復号器により変換された,入力~streamを成す~byte列
    2. ~IF[ %~byte列 に対する[ %現~符号化法, %新~符号化法 ]による~Unicode解釈は同じである ] ⇒# `文書$の`符号化法$doc ~SET %新~符号化法; 入力~streamを変換するために利用する符号化法 ~SET %新~符号化法; `確度$ ~SET `確か^i; ~RET
    ◎ If all the bytes up to the last byte converted by the current decoder have the same Unicode interpretations in both the current encoding and the new encoding, and if the user agent supports changing the converter on the fly, then the user agent may change to the new converter for the encoding on the fly. Set the document's character encoding and the encoding used to convert the input stream to the new encoding, set the confidence to certain, and return.
  7. 次のようにする下で,`文書$を再度`~navigate$する ⇒# `置換~可能化~flag$ ~SET ~ON, 同じ`~source閲覧文脈$を利用する, `確度$ ~SET `確か^i, 今度は`符号化法を~sniffする~algo$は飛ばす — 代わりに、単に,符号化法を %新~符号化法 に設定する ◎ Otherwise, navigate to the document again, with replacement enabled, and using the same source browsing context, but this time skip the encoding sniffing algorithm and instead just set the encoding to the new encoding and the confidence to certain.\

    可能なときは,これは、[ ~network層に実際に接触することなく行われる ]べきである(~memoryからの~byte列が,構文解析し直されるべきである) — 例えば、当の文書が~cache可能でないものとされていても。 これが可能でないため,[ ~network層に接触することが[ `GET^bl 以外の~methodを利用する要請を繰返す ]ことを孕む ]ことになる場合、代わりに[ `確度$ ~SET `確か^i, %新~符号化法 は無視する ]とする — 資源は、誤解釈されることになる。 ~UAは、~app開発を援助するため,利用者にこの状況を通知して~MAY。 ◎ Whenever possible, this should be done without actually contacting the network layer (the bytes should be re-parsed from memory), even if, e.g., the document is marked as not being cacheable. If this is not possible and contacting the network layer would involve repeating a request that uses a method other than `GET`), then instead set the confidence to certain and ignore the new encoding. The resource will be misinterpreted. User agents may notify the user of the situation, to aid in application development.

注記: この~algoが呼出されるのは、[ `meta$e 要素~上に新たな符号化法が宣言されている ]ことが見出されたときに限られる。 ◎ This algorithm is only invoked when a new encoding is found declared on a meta element.

12.2.3.5. 入力~streamの前処理-法

`入力~stream@ は、[ 復号された`入力~byte~stream$として, または 入力~streamを直に操作する様々な~APIから ]~pushされてきた一連の文字からなる。 ◎ The input stream consists of the characters pushed into it as the input byte stream is decoded or from the various APIs that directly manipulate the input stream.

  • `~surrogate$が生じたときは,常に `surrogate-in-input-stream$pE になるとする。 ◎ Any occurrences of surrogates are surrogate-in-input-stream parse errors.\
  • `非文字$が生じたときは,常に `noncharacter-in-input-stream$pE になるとする。 ◎ Any occurrences of noncharacters are noncharacter-in-input-stream parse errors and\
  • [ `~ASCII空白$/ `0000^U ]以外の`制御文字$が生じたときは,常に `control-character-in-input-stream$pE になるとする。 ◎ any occurrences of controls other than ASCII whitespace and U+0000 NULL characters are control-character-in-input-stream parse errors.

    注記: `0000^U 文字の取扱いは、構文解析の後の段階にて起こり,当の文字が見出された所に基づいて変わる。 それらは無視されるか, ~security上の理由から `FFFD^U に置換される。 そのため、この取扱いは, ~token化~段階, 木~構築~段階 の両者に散らばっている。 ◎ The handling of U+0000 NULL characters varies based on where the characters are found and happens at the later stages of the parsing. They are either ignored or, for security reasons, replaced with a U+FFFD REPLACEMENT CHARACTER. This handling is, by necessity, spread across both the tokenization stage and the tree construction stage.

  • 文字[ `000D^U / `000A^U ]は、特別に扱われ~MUST:

    1. ~CR の直後の ~LF は無視され~MUST
    2. すべての~CR は ~LF に変換され~MUST

    したがって,~HTML~DOM内では、すべての改行文字は ~LF で表現され,~CRは決して`~token化~段階$に入力されない。

    ◎ U+000D CARRIAGE RETURN (CR) characters and U+000A LINE FEED (LF) characters are treated specially. Any LF character that immediately follows a CR character must be ignored, and all CR characters must then be converted to LF characters. Thus, newlines in HTML DOMs are represented by LF characters, and there are never any CR characters in the input to the tokenization stage.

`次n入力~文字@ は、`入力~stream$内の[ まだ消費-されていない, かつ この節の要件により明示的に無視されていない ]文字のうち,最初のものを指す。 初期~時の`次n入力~文字$は、入力~内の最初の文字とする 【入力が空の場合、下に述べる ~EOF になる】 。 `現在の入力~文字@ は、最後に `消費-^i された文字とする。 ◎ The next input character is the first character in the input stream that has not yet been consumed or explicitly ignored by the requirements in this section. Initially, the next input character is the first character in the input. The current input character is the last character to have been consumed.

`挿入~地点@ は、[ ある文字 / 入力~streamの終端 ]の直前を指す位置であり、 `document.write()$m を利用して挿入される内容が実際に挿入される所である。 挿入~地点は、[ その直後の文字の位置 ]に相対的であり、入力~streamの中を指す絶対的~offsetではない。 初期~時には、挿入~地点は ε (未定義)とする。 ◎ The insertion point is the position (just before a character or just before the end of the input stream) where content inserted using document.write() is actually inserted. The insertion point is relative to the position of the character immediately after it, it is not an absolute offset into the input stream. Initially, the insertion point is undefined.

以下における記号 ~EOF は、`入力~stream$の終端を表現する概念的な文字であり,文字が消費され尽くしたことを表す。 構文解析器が ~scriptにより作成されたものである場合、( `document.close()$m ~methodにより挿入される) `明示的な~EOF@ で,`入力~stream$は終端する。 ◎ The "EOF" character in the tables below is a conceptual character representing the end of the input stream. If the parser is a script-created parser, then the end of the input stream is reached when an explicit "EOF" character (inserted by the document.close() method) is consumed. Otherwise, the "EOF" character is not a real character in the stream, but rather the lack of any further characters.

12.2.4. 構文解析-状態

12.2.4.1. 挿入~mode

`挿入~mode@ は,状態~変数であり、木~構築~段階の主要な演算を制御する。 それは、~tokenがどう処理されるか, および `~CDATAsec$は~supportされるかどうかに影響し、構文解析の~~進行に伴い,`木~構築~段階$の中で次のいずれかに変化し得る:

  • `初期$md — これが、初期~時の`挿入~mode$
  • `~htmlの前$md
  • `~headの前$md
  • `~head内$md
  • `~head~noscript内$md
  • `~headの後$md
  • `~body内$md
  • `~text$md
  • `~table内$md
  • `~table~text内$md
  • `~caption内$md
  • `~column-group内$md
  • `~table~body内$md
  • `~row内$md
  • `~cell内$md
  • `~select内$md
  • `~table内~select内$md
  • `~template内$md
  • `~bodyの後$md
  • `~frameset内$md
  • `~framesetの後$md
  • `~bodyの後の後$md
  • `~framesetの後の後$md
◎ The insertion mode is a state variable that controls the primary operation of the tree construction stage. ◎ Initially, the insertion mode is "initial". It can change to "before html", "before head", "in head", "in head noscript", "after head", "in body", "text", "in table", "in table text", "in caption", "in column group", "in table body", "in row", "in cell", "in select", "in select in table", "in template", "after body", "in frameset", "after frameset", "after after body", and "after after frameset" during the course of the parsing, as described in the tree construction stage. The insertion mode affects how tokens are processed and whether CDATA sections are supported.

これらの`挿入~mode$のうち[ `~head内$md / `~body内$md / `~table内$md / `~select内$md 【/ `~template内$md 】 ]は、他の~modeが様々な時点で これらの~modeへ先送りする点で特別である — すなわち,以下の~algoにて、ここに挙げたいずれかの~mode %m に対し, %m `用の規則を用いて@ %何か を行う と記される所では、~UAは, %m `挿入~mode$の節に述べる規則を利用し~MUST — %m 内の規則~自身が`挿入~mode$を他の~modeへ切替えない限り、`挿入~mode$は変更することなく。 ◎ Several of these modes, namely "in head", "in body", "in table", and "in select", are special, in that the other modes defer to them at various times. When the algorithm below says that the user agent is to do something "using the rules for the m insertion mode", where m is one of these modes, the user agent must use the rules described under the m insertion mode's section, but must leave the insertion mode unchanged unless the rules in m themselves switch the insertion mode to a new value.

挿入~modeが[ `~text$md / `~table~text内$md ]に切替えられるときは、 `元の挿入~mode@V も設定される。 これは、木~構築~段階が後で戻ることになる,挿入~modeを指す。 ◎ When the insertion mode is switched to "text" or "in table text", the original insertion mode is also set. This is the insertion mode to which the tree construction stage will return.

同様に,入子にされた `template$e 要素を構文解析するときには、 `~template挿入~mode~stack@ が利用される — それは 0 個~以上の`挿入~mode$からなる`~stack$であり†,初期~時には空とする。 ◎ Similarly, to parse nested template elements, a stack of template insertion modes is used. It is initially empty. The current template insertion mode is the insertion mode that was most recently added to the stack of template insertion modes. The algorithms in the sections below will push insertion modes onto this stack, meaning that the specified insertion mode is to be added to the stack, and pop insertion modes from the stack, which means that the most recently added insertion mode must be removed from the stack.

【† この訳では `Infra$r による`~stack$の定義を参照して、原文の記述を簡約している。 】


以下の手続きにて `挿入~modeを適切に再設定する@ ときは、`挿入~mode$を次の手続きを走らせた結果に設定し~MUST: ◎ When the steps below require the UA to reset the insertion mode appropriately, it means the UA must follow these steps:

  1. %~stack ~LET `~open要素~stack$ ◎ ↓
  2. ~Assert: %~stack は空でない ◎ ↓
  3. %最後の ~LET ~F ◎ Let last be false.
  4. %~stack 内の~EACH( %~node ) に対し,末尾から順に: ◎ Let node be the last node in the stack of open elements.

    1. ~IF[ %~node は %~stack の先頭の~nodeである ]:

      1. %最後の ~SET ~T
      2. ~IF[ %構文解析器 は `~HTML素片~用$である (`素片~事例$) ] ⇒ %~node ~SET その~algoに渡された `文脈~要素$V
      ◎ Loop: If node is the first node in the stack of open elements, then set last to true, and, if the parser was originally created as part of the HTML fragment parsing algorithm (fragment case), set node to the context element passed to that algorithm.
    2. %~node の型に応じて: ◎ ↓

      `select$e ◎ If node is a select element, run these substeps:
      1. ~IF[ %~stack 内に次をいずれも満たす要素は在る ]:

        • `table$e である
        • %~stack 内で %~node より前に在る
        • %~stack 内の,要素より後, かつ %~node より前には、 `template$e ~nodeは無い

        …ならば ⇒ ~RET `~table内~select内$md

        ◎ If last is true, jump to the step below labeled done. ◎ Let ancestor be node. ◎ Loop: If ancestor is the first node in the stack of open elements, jump to the step below labeled done. ◎ Let ancestor be the node before ancestor in the stack of open elements. ◎ If ancestor is a template node, jump to the step below labeled done. ◎ If ancestor is a table node, switch the insertion mode to "in select in table" and return. ◎ Jump back to the step labeled loop.
      2. ~RET `~select内$md ◎ Done: Switch the insertion mode to "in select" and return.
      `td$e
      `th$e
      ~IF[ %最後の ~EQ ~F ] ⇒ ~RET `~cell内$md ◎ If node is a td or th element and last is false, then switch the insertion mode to "in cell" and return.
      `tr$e
      ~RET `~row内$md ◎ If node is a tr element, then switch the insertion mode to "in row" and return.
      `tbody$e
      `thead$e
      `tfoot$e
      ~RET `~table~body内$md ◎ If node is a tbody, thead, or tfoot element, then switch the insertion mode to "in table body" and return.
      `caption$e
      ~RET `~caption内$md ◎ If node is a caption element, then switch the insertion mode to "in caption" and return.
      `colgroup$e
      ~RET `~column-group内$md ◎ If node is a colgroup element, then switch the insertion mode to "in column group" and return.
      `table$e
      ~RET `~table内$md ◎ If node is a table element, then switch the insertion mode to "in table" and return.
      `template$e
      ~RET `~template挿入~mode~stack$の最後の~item ◎ If node is a template element, then switch the insertion mode to the current template insertion mode and return.
      `head$e
      ~IF[ %最後の ~EQ ~F ] ⇒ ~RET `~head内$md ◎ If node is a head element and last is false, then switch the insertion mode to "in head" and return.
      `body$e
      ~RET `~body内$md ◎ If node is a body element, then switch the insertion mode to "in body" and return.
      `frameset$e(`素片~事例$)
      ~RET `~frameset内$md ◎ If node is a frameset element, then switch the insertion mode to "in frameset" and return. (fragment case)
      `html$e
      ~RET [ `~head要素~pointer$ ~EQ ~NULL(`素片~事例$)ならば `~headの前$md / ~ELSE_ `~headの後$md ] ◎ If node is an html element, run these substeps: ◎ If the head element pointer is null, switch the insertion mode to "before head" and return. (fragment case) ◎ Otherwise, the head element pointer is not null, switch the insertion mode to "after head" and return.
    3. ~IF[ %最後の ~EQ ~T (`素片~事例$) ] ⇒ ~RET `~body内$md ◎ If last is true, then switch the insertion mode to "in body" and return. (fragment case) ◎ Let node now be the node before node in the stack of open elements. ◎ Return to the step labeled loop.

12.2.4.2. ~open要素~stack

初期~時には `~open要素~stack@ は空とする。 この~stackは、末尾側( downward† )へ成長する — ~stackの先頭の~nodeは,~stackに最初に追加されたものであり、~stackの末尾の~nodeは,~stackに最も近過去に追加されたものである( 誤入子な~tagを取扱う 一部として,~stackが~random~access的に操作されたときであっても)。 ◎ Initially, the stack of open elements is empty. The stack grows downwards; the topmost node on the stack is the first one added to the stack, and the bottommost node of the stack is the most recently added node in the stack (notwithstanding when the stack is manipulated in a random access fashion as part of the handling for misnested tags).

【† この語 downward, および原文に現れる[ bottommost, bottom / topmost, top / lower ]などの語は、[ この~stackが表現する,~nodeたちが成す入子 ]の “深さ” を反映することを意図して用いられているが、この訳では,一律に,通例の~listにおける順序関係を表す語( 先頭, 〜のうち最初の, 末尾, 〜のうち最後の, 〜より後, 〜より前 )を用いて表記する。 ~stackの bottom や top が[ ~listとしての~stack ]の先頭, 末尾のどちらかを指すか直感的でないことに加え、原文には,これら~list用の語( first, last, after, before)も混用されていて,惑わされるので。 】

注記: `挿入~mode$ `~htmlの前$mdでは、 `html$e `文書~要素$が作成され,~stackに追加される。 ◎ The "before html" insertion mode creates the html document element, which is then added to the stack.

注記: `素片~事例$においては、`~open要素~stack$は,[ `~HTML素片の構文解析~algo$の一部として作成された `html$e 要素 ]を包含するように初期化される(`素片~事例$は`~htmlの前$md `挿入~mode$を飛ばす)。 ◎ In the fragment case, the stack of open elements is initialized to contain an html element that is created as part of that algorithm. (The fragment case skips the "before html" insertion mode.)

`html$e ~nodeは、どう作成されたものであれ,~stackの先頭の~nodeになる。 それが~stackから~popされるのは、構文解析器が 完遂したときに限られる。 ◎ The html node, however it is created, is the topmost node of the stack. It only gets popped off the stack when the parser finishes.

`現在の~node@ は、この`~open要素~stack$の末尾の~nodeを指す。 ◎ The current node is the bottommost node in this stack of open elements.

`現在の調整-済み~node@ は、[ %構文解析器 は `~HTML素片~用$であって `~open要素~stack$は唯一の要素からなる(`素片~事例$)ならば `文脈~要素$V / ~ELSE_ `現在の~node$ ]を指す。 ◎ The adjusted current node is the context element if the parser was created by the HTML fragment parsing algorithm and the stack of open elements has only one element in it (fragment case); otherwise, the adjusted current node is the current node.

`~open要素~stack$内の各 要素は、次のいずれかに分類される: ◎ Elements in the stack of open elements fall into the following categories:

`特別な要素@ ◎ Special

次に挙げる要素~型には、様々な~levelの特別な構文解析~規則がある:

  • ~HTMLの `address$e, `applet$e, `area$e, `article$e, `aside$e, `base$e, `basefont$e, `bgsound$e, `blockquote$e, `body$e, `br$e, `button$e, `caption$e, `center$e, `col$e, `colgroup$e, `dd$e, `details$e, `dir$e, `div$e, `dl$e, `dt$e, `embed$e, `fieldset$e, `figcaption$e, `figure$e, `footer$e, `form$e, `frame$e, `frameset$e, `h6$e, `h6$e, `h6$e, `h6$e, `h6$e, `h6$e, `head$e, `header$e, `hgroup$e, `hr$e, `html$e, `iframe$e, `img$e, `input$e, `keygen$e, `li$e, `link$e, `listing$e, `main$e, `marquee$e, `menu$e, `meta$e, `nav$e, `noembed$e, `noframes$e, `noscript$e, `object$e, `ol$e, `p$e, `param$e, `plaintext$e, `pre$e, `script$e, `section$e, `select$e, `source$e, `style$e, `summary$e, `table$e, `tbody$e, `td$e, `template$e, `textarea$e, `tfoot$e, `th$e, `thead$e, `title$e, `tr$e, `track$e, `ul$e, `wbr$e, `xmp$e
  • ~MathMLの `mi$e, `mo$e, `mn$e, `ms$e, `mtext$e, `annotation-xml$e
  • ~SVGの `foreignObject$e, `desc$e, `title$e
◎ The following elements have varying levels of special parsing rules: HTML's address, applet, area, article, aside, base, basefont, bgsound, blockquote, body, br, button, caption, center, col, colgroup, dd, details, dir, div, dl, dt, embed, fieldset, figcaption, figure, footer, form, frame, frameset, h1, h2, h3, h4, h5, h6, head, header, hgroup, hr, html, iframe, img, input, keygen, li, link, listing, main, marquee, menu, meta, nav, noembed, noframes, noscript, object, ol, p, param, plaintext, pre, script, section, select, source, style, summary, table, tbody, td, template, textarea, tfoot, th, thead, title, tr, track, ul, wbr, xmp; MathML mi, MathML mo, MathML mn, MathML ms, MathML mtext, and MathML annotation-xml; and SVG foreignObject, SVG desc, and SVG title.
注記: `image^c 開始tag~tokenは、木を築くときに取扱われるが,この~list内にはない — それは要素ではなく, `img$e 要素に転換されるので。 ◎ An image start tag token is handled by the tree builder, but it is not in this list because it is not an element; it gets turned into an img element.
`整形~要素@ ◎ Formatting
次に挙げる~HTML要素は、`作動中の整形~要素~list$内に加えられることになる ⇒ `a$e, `b$e, `big$e, `code$e, `em$e, `font$e, `i$e, `nobr$e, `s$e, `small$e, `strike$e, `strong$e, `tt$e, `u$e ◎ The following HTML elements are those that end up in the list of active formatting elements: a, b, big, code, em, font, i, nobr, s, small, strike, strong, tt, and u.
`普通の要素@ ◎ Ordinary
~HTML文書の構文解析している間に見出された,他のすべての要素。 ◎ All other elements found while parsing an HTML document.

注記: 概して、`特別な要素$の[ 開始tag / 終了tag ]~tokenは,特定的な分岐で取扱われる一方で、`普通の要素$の~tokenは,[ “その他の開始tag” / “その他の終了tag” ]と記される分岐に仕分けられる。 また,木を築くときには、[ `~open要素~stack$内の特定0の要素が`特別$である ]かどうか検査する箇所がいくつかある。 [ 開始tag / 終了tag ]~tokenが特定的な分岐で取扱われる要素は,他にもあるが(例: `option$e 要素)、他所では`普通の要素$として取扱われるので,`特別$とされない。 ◎ Typically, the special elements have the start and end tag tokens handled specifically, while ordinary elements' tokens fall into "any other start tag" and "any other end tag" clauses, and some parts of the tree builder check if a particular element in the stack of open elements is in the special category. However, some elements (e.g., the option element) have their start or end tag tokens handled specifically, but are still not in the special category, so that they get the ordinary handling elsewhere.

`~open要素~stack$において、特定の `視野~内@ に ある条件を満たす要素が `在る^i とは、所与の:

  1. 視野を与える いくつか要素~型からなる集合 %S

    【 要素~型は、 ( 要素の~tag名, 要素が属する名前空間) の組であることに注意。 名前空間が明示的に指定されていないものは、 ~HTML名前空間に属する。 】

  2. 条件 %~target条件 — ここで、条件 として:

    • 要素~型(または それらの集合)が与えられた場合、条件は “その(いずれかの)要素~型である” と解釈する。
    • ある要素~instanceが与えられた場合、条件は “その要素と同じ~instance” と解釈する。

に対し,[ 次の~algoを走らせた結果 ~EQ `在る^i ]になることを意味する。 `視野~内$に `無い^i は、その否定を意味する:

◎ The stack of open elements is said to have an element target node in a specific scope consisting of a list of element types list when the following algorithm terminates in a match state:
  1. ~Assert: `html$e ~IN %S ◎ ↓
  2. `~open要素~stack$内の~EACH( %~node ) に対し,末尾から順に: ◎ Initialize node to be the current node (the bottommost node of the stack).

    1. ~IF[ %~node は %~target条件 を満たす ] ⇒ ~RET `在る^i ◎ If node is the target node, terminate in a match state.
    2. ~IF[ %~node の要素~型 ~IN %S ] ⇒ ~RET `無い^i ◎ Otherwise, if node is one of the element types in list, terminate in a failure state.
  3. ~Assert: ~stackの先頭は `html$e 要素なので、この段に達することは決してない ◎ Otherwise, set node to the previous entry in the stack of open elements and return to step 2. (This will never fail, since the loop will always terminate in the previous step if the top of the stack — an html element — is reached.)

上の “`視野~内$” 手続きに与える要素~型の集合 %S として、次のものが定義される: ◎ ↑↓

`既定の視野@ ◎ The stack of open elements is said to have a particular element in scope when it has that element in the specific scope consisting of the following element types:
`applet$e, `caption$e, `html$e, `table$e, `td$e, `th$e, `marquee$e, `object$e, `template$e ◎ applet caption html table td th marquee object template
`~MathML名前空間$に属する,次に挙げる要素~型 ⇒ `mi$e, `mo$e, `mn$e, `ms$e, `mtext$e, `annotation-xml$e ◎ template MathML mi MathML mo MathML mn MathML ms MathML mtext MathML annotation-xml
`~SVG名前空間$に属する,次に挙げる要素~型 ⇒ `foreignObject$e, `desc$e, `title$e ◎ SVG foreignObject SVG desc SVG title
`~list~item視野@ ◎ The stack of open elements is said to have a particular element in list item scope when it has that element in the specific scope consisting of the following element types:
`既定の視野$ ◎ All the element types listed above for the has an element in scope algorithm.
`ol$e,`ul$e ◎ ol in the HTML namespace ◎ ul in the HTML namespace
`~button視野@ ◎ The stack of open elements is said to have a particular element in button scope when it has that element in the specific scope consisting of the following element types:
`既定の視野$ ◎ All the element types listed above for the has an element in scope algorithm.
`button$e ◎ button in the HTML namespace
`~table視野@ ◎ The stack of open elements is said to have a particular element in table scope when it has that element in the specific scope consisting of the following element types:
`html$e, `table$e, `template$e ◎ html in the HTML namespace ◎ table in the HTML namespace ◎ template in the HTML namespace
`~select視野@ ◎ The stack of open elements is said to have a particular element in select scope when it has that element in the specific scope consisting of all element types except the following:
[ `optgroup$e, `option$e ]以外の,すべての要素~型(名前空間を問わず) ◎ • optgroup in the HTML namespace • option in the HTML namespace

どの時点であれ、`~open要素~stack$内の要素が,`文書$を成す木~内の他所へ移動されても, あるいは木から除去されても,~~特別な何かが起こることはない — 特に、この状況においても,~stackは変更されない。 その結果、もはや~DOM内にない~nodeに内容が付加されることもある — 変則的な効果は他にもあるが。 ◎ Nothing happens if at any time any of the elements in the stack of open elements are moved to a new location in, or removed from, the Document tree. In particular, the stack is not changed in this situation. This can cause, amongst other strange effects, content to be appended to nodes that are no longer in the DOM.

注記: 一部の事例(すなわち,誤入子な整形~要素を閉じるとき )では、~stackは~random~access的に操作される。 ◎ In some cases (namely, when closing misnested formatting elements), the stack is manipulated in a random-access fashion.

12.2.4.3. 作動中の整形~要素からなる~list

`作動中の整形~要素~list@ は、誤入子な`整形~要素$~tagを取扱うために利用され,初期~時には空とする。 ◎ Initially, the list of active formatting elements is empty. It is used to handle mis-nested formatting element tags.

この~listは、一連の[ `整形~要素$/`~marker$ ]からなる。 `~marker@ は、[ `applet$e / `object$e / `marquee$e / `template$e / `td$e / `th$e / `caption$e ]要素に入るとき挿入され,[ 整形が,これらの要素の中へ “漏れる” ]のを防ぐために利用される。 ◎ The list contains elements in the formatting category, and markers. The markers are inserted when entering applet, object, marquee, template, td, th, and caption elements, and are used to prevent formatting from "leaking" into applet, object, marquee, template, td, th, and caption elements.

加えて、`作動中の整形~要素~list$内の各~要素には,それを `作成させた~token@ が結付けられる — 必要とされれば,その~token用の要素を更に作成できるように。 ◎ In addition, each element in the list of active formatting elements is associated with the token for which it was created, so that further elements can be created for that token if necessary.

以下の手続きにて `作動中の整形~要素~listに~pushする@ ときは、所与の ( `整形~要素$ %整形~要素 ) に対し,次の手続きを遂行し~MUST: ◎ When the steps below require the UA to push onto the list of active formatting elements an element element, the UA must perform the following steps:

  1. %~list ~LET `作動中の整形~要素~list$
  2. ~IF[ %~list 内に次を満たす要素が 3 個~以上ある ]…:

    • %整形~要素 と同じ[ ~tag名, 名前空間, 属性たち ]を有する
    • %~list 内には,要素より前に`~marker$はない
    ◎ If there are already three elements in the list of active formatting elements after the last marker, if any, or anywhere in the list if there are no markers, that have the same tag name, namespace, and attributes as element, then\

    …ならば ⇒ 該当する要素のうち, %~list 内で最初のものを %~list から除去する ◎ remove the earliest such element from the list of active formatting elements.\

    この段の目的においては: ◎ For these purposes,\

    • 各~属性を比較するときは、要素が %構文解析器 により作成された時点のものを利用し~MUST。 ◎ the attributes must be compared as they were when the elements were created by the parser;\
    • 2 つの要素が同じ属性たちを有するとは、互いのどの属性も[ 名前, 名前空間, 値 ]が一致するよう対にできることを意味する(属性の順序は問わない)。 ◎ two elements have the same attributes if all their parsed attributes can be paired such that the two attributes in each pair have identical names, namespaces, and values (the order of the attributes does not matter).

    注記: これがノアの方舟(Noah's Ark )条項である — 各組は、つがいではなく,三つ組だが。 ◎ This is the Noah's Ark clause. But with three per family instead of two.

  3. %~list に %整形~要素 を追加する ◎ Add element to the list of active formatting elements.

以下の手続きにて `作動中の整形~要素たちを再構築する@ ときは、次を走らせ~MUST: ◎ When the steps below require the UA to reconstruct the active formatting elements, the UA must perform the following steps:

  1. %~list ~LET `作動中の整形~要素~list$ ◎ ↓
  2. %開始~entry ~LET ε ◎ ↓
  3. %~list 内の~EACH( %~entry ) に対し,最後の(最も近過去に追加された)~entryから順に:

    1. ~IF[ %~entry は`~marker$である ]~OR[ %~entry ~IN `~open要素~stack$ ] ⇒ ~BREAK
    2. %開始~entry ~SET %~entry
    ◎ If there are no entries in the list of active formatting elements, then there is nothing to reconstruct; stop this algorithm. ◎ If the last (most recently added) entry in the list of active formatting elements is a marker, or if it is an element that is in the stack of open elements, then there is nothing to reconstruct; stop this algorithm. ◎ Let entry be the last (most recently added) element in the list of active formatting elements. ◎ Rewind: If there are no entries before entry in the list of active formatting elements, then jump to the step labeled create. ◎ Let entry be the entry one earlier than entry in the list of active formatting elements. ◎ If entry is neither a marker nor an element that is also in the stack of open elements, go to the step labeled rewind. ◎ Advance: Let entry be the element one later than entry in the list of active formatting elements.
  4. ~IF[ %開始~entry ~EQ ε ] ⇒ ~RET — 再構築するものは何もない ◎ ↑
  5. %~list 内の %開始~entry 以降の~EACH( %~entry ) に対し, %開始~entry から順に ⇒ %~list 内の %~entry を次の結果に置換する ⇒ `~HTML要素を挿入する$( %~entry を`作成させた~token$ ) ◎ Create: Insert an HTML element for the token for which the element entry was created, to obtain new element. ◎ Replace the entry for entry in the list with an entry for new element. ◎ If the entry for new element in the list of active formatting elements is not the last entry in the list, return to the step labeled advance.

これにより、次に該当する要素のうち,まだ明示的に閉じられてないものすべては、再び開かれることになる ⇒ 現在の[[ `body^e, `cell^e, `caption^e ]のうち,最も近過去のもの ]内で開かれた整形~要素。 ◎ This has the effect of reopening all the formatting elements that were opened in the current body, cell, or caption (whichever is youngest) that haven't been explicitly closed.

注記: この仕様は、[ `作動中の整形~要素~list$を成す要素たちの順序は,常に時系列順(最も近過去に追加された要素が最後)になる ]ように書かれている。 ◎ The way this specification is written, the list of active formatting elements always consists of elements in chronological order with the least recently added element first and the most recently added element last (except for while steps 7 to 10 of the above algorithm are being executed, of course).

以下の手続きにて `作動中の整形~要素~listを最後の~markerまで~clearする@ ときは、次を遂行し~MUST: ◎ When the steps below require the UA to clear the list of active formatting elements up to the last marker, the UA must perform the following steps:

  1. `作動中の整形~要素~list$ %~list 内の~EACH( %~entry ) に対し,最後の(最も近過去に追加された)~entryから順に: ◎ Let entry be the last (most recently added) entry in the list of active formatting elements.

    1. %~list から %~entry を除去する ◎ Remove entry from the list of active formatting elements.
    2. ~IF[ %~entry は`~marker$である ] ⇒ ~BREAK ◎ If entry was a marker, then stop the algorithm at this point. The list has been cleared up to the last marker. ◎ Go to step 1.

12.2.4.4. 要素を指す~pointer

`~head要素~pointer@
初期~時は ~NULL とする。 ◎ Initially, the head element pointer and the form element pointer are both null.
`head$e 要素が(暗黙的/明示的いずれにせよ)構文解析された時点で,その~nodeを指すよう設定される。 ◎ Once a head element has been parsed (whether implicitly or explicitly) the head element pointer gets set to point to this node.
`~form要素~pointer@
初期~時は ~NULL とする。 ◎ ↑
[ 開かれている `form$e 要素 ]のうち,まだ終了tagには出くわしてないもの ]のうち,最後のものを指す。 ◎ The form element pointer points to the last form element that was opened and whose end tag has not yet been seen.\
これは、歴史的~理由から、ひどく不良な~markupに面したとき,~form-controlを~formに所有させるために利用される。 ◎ It is used to make form controls associate with forms in the face of dramatically bad markup, for historical reasons.\
これは、 `template$e 要素の内側では無視される。 ◎ It is ignored inside template elements.

12.2.4.5. 他の構文解析~状態~flag

`~scripting~flag@
%構文解析器 が作成された時点で、[ 次が満たされるならば `可能化^i / ~ELSE_ `不能化^i ]に設定される ⇒ %構文解析器 に結付けられている`文書$において `~scriptingは可能化されて$いる ◎ The scripting flag is set to "enabled" if scripting was enabled for the Document with which the parser is associated when the parser was created, and "disabled" otherwise.
注記: `~scripting~flag$は、 %構文解析器 が`~HTML素片~用$であるときでも,可能化され得る — その事例では `script$e 要素は実行しないが。 ◎ The scripting flag can be enabled even when the parser was originally created for the HTML fragment parsing algorithm, even though script elements don't execute in that case.
`~frameset-ok~flag@
%構文解析器 の作成-時には `ok^i に設定される。 ある種の~tokenに出くわしたとき,`not-ok^i になる。 ◎ The frameset-ok flag is set to "ok" when the parser is created. It is set to "not ok" after certain tokens are seen.

12.2.5. ~token化

実装は、~HTMLを~token化するときには,以下に述べる状態~機械を利用したかのように動作し~MUST — この状態~機械は: ◎ Implementations must act as if they used the following state machine to tokenize HTML.\

  • `~data$stから開始し~MUST。 ◎ The state machine must start in the data state.\
  • ほとんどの`状態$は,文字を 1 個だけ消費するが、様々な副作用を備えるものもある。 また、状態~機械を新たな`状態$に切替えて[ `現在の入力~文字$を`再消費-$/`次n入力~文字$を消費- ]するか、同じ`状態$に留まって次n文字を消費する。 ◎ Most states consume a single character, which may have various side-effects, and either switches the state machine to a new state to reconsume the current input character, or switches it to a new state to consume the next character, or stays in the same state to consume the next character.\
  • 一部の`状態$では、別の`状態$に`切替える$前に何個かの文字を消費するよう,より複雑に挙動する。 ◎ Some states have more complicated behavior and can consume several characters before switching to another state.\
  • 一部の事例では、~tokenizerの`状態$は,木~構築~段階の中でも変更される。 ◎ In some cases, the tokenizer state is also changed by the tree construction stage.

ある`状態$の下で,別の`状態$ %S を指定した上で:

  • %S に `切替える@ と記された所では、以降に消費する文字は %S の下で取扱うことを意味する。
  • (直前に消費した文字を) “%S 内で `再消費-@ する” と記された所では、 %S に`切替える$ことに加え、`次n入力~文字$を消費しようと試みるときには,代わりに`現在の入力~文字$を %S に供することを意味する。
◎ When a state says to reconsume a matched character in a specified state, that means to switch to that state, but when it attempts to consume the next input character, provide it with the current input character instead.

ある種の`状態$においては:

  • その正確な挙動は[ `挿入~mode$, `~open要素~stack$ ]に依存する。
  • 進捗-を追跡するために `一時~buffer@V も利用する。
  • `文字~参照$stは、それを呼出した`状態$へ戻るために `戻先~状態@V を利用する。
◎ The exact behavior of certain states depends on the insertion mode and the stack of open elements. Certain states also use a temporary buffer to track progress, and the character reference state uses a return state to return to the state it was invoked from.

~token化~段の出力は、一連の 0 個~以上の~tokenからなる。 その各~tokenは、次のいずれかとして与えられる: ◎ The output of the tokenization step is a series of zero or more of the following tokens: DOCTYPE, start tag, end tag, comment, character, end-of-file.\

~DOCTYPE~token

それぞれが次のものを持つ — 作成-時には括弧内に与える値にされ~MUST:

  • 名前( ε )
  • ~publicID( ε )
  • ~systemID( ε )
  • `過去互換強制~flag@( ~OFF )
◎ DOCTYPE tokens have a name, a public identifier, a system identifier, and a force-quirks flag. When a DOCTYPE token is created, its name, public identifier, and system identifier must be marked as missing (which is a distinct state from the empty string), and the force-quirks flag must be set to off (its other state is on).\
開始tag~token
終了tag~token

いずれも,それぞれが次のものを持つ:

~tag名
作成-時に与えられる。
`自己閉じ~flag@
初期~時は ~OFF
属性~list
一連の属性からなる~listであり、初期~時は空とする — そのそれぞれは,名前(初期~時は空)と値(初期~時は空)からなる。
◎ Start and end tag tokens have a tag name, a self-closing flag, and a list of attributes, each of which has a name and a value. When a start or end tag token is created, its self-closing flag must be unset (its other state is that it be set), and its attributes list must be empty.\
“新たな開始tag~token( %名前 )” という表記は、新たな開始tag~tokenであって[ その~tag名 ~SET %名前 ]にされたものを表すとする。 ◎ \
“新たな終了tag~token()” という表記は、新たな終了tag~tokenであって[ その~tag名 ~SET 空~文字列 ]にされたものを表すとする。 ◎ \
~comment~token
それぞれが、作成-時に与えられる~data(文字列)を持つ。 ◎ Comment and\
“新たな~comment~token( %~data )” という表記は、新たな~comment~tokenであって[ その~data ~SET %~data ]にされたものを表すとする。
文字~token
それぞれが、作成-時に与えられる 1 個の文字を持つ。 ◎ character tokens have data.\
“新たな文字~token( %文字 )” という表記は、新たな文字~tokenであって[ その文字 ~SET %文字 ]にされたものを表すとする。 ◎ \
~eof~token
入力~全体の終端を表現する~token。 ◎ \

~tokenが発されたときは、`木~構築~段階$により即時に取扱われ~MUST。 木~構築~段階は、~token化~段階の`状態$に影響することもあり,~streamの中に追加の文字たちを挿入することもある(例えば, `script$e 要素は、 動的~markup挿入 ~APIを利用している~scriptを実行した結果、~token化された~streamの中に文字たちを挿入することもある。) ◎ When a token is emitted, it must immediately be handled by the tree construction stage. The tree construction stage can affect the state of the tokenization stage, and can insert additional characters into the stream. (For example, the script element can result in scripts executing and using the dynamic markup insertion APIs to insert characters into the stream being tokenized.)

注記: ~tokenを[ 作成すること, 発すること ]は、別個の動作である。 ~tokenは、作成されただけで発されることは決してなく,暗黙的に遺棄され得る — 例: 開始tag~tokenに構文解析される文字たちを処理している間、当の~fileが予期せず終端した場合。 ◎ Creating a token and emitting it are distinct actions. It is possible for a token to be created but implicitly abandoned (never emitted), e.g. if the file ends unexpectedly while processing the characters that are being parsed into a start tag token.

  • 開始tag~tokenが[ その`自己閉じ~flag$ ~SET ~ON ]にされて発されたときは、それが木~構築~段階により処理されるときに[ ~tokenの `自己閉じ~flagを承認する@ ]が行われていなければ, `non-void-html-element-start-tag-with-trailing-solidus$pE になるとする。 ◎ When a start tag token is emitted with its self-closing flag set, if the flag is not acknowledged when it is processed by the tree construction stage, that is a non-void-html-element-start-tag-with-trailing-solidus parse error.
  • 属性を伴う終了tag~tokenが発されたときは、 `end-tag-with-attributes$pE になるとする。 ◎ When an end tag token is emitted with attributes, that is an end-tag-with-attributes parse error.
  • 終了tag~tokenが[ その`自己閉じ~flag$ ~SET ~ON ]にされて発されたときは、 `end-tag-with-trailing-solidus$pE になるとする ◎ When an end tag token is emitted with its self-closing flag set, that is an end-tag-with-trailing-solidus parse error.

終了tag~tokenは、次を満たすならば `適切な終了tag~token@ とされる ⇒ この~tokenizerから,それまでに 1 個~以上の開始tag~tokenが発されていて,それらのうち最後に発されたものと 終了tag~tokenの~tag名は合致する ◎ An appropriate end tag token is an end tag token whose tag name matches the tag name of the last start tag to have been emitted from this tokenizer, if any. If no start tag has been emitted from this tokenizer, then no end tag token is appropriate.

`戻先~状態$V ~IN { `二重引用符付き属性~値$st, `一重引用符付き属性~値$st, `引用符無し属性~値$st } にある下での`文字~参照$は、 `属性の一部として消費されて@ いるとされる。 ◎ A character reference is said to be consumed as part of an attribute if the return state is either attribute value (double-quoted) state, attribute value (single-quoted) state or attribute value (unquoted) state.

ある`状態$の下で `文字~参照として消費される~cpを一掃する@ と記された所では、次をし~MUST: ◎ When a state says to flush code points consumed as a character reference, it means that \

  1. `一時~buffer$V 内の ~EACH( `~cp$ %~cp ) に対し: ◎ for each code point in the temporary buffer (in the order they were added to the buffer) user agent must\

    1. ~IF[ 当の文字~参照-は`属性の一部として消費されて$いる ] ⇒ 現在の属性の値 ~APPEND %~cp ◎ append the code point from the buffer to the current attribute's value if the character reference was consumed as part of an attribute, or\
    2. ~ELSE ⇒ 新たな文字~token( %~cp ) を発する ◎ emit the code point as a character token otherwise.

~UAは、~tokenizerを成す各~段の前に,次をし~MUST ⇒ ~IF[ %構文解析器 の`静止~flag$ ~EQ ~T ] ⇒ 入子にされた~tokenizerの呼出があれば,その処理を中止して、~call元に制御を明け渡す ◎ 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 any nested invocations of the tokenizer, yielding control back to the caller.

~tokenizerを成す状態~機械は、以下の各 下位節にて定義される各種 `状態@ からなる。 【この頁~全体を通して、名前 X の`状態$は, `X^st のように呈示される。】 ◎ The tokenizer state machine consists of the states defined in the following subsections.

12.2.5.1. `~data^st

`次n入力~文字$を消費する: ◎ Consume the next input character:

`0026^U
  1. `戻先~状態$V ~SET `~data$st
  2. `文字~参照$stに`切替える$
◎ Set the return state to the data state. Switch to the character reference state.
`003C^U
  1. `~tag~open$stに`切替える$
◎ Switch to the tag open state.
`0000^U
  1. `unexpected-null-character$pE
  2. 新たな文字~token( `現在の入力~文字$ ) を発する
◎ This is an unexpected-null-character parse error. Emit the current input character as a character token.
~EOF
  1. ~eof~tokenを発する
◎ Emit an end-of-file token.
~AnyElse
  1. 新たな文字~token( `現在の入力~文字$ ) を発する
◎ Emit the current input character as a character token.

12.2.5.2. `~RCDATA^st

`次n入力~文字$を消費する: ◎ Consume the next input character:

`0026^U
  1. `戻先~状態$V ~SET `~RCDATA$st
  2. `文字~参照$stに`切替える$
◎ Set the return state to the RCDATA state. Switch to the character reference state.
`003C^U
  1. `~RCDATA~LTsign$stに`切替える$
◎ Switch to the RCDATA less-than sign state.
`0000^U
  1. `unexpected-null-character$pE
  2. 新たな文字~token( `FFFD^U ) を発する
◎ This is an unexpected-null-character parse error. Emit a U+FFFD REPLACEMENT CHARACTER character token.
~EOF
  1. ~eof~tokenを発する
◎ Emit an end-of-file token.
~AnyElse
  1. 新たな文字~token( `現在の入力~文字$ ) を発する
◎ Emit the current input character as a character token.

12.2.5.3. `~RAWTEXT^st

`次n入力~文字$を消費する: ◎ Consume the next input character:

`003C^U
  1. `~RAWTEXT~LTsign$stに`切替える$
◎ Switch to the RAWTEXT less-than sign state.
`0000^U
  1. `unexpected-null-character$pE
  2. 新たな文字~token( `FFFD^U ) を発する
◎ This is an unexpected-null-character parse error. Emit a U+FFFD REPLACEMENT CHARACTER character token.
~EOF
  1. ~eof~tokenを発する
◎ Emit an end-of-file token.
~AnyElse
  1. 新たな文字~token( `現在の入力~文字$ ) を発する
◎ Emit the current input character as a character token.

12.2.5.4. `~script~data^st

`次n入力~文字$を消費する: ◎ Consume the next input character:

`003C^U
  1. `~script~data~LTsign$stに`切替える$
◎ Switch to the script data less-than sign state.
`0000^U
  1. `unexpected-null-character$pE
  2. 新たな文字~token( `FFFD^U ) を発する
◎ This is an unexpected-null-character parse error. Emit a U+FFFD REPLACEMENT CHARACTER character token.
~EOF
  1. ~eof~tokenを発する
◎ Emit an end-of-file token.
~AnyElse
  1. 新たな文字~token( `現在の入力~文字$ ) を発する
◎ Emit the current input character as a character token.

12.2.5.5. `~PLAINTEXT^st

`次n入力~文字$を消費する: ◎ Consume the next input character:

`0000^U
  1. `unexpected-null-character$pE
  2. 新たな文字~token( `FFFD^U ) を発する
◎ This is an unexpected-null-character parse error. Emit a U+FFFD REPLACEMENT CHARACTER character token.
~EOF
  1. ~eof~tokenを発する
◎ Emit an end-of-file token.
~AnyElse
  1. 新たな文字~token( `現在の入力~文字$ ) を発する
◎ Emit the current input character as a character token.

12.2.5.6. `~tag~open^st

`次n入力~文字$を消費する: ◎ Consume the next input character:

`0021^U
  1. `~markup宣言~open$stに`切替える$
◎ Switch to the markup declaration open state.
`002F^U
  1. `終了tag~open$stに`切替える$
◎ Switch to the end tag open state.
`~ASCII英字$
  1. 新たな開始tag~token( 空~文字列 ) を作成する
  2. `~tag名$st内で`再消費-$する
◎ Create a new start tag token, set its tag name to the empty string. Reconsume in the tag name state.
`003F^U
  1. `unexpected-question-mark-instead-of-tag-name$pE
  2. 新たな~comment~token( 空~文字列 ) を作成する
  3. `似非~comment$st内で`再消費-$する
◎ 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.
~EOF
  1. `eof-before-tag-name$pE
  2. 新たな文字~token( `003C^U ) を発する
  3. ~eof~tokenを発する
◎ This is an eof-before-tag-name parse error. Emit a U+003C LESS-THAN SIGN character token and an end-of-file token.
~AnyElse
  1. `invalid-first-character-of-tag-name$pE
  2. 新たな文字~token( `003C^U ) を発する
  3. `~data$st内で`再消費-$する
◎ This is an invalid-first-character-of-tag-name parse error. Emit a U+003C LESS-THAN SIGN character token. Reconsume in the data state.

12.2.5.7. `終了tag~open^st

`次n入力~文字$を消費する: ◎ Consume the next input character:

`~ASCII英字$
  1. %~token ~LET 新たな終了tag~token()
  2. `~tag名$st内で`再消費-$する
◎ Create a new end tag token, set its tag name to the empty string. Reconsume in the tag name state.
`003E^U
  1. `missing-end-tag-name$pE
  2. `~data$stに`切替える$
◎ This is a missing-end-tag-name parse error. Switch to the data state.
~EOF
  1. `eof-before-tag-name$pE
  2. 新たな文字~token( `003C^U ) を発する
  3. 新たな文字~token( `002F^U ) を発する
  4. ~eof~tokenを発する
◎ This is an eof-before-tag-name parse error. Emit a U+003C LESS-THAN SIGN character token, a U+002F SOLIDUS character token and an end-of-file token.
~AnyElse
  1. `invalid-first-character-of-tag-name$pE
  2. 新たな~comment~token( 空~文字列 ) を作成する
  3. `似非~comment$st内で`再消費-$する
◎ This is an invalid-first-character-of-tag-name parse error. Create a comment token whose data is the empty string. Reconsume in the bogus comment state.

12.2.5.8. `~tag名^st

`次n入力~文字$を消費する: ◎ Consume the next input character:

`0009^U
`000A^U
`000C^U
`0020^U
  1. `属性~名の前$stに`切替える$
◎ Switch to the before attribute name state.
`002F^U
  1. `自己閉じ開始tag$stに`切替える$
◎ Switch to the self-closing start tag state.
`003E^U
  1. `~data$stに`切替える$
  2. 現在の~tag~tokenを発する
◎ Switch to the data state. Emit the current tag token.
`~ASCII英大文字$
  1. 現在の~tag~tokenの~tag名 ~APPEND `現在の入力~文字$に対応する小文字(文字の~cpに `0020^X を加算する)
◎ Append the lowercase version of the current input character (add 0x0020 to the character's code point) to the current tag token's tag name.
`0000^U
  1. `unexpected-null-character$pE
  2. 現在の~tag~tokenの~tag名 ~APPEND `FFFD^U character
◎ This is an unexpected-null-character parse error. Append a U+FFFD REPLACEMENT CHARACTER character to the current tag token's tag name.
~EOF
  1. `eof-in-tag$pE
  2. ~eof~tokenを発する
◎ This is an eof-in-tag parse error. Emit an end-of-file token.
~AnyElse
  1. 現在の~tag~tokenの~tag名 ~APPEND `現在の入力~文字$
◎ Append the current input character to the current tag token's tag name.

12.2.5.9. `~RCDATA~LTsign^st

`次n入力~文字$を消費する: ◎ Consume the next input character:

`002F^U
  1. `一時~buffer$V ~SET 空~文字列
  2. `~RCDATA終了tag~open$stに`切替える$
◎ Set the temporary buffer to the empty string. Switch to the RCDATA end tag open state.
~AnyElse
  1. 新たな文字~token( `003C^U ) を発する
  2. `~RCDATA$st内で`再消費-$する
◎ Emit a U+003C LESS-THAN SIGN character token. Reconsume in the RCDATA state.

12.2.5.10. `~RCDATA終了tag~open^st

`次n入力~文字$を消費する: ◎ Consume the next input character:

`~ASCII英字$
  1. %~token ~LET 新たな終了tag~token()
  2. `~RCDATA終了tag名$st内で`再消費-$する
◎ Create a new end tag token, set its tag name to the empty string. Reconsume in the RCDATA end tag name state.
~AnyElse
  1. 新たな文字~token( `003C^U ) を発する
  2. 新たな文字~token( `002F^U ) を発する
  3. `~RCDATA$st内で`再消費-$する
◎ Emit a U+003C LESS-THAN SIGN character token and a U+002F SOLIDUS character token. Reconsume in the RCDATA state.

12.2.5.11. `~RCDATA終了tag名^st

`次n入力~文字$を消費する: ◎ Consume the next input character:

`0009^U
`000A^U
`000C^U
`0020^U
  1. ~IF[ 現在の終了tag~tokenは`適切な終了tag~token$でない ] ⇒ ~GOTO ~AnyElse
  2. `属性~名の前$stに`切替える$
◎ If the current end tag token is an appropriate end tag token, then switch to the before attribute name state. Otherwise, treat it as per the "anything else" entry below.
`002F^U
  1. ~IF[ 現在の終了tag~tokenは`適切な終了tag~token$でない ] ⇒ ~GOTO ~AnyElse
  2. `自己閉じ開始tag$stに`切替える$
◎ If the current end tag token is an appropriate end tag token, then switch to the self-closing start tag state. Otherwise, treat it as per the "anything else" entry below.
`003E^U
  1. ~IF[ 現在の終了tag~tokenは`適切な終了tag~token$でない ] ⇒ ~GOTO ~AnyElse
  2. `~data$stに`切替える$
  3. 現在の~tag~tokenを発する
◎ If the current end tag token is an appropriate end tag token, then switch to the data state and emit the current tag token. Otherwise, treat it as per the "anything else" entry below.
`~ASCII英大文字$
  1. 現在の~tag~tokenの~tag名 ~APPEND `現在の入力~文字$に対応する小文字(文字の~cpに `0020^X を加算する)
  2. `一時~buffer$V ~APPEND `現在の入力~文字$
◎ Append the lowercase version of the current input character (add 0x0020 to the character's code point) to the current tag token's tag name. Append the current input character to the temporary buffer.
`~ASCII英小文字$
  1. 現在の~tag~tokenの~tag名 ~APPEND `現在の入力~文字$
  2. `一時~buffer$V ~APPEND `現在の入力~文字$
◎ Append the current input character to the current tag token's tag name. Append the current input character to the temporary buffer.
~AnyElse
  1. 新たな文字~token( `003C^U ) を発する
  2. 新たな文字~token( `002F^U ) を発する
  3. `一時~buffer$V 内の~EACH( %文字 ) に対し ⇒ 新たな文字~token( %文字 ) を発する
  4. `~RCDATA$st内で`再消費-$する
◎ Emit a U+003C LESS-THAN SIGN character token, a U+002F SOLIDUS character token, and a character token for each of the characters in the temporary buffer (in the order they were added to the buffer). Reconsume in the RCDATA state.

12.2.5.12. `~RAWTEXT~LTsign^st

`次n入力~文字$を消費する: ◎ Consume the next input character:

`002F^U
  1. `一時~buffer$V ~SET 空~文字列
  2. `~RAWTEXT終了tag~open$stに`切替える$
◎ Set the temporary buffer to the empty string. Switch to the RAWTEXT end tag open state.
~AnyElse
  1. 新たな文字~token( `003C^U ) を発する
  2. `~RAWTEXT$st内で`再消費-$する
◎ Emit a U+003C LESS-THAN SIGN character token. Reconsume in the RAWTEXT state.

12.2.5.13. `~RAWTEXT終了tag~open^st

`次n入力~文字$を消費する: ◎ Consume the next input character:

`~ASCII英字$
  1. %~token ~LET 新たな終了tag~token()
  2. `~RAWTEXT終了tag名$st内で`再消費-$する
◎ Create a new end tag token, set its tag name to the empty string. Reconsume in the RAWTEXT end tag name state.
~AnyElse
  1. 新たな文字~token( `003C^U ) を発する
  2. 新たな文字~token( `002F^U ) を発する
  3. `~RAWTEXT$st内で`再消費-$する
◎ Emit a U+003C LESS-THAN SIGN character token and a U+002F SOLIDUS character token. Reconsume in the RAWTEXT state.

12.2.5.14. `~RAWTEXT終了tag名^st

`次n入力~文字$を消費する: ◎ Consume the next input character:

`0009^U
`000A^U
`000C^U
`0020^U
  1. ~IF[ 現在の終了tag~tokenは`適切な終了tag~token$でない ] ⇒ ~GOTO ~AnyElse
  2. `属性~名の前$stに`切替える$
◎ If the current end tag token is an appropriate end tag token, then switch to the before attribute name state. Otherwise, treat it as per the "anything else" entry below.
`002F^U
  1. ~IF[ 現在の終了tag~tokenは`適切な終了tag~token$でない ] ⇒ ~GOTO ~AnyElse
  2. `自己閉じ開始tag$stに`切替える$
◎ If the current end tag token is an appropriate end tag token, then switch to the self-closing start tag state. Otherwise, treat it as per the "anything else" entry below.
`003E^U
  1. ~IF[ 現在の終了tag~tokenは`適切な終了tag~token$でない ] ⇒ ~GOTO ~AnyElse
  2. `~data$stに`切替える$
  3. 現在の~tag~tokenを発する
◎ If the current end tag token is an appropriate end tag token, then switch to the data state and emit the current tag token. Otherwise, treat it as per the "anything else" entry below.
`~ASCII英大文字$
  1. 現在の~tag~tokenの~tag名 ~APPEND `現在の入力~文字$に対応する小文字(文字の~cpに `0020^X を加算する)
  2. `一時~buffer$V ~APPEND `現在の入力~文字$
◎ Append the lowercase version of the current input character (add 0x0020 to the character's code point) to the current tag token's tag name. Append the current input character to the temporary buffer.
`~ASCII英小文字$
  1. 現在の~tag~tokenの~tag名 ~APPEND `現在の入力~文字$
  2. `一時~buffer$V ~APPEND `現在の入力~文字$
◎ Append the current input character to the current tag token's tag name. Append the current input character to the temporary buffer.
~AnyElse
  1. 新たな文字~token( `003C^U ) を発する
  2. 新たな文字~token( `002F^U ) を発する
  3. `一時~buffer$V 内の~EACH( %文字 ) に対し ⇒ 新たな文字~token( %文字 ) を発する
  4. `~RAWTEXT$st内で`再消費-$する
◎ Emit a U+003C LESS-THAN SIGN character token, a U+002F SOLIDUS character token, and a character token for each of the characters in the temporary buffer (in the order they were added to the buffer). Reconsume in the RAWTEXT state.

12.2.5.15. `~script~data~LTsign^st

`次n入力~文字$を消費する: ◎ Consume the next input character:

`002F^U
  1. `一時~buffer$V ~SET 空~文字列
  2. `~script~data終了tag~open$stに`切替える$
◎ Set the temporary buffer to the empty string. Switch to the script data end tag open state.
`0021^U
  1. `~script~data~escape始端$stに`切替える$
  2. 新たな文字~token( `003C^U ) を発する
  3. 新たな文字~token( `0021^U ) を発する
◎ Switch to the script data escape start state. Emit a U+003C LESS-THAN SIGN character token and a U+0021 EXCLAMATION MARK character token.
~AnyElse
  1. 新たな文字~token( `003C^U ) を発する
  2. `~script~data$st内で`再消費-$する
◎ Emit a U+003C LESS-THAN SIGN character token. Reconsume in the script data state.

12.2.5.16. `~script~data終了tag~open^st

`次n入力~文字$を消費する: ◎ Consume the next input character:

`~ASCII英字$
  1. %~token ~LET 新たな終了tag~token()
  2. `~script~data終了tag名$st内で`再消費-$する
◎ Create a new end tag token, set its tag name to the empty string. Reconsume in the script data end tag name state.
~AnyElse
  1. 新たな文字~token( `003C^U ) を発する
  2. 新たな文字~token( `002F^U ) を発する
  3. `~script~data$st内で`再消費-$する
◎ Emit a U+003C LESS-THAN SIGN character token and a U+002F SOLIDUS character token. Reconsume in the script data state.

12.2.5.17. `~script~data終了tag名^st

`次n入力~文字$を消費する: ◎ Consume the next input character:

`0009^U
`000A^U
`000C^U
`0020^U
  1. ~IF[ 現在の終了tag~tokenは`適切な終了tag~token$でない ] ⇒ ~GOTO ~AnyElse
  2. `属性~名の前$stに`切替える$
◎ If the current end tag token is an appropriate end tag token, then switch to the before attribute name state. Otherwise, treat it as per the "anything else" entry below.
`002F^U
  1. ~IF[ 現在の終了tag~tokenは`適切な終了tag~token$でない ] ⇒ ~GOTO ~AnyElse
  2. `自己閉じ開始tag$stに`切替える$
◎ If the current end tag token is an appropriate end tag token, then switch to the self-closing start tag state. Otherwise, treat it as per the "anything else" entry below.
`003E^U
  1. ~IF[ 現在の終了tag~tokenは`適切な終了tag~token$でない ] ⇒ ~GOTO ~AnyElse
  2. `~data$stに`切替える$
  3. 現在の~tag~tokenを発する
◎ If the current end tag token is an appropriate end tag token, then switch to the data state and emit the current tag token. Otherwise, treat it as per the "anything else" entry below.
`~ASCII英大文字$
  1. 現在の~tag~tokenの~tag名 ~APPEND `現在の入力~文字$に対応する小文字(文字の~cpに `0020^X を加算する)
  2. `一時~buffer$V ~APPEND `現在の入力~文字$
◎ Append the lowercase version of the current input character (add 0x0020 to the character's code point) to the current tag token's tag name. Append the current input character to the temporary buffer.
`~ASCII英小文字$
  1. 現在の~tag~tokenの~tag名 ~APPEND `現在の入力~文字$
  2. `一時~buffer$V ~APPEND `現在の入力~文字$
◎ Append the current input character to the current tag token's tag name. Append the current input character to the temporary buffer.
~AnyElse
  1. 新たな文字~token( `003C^U ) を発する
  2. 新たな文字~token( `002F^U ) を発する
  3. `一時~buffer$V 内の~EACH( %文字 ) に対し ⇒ 新たな文字~token( %文字 ) を発する
  4. `~script~data$st内で`再消費-$する
◎ Emit a U+003C LESS-THAN SIGN character token, a U+002F SOLIDUS character token, and a character token for each of the characters in the temporary buffer (in the order they were added to the buffer). Reconsume in the script data state.

12.2.5.18. `~script~data~escape始端^st

`次n入力~文字$を消費する: ◎ Consume the next input character:

`002D^U
  1. `~script~data~escape始端~dash$stに`切替える$
  2. 新たな文字~token( `002D^U ) を発する
◎ Switch to the script data escape start dash state. Emit a U+002D HYPHEN-MINUS character token.
~AnyElse
  1. `~script~data$st内で`再消費-$する
◎ Reconsume in the script data state.

12.2.5.19. `~script~data~escape始端~dash^st

`次n入力~文字$を消費する: ◎ Consume the next input character:

`002D^U
  1. `~script~data~escape済み~dash~dash$stに`切替える$
  2. 新たな文字~token( `002D^U ) を発する
◎ Switch to the script data escaped dash dash state. Emit a U+002D HYPHEN-MINUS character token.
~AnyElse
  1. `~script~data$st内で`再消費-$する
◎ Reconsume in the script data state.

12.2.5.20. `~script~data~escape済み^st

`次n入力~文字$を消費する: ◎ Consume the next input character:

`002D^U
  1. `~script~data~escape済み~dash$stに`切替える$
  2. 新たな文字~token( `002D^U ) を発する
◎ Switch to the script data escaped dash state. Emit a U+002D HYPHEN-MINUS character token.
`003C^U
  1. `~script~data~escape済み~LTsign$stに`切替える$
◎ Switch to the script data escaped less-than sign state.
`0000^U
  1. `unexpected-null-character$pE
  2. 新たな文字~token( `FFFD^U ) を発する
◎ This is an unexpected-null-character parse error. Emit a U+FFFD REPLACEMENT CHARACTER character token.
~EOF
  1. `eof-in-script-html-comment-like-text$pE
  2. ~eof~tokenを発する
◎ This is an eof-in-script-html-comment-like-text parse error. Emit an end-of-file token.
~AnyElse
  1. 新たな文字~token( `現在の入力~文字$ ) を発する
◎ Emit the current input character as a character token.

12.2.5.21. `~script~data~escape済み~dash^st

`次n入力~文字$を消費する: ◎ Consume the next input character:

`002D^U
  1. `~script~data~escape済み~dash~dash$stに`切替える$
  2. 新たな文字~token( `002D^U ) を発する
◎ Switch to the script data escaped dash dash state. Emit a U+002D HYPHEN-MINUS character token.
`003C^U
  1. `~script~data~escape済み~LTsign$stに`切替える$
◎ Switch to the script data escaped less-than sign state.
`0000^U
  1. `unexpected-null-character$pE
  2. `~script~data~escape済み$stに`切替える$
  3. 新たな文字~token( `FFFD^U ) を発する
◎ This is an unexpected-null-character parse error. Switch to the script data escaped state. Emit a U+FFFD REPLACEMENT CHARACTER character token.
~EOF
  1. `eof-in-script-html-comment-like-text$pE
  2. ~eof~tokenを発する
◎ This is an eof-in-script-html-comment-like-text parse error. Emit an end-of-file token.
~AnyElse
  1. `~script~data~escape済み$stに`切替える$
  2. 新たな文字~token( `現在の入力~文字$ ) を発する
◎ Switch to the script data escaped state. Emit the current input character as a character token.

12.2.5.22. `~script~data~escape済み~dash~dash^st

`次n入力~文字$を消費する: ◎ Consume the next input character:

`002D^U
  1. 新たな文字~token( `002D^U ) を発する
◎ Emit a U+002D HYPHEN-MINUS character token.
`003C^U
  1. `~script~data~escape済み~LTsign$stに`切替える$
◎ Switch to the script data escaped less-than sign state.
`003E^U
  1. `~script~data$stに`切替える$
  2. 新たな文字~token( `003E^U ) を発する
◎ Switch to the script data state. Emit a U+003E GREATER-THAN SIGN character token.
`0000^U
  1. `unexpected-null-character$pE
  2. `~script~data~escape済み$stに`切替える$
  3. 新たな文字~token( `FFFD^U ) を発する
◎ This is an unexpected-null-character parse error. Switch to the script data escaped state. Emit a U+FFFD REPLACEMENT CHARACTER character token.
~EOF
  1. `eof-in-script-html-comment-like-text$pE
  2. ~eof~tokenを発する
◎ This is an eof-in-script-html-comment-like-text parse error. Emit an end-of-file token.
~AnyElse
  1. `~script~data~escape済み$stに`切替える$
  2. 新たな文字~token( `現在の入力~文字$ ) を発する
◎ Switch to the script data escaped state. Emit the current input character as a character token.

12.2.5.23. `~script~data~escape済み~LTsign^st

`次n入力~文字$を消費する: ◎ Consume the next input character:

`002F^U
  1. `一時~buffer$V ~SET 空~文字列
  2. `~script~data~escape済み終了tag~open$stに`切替える$
◎ Set the temporary buffer to the empty string. Switch to the script data escaped end tag open state.
`~ASCII英字$
  1. `一時~buffer$V ~SET 空~文字列
  2. 新たな文字~token( `003C^U ) を発する
  3. `~script~data二重~escape始端$st内で`再消費-$する
◎ Set the temporary buffer to the empty string. Emit a U+003C LESS-THAN SIGN character token. Reconsume in the script data double escape start state.
~AnyElse
  1. 新たな文字~token( `003C^U ) を発する
  2. `~script~data~escape済み$st内で`再消費-$する
◎ Emit a U+003C LESS-THAN SIGN character token. Reconsume in the script data escaped state.

12.2.5.24. `~script~data~escape済み終了tag~open^st

`次n入力~文字$を消費する: ◎ Consume the next input character:

`~ASCII英字$
  1. %~token ~LET 新たな終了tag~token()
  2. `~script~data~escape済み終了tag名$st内で`再消費-$する

( %~token はまだ発しないこと — %~token の詳細は,それが発される前に埋められることになる。)

◎ Create a new end tag token. Reconsume in the script data escaped end tag name state. (Don't emit the token yet; further details will be filled in before it is emitted.)
~AnyElse
  1. 新たな文字~token( `003C^U ) を発する
  2. 新たな文字~token( `002F^U ) を発する
  3. `~script~data~escape済み$st内で`再消費-$する
◎ Emit a U+003C LESS-THAN SIGN character token and a U+002F SOLIDUS character token. Reconsume in the script data escaped state.

12.2.5.25. `~script~data~escape済み終了tag名^st

`次n入力~文字$を消費する: ◎ Consume the next input character:

`0009^U
`000A^U
`000C^U
`0020^U
  1. ~IF[ 現在の終了tag~tokenは`適切な終了tag~token$でない ] ⇒ ~GOTO ~AnyElse
  2. `属性~名の前$stに`切替える$
◎ If the current end tag token is an appropriate end tag token, then switch to the before attribute name state. Otherwise, treat it as per the "anything else" entry below.
`002F^U
  1. ~IF[ 現在の終了tag~tokenは`適切な終了tag~token$でない ] ⇒ ~GOTO ~AnyElse
  2. `自己閉じ開始tag$stに`切替える$
◎ If the current end tag token is an appropriate end tag token, then switch to the self-closing start tag state. Otherwise, treat it as per the "anything else" entry below.
`003E^U
  1. ~IF[ 現在の終了tag~tokenは`適切な終了tag~token$でない ] ⇒ ~GOTO ~AnyElse
  2. `~data$stに`切替える$
  3. 現在の~tag~tokenを発する
◎ If the current end tag token is an appropriate end tag token, then switch to the data state and emit the current tag token. Otherwise, treat it as per the "anything else" entry below.
`~ASCII英大文字$
  1. 現在の~tag~tokenの~tag名 ~APPEND `現在の入力~文字$に対応する小文字(文字の~cpに `0020^X を加算する)
  2. `一時~buffer$V ~APPEND `現在の入力~文字$
◎ Append the lowercase version of the current input character (add 0x0020 to the character's code point) to the current tag token's tag name. Append the current input character to the temporary buffer.
`~ASCII英小文字$
  1. 現在の~tag~tokenの~tag名 ~APPEND `現在の入力~文字$
  2. `一時~buffer$V ~APPEND `現在の入力~文字$
◎ Append the current input character to the current tag token's tag name. Append the current input character to the temporary buffer.
~AnyElse
  1. 新たな文字~token( `003C^U ) を発する
  2. 新たな文字~token( `002F^U ) を発する
  3. `一時~buffer$V 内の~EACH( %文字 ) に対し ⇒ 新たな文字~token( %文字 ) を発する
  4. `~script~data~escape済み$st内で`再消費-$する
◎ Emit a U+003C LESS-THAN SIGN character token, a U+002F SOLIDUS character token, and a character token for each of the characters in the temporary buffer (in the order they were added to the buffer). Reconsume in the script data escaped state.

12.2.5.26. `~script~data二重~escape始端^st

`次n入力~文字$を消費する: ◎ Consume the next input character:

`0009^U
`000A^U
`000C^U
`0020^U
`002F^U
`003E^U
  1. ~IF[ `一時~buffer$V ~EQ `script^l ]:

    1. `~script~data二重~escape済み$stに`切替える$
    2. ~RET
  2. `~script~data~escape済み$stに`切替える$
  3. 新たな文字~token( `現在の入力~文字$ ) を発する
◎ If the temporary buffer is the string "script", then switch to the script data double escaped state. Otherwise, switch to the script data escaped state. Emit the current input character as a character token.
`~ASCII英大文字$
  1. `一時~buffer$V ~APPEND `現在の入力~文字$に対応する小文字(文字の~cpに `0020^X を加算する)
  2. 新たな文字~token( `現在の入力~文字$ ) を発する
◎ Append the lowercase version of the current input character (add 0x0020 to the character's code point) to the temporary buffer. Emit the current input character as a character token.
`~ASCII英小文字$
  1. `一時~buffer$V ~APPEND `現在の入力~文字$
  2. 新たな文字~token( `現在の入力~文字$ ) を発する
◎ Append the current input character to the temporary buffer. Emit the current input character as a character token.
~AnyElse
  1. `~script~data~escape済み$st内で`再消費-$する
◎ Reconsume in the script data escaped state.

12.2.5.27. `~script~data二重~escape済み^st

`次n入力~文字$を消費する: ◎ Consume the next input character:

`002D^U
  1. `~script~data二重~escape済み~dash$stに`切替える$
  2. 新たな文字~token( `002D^U ) を発する
◎ Switch to the script data double escaped dash state. Emit a U+002D HYPHEN-MINUS character token.
`003C^U
  1. `~script~data二重~escape済み~LTsign$stに`切替える$
  2. 新たな文字~token( `003C^U ) を発する
◎ Switch to the script data double escaped less-than sign state. Emit a U+003C LESS-THAN SIGN character token.
`0000^U
  1. `unexpected-null-character$pE
  2. 新たな文字~token( `FFFD^U ) を発する
◎ This is an unexpected-null-character parse error. Emit a U+FFFD REPLACEMENT CHARACTER character token.
~EOF
  1. `eof-in-script-html-comment-like-text$pE
  2. ~eof~tokenを発する
◎ This is an eof-in-script-html-comment-like-text parse error. Emit an end-of-file token.
~AnyElse
  1. 新たな文字~token( `現在の入力~文字$ ) を発する
◎ Emit the current input character as a character token.

12.2.5.28. `~script~data二重~escape済み~dash^st

`次n入力~文字$を消費する: ◎ Consume the next input character:

`002D^U
  1. `~script~data二重~escape済み~dash~dash$stに`切替える$
  2. 新たな文字~token( `002D^U ) を発する
◎ Switch to the script data double escaped dash dash state. Emit a U+002D HYPHEN-MINUS character token.
`003C^U
  1. `~script~data二重~escape済み~LTsign$stに`切替える$
  2. 新たな文字~token( `003C^U ) を発する
◎ Switch to the script data double escaped less-than sign state. Emit a U+003C LESS-THAN SIGN character token.
`0000^U
  1. `unexpected-null-character$pE
  2. `~script~data二重~escape済み$stに`切替える$
  3. 新たな文字~token( `FFFD^U ) を発する
◎ This is an unexpected-null-character parse error. Switch to the script data double escaped state. Emit a U+FFFD REPLACEMENT CHARACTER character token.
~EOF
  1. `eof-in-script-html-comment-like-text$pE
  2. ~eof~tokenを発する
◎ This is an eof-in-script-html-comment-like-text parse error. Emit an end-of-file token.
~AnyElse
  1. `~script~data二重~escape済み$stに`切替える$
  2. 新たな文字~token( `現在の入力~文字$ ) を発する
◎ Switch to the script data double escaped state. Emit the current input character as a character token.

12.2.5.29. `~script~data二重~escape済み~dash~dash^st

`次n入力~文字$を消費する: ◎ Consume the next input character:

`002D^U
  1. 新たな文字~token( `002D^U ) を発する
◎ Emit a U+002D HYPHEN-MINUS character token.
`003C^U
  1. `~script~data二重~escape済み~LTsign$stに`切替える$
  2. 新たな文字~token( `003C^U ) を発する
◎ Switch to the script data double escaped less-than sign state. Emit a U+003C LESS-THAN SIGN character token.
`003E^U
  1. `~script~data$stに`切替える$
  2. 新たな文字~token( `003E^U ) を発する
◎ Switch to the script data state. Emit a U+003E GREATER-THAN SIGN character token.
`0000^U
  1. `unexpected-null-character$pE
  2. `~script~data二重~escape済み$stに`切替える$
  3. 新たな文字~token( `FFFD^U ) を発する
◎ This is an unexpected-null-character parse error. Switch to the script data double escaped state. Emit a U+FFFD REPLACEMENT CHARACTER character token.
~EOF
  1. `eof-in-script-html-comment-like-text$pE
  2. ~eof~tokenを発する
◎ This is an eof-in-script-html-comment-like-text parse error. Emit an end-of-file token.
~AnyElse
  1. `~script~data二重~escape済み$stに`切替える$
  2. 新たな文字~token( `現在の入力~文字$ ) を発する
◎ Switch to the script data double escaped state. Emit the current input character as a character token.

12.2.5.30. `~script~data二重~escape済み~LTsign^st

`次n入力~文字$を消費する: ◎ Consume the next input character:

`002F^U
  1. `一時~buffer$V ~SET 空~文字列
  2. `~script~data二重~escape終端$stに`切替える$
  3. 新たな文字~token( `002F^U ) を発する
◎ Set the temporary buffer to the empty string. Switch to the script data double escape end state. Emit a U+002F SOLIDUS character token.
~AnyElse
  1. `~script~data二重~escape済み$st内で`再消費-$する
◎ Reconsume in the script data double escaped state.

12.2.5.31. `~script~data二重~escape終端^st

`次n入力~文字$を消費する: ◎ Consume the next input character:

`0009^U
`000A^U
`000C^U
`0020^U
`002F^U
`003E^U
  1. ~IF[ `一時~buffer$V ~EQ `script^l ]:

    1. `~script~data~escape済み$stに`切替える$
    2. ~RET
  2. `~script~data二重~escape済み$stに`切替える$
  3. 新たな文字~token( `現在の入力~文字$ ) を発する
◎ If the temporary buffer is the string "script", then switch to the script data escaped state. Otherwise, switch to the script data double escaped state. Emit the current input character as a character token.
`~ASCII英大文字$
  1. `一時~buffer$V ~APPEND `現在の入力~文字$ に対応する小文字(文字の~cpに `0020^X を加算する)
  2. 新たな文字~token( `現在の入力~文字$ ) を発する
◎ Append the lowercase version of the current input character (add 0x0020 to the character's code point) to the temporary buffer. Emit the current input character as a character token.
`~ASCII英小文字$
  1. `一時~buffer$V ~APPEND `現在の入力~文字$
  2. 新たな文字~token( `現在の入力~文字$ ) を発する
◎ Append the current input character to the temporary buffer. Emit the current input character as a character token.
~AnyElse
  1. `~script~data二重~escape済み$st内で`再消費-$する
◎ Reconsume in the script data double escaped state.

12.2.5.32. `属性~名の前^st

`次n入力~文字$を消費する: ◎ Consume the next input character:

`0009^U
`000A^U
`000C^U
`0020^U
  1. この文字は無視する
◎ Ignore the character.
`002F^U
`003E^U
~EOF
  1. `属性~名の後$st内で`再消費-$する
◎ Reconsume in the after attribute name state.
`003D^U
  1. `unexpected-equals-sign-before-attribute-name$pE
  2. 現在の~tag~token内で新たな属性( 名前 ~SET `現在の入力~文字$, 値 ~SET 空~文字列 ) を開始する
  3. `属性~名$stに`切替える$
◎ This is an unexpected-equals-sign-before-attribute-name parse error. Start a new attribute in the current tag token. Set that attribute's name to the current input character, and its value to the empty string. Switch to the attribute name state.
~AnyElse
  1. 現在の~tag~token内で新たな属性( 名前 ~SET 空~文字列, 値 ~SET 空~文字列 ) を開始する
  2. `属性~名$st内で`再消費-$する
◎ Start a new attribute in the current tag token. Set that attribute name and value to the empty string. Reconsume in the attribute name state.

12.2.5.33. `属性~名^st

`次n入力~文字$を消費する: ◎ Consume the next input character:

`0009^U
`000A^U
`000C^U
`0020^U
`002F^U
`003E^U
~EOF
  1. `属性~名の後$st内で`再消費-$する
◎ Reconsume in the after attribute name state.
`003D^U
  1. `属性~値の前$stに`切替える$
◎ Switch to the before attribute value state.
`~ASCII英大文字$
  1. 現在の属性の名前 ~APPEND `現在の入力~文字$ に対応する小文字(文字の~cpに `0020^X を加算する)
◎ Append the lowercase version of the current input character (add 0x0020 to the character's code point) to the current attribute's name.
`0000^U
  1. `unexpected-null-character$pE
  2. 現在の属性の名前 ~APPEND `FFFD^U
◎ This is an unexpected-null-character parse error. Append a U+FFFD REPLACEMENT CHARACTER character to the current attribute's name.
`0022^U
`0027^U
`003C^U
  1. `unexpected-character-in-attribute-name$pE
  2. ~GOTO ~AnyElse
◎ This is an unexpected-character-in-attribute-name parse error. Treat it as per the "anything else" entry below.
~AnyElse
  1. 現在の属性の名前 ~APPEND `現在の入力~文字$
◎ Append the current input character to the current attribute's name.

~UAは,`属性~名$stから去るときには(および,適切になるなら、現在の~tag~tokenを発する前に)、現在の~tag~token上の属性たちの完全な名前どうしを比較し~MUST。 正確に同じ名前の属性が~token上にすでにある場合、 `duplicate-attribute$pE になり,新たな 【後から追加された】 属性は~tokenから除去され~MUST。 ◎ When the user agent leaves the attribute name state (and before emitting the tag token, if appropriate), the complete attribute's name must be compared to the other attributes on the same token; if there is already an attribute on the token with the exact same name, then this is a duplicate-attribute parse error and the new attribute must be removed from the token.

注記: ある属性が ~tokenからそのように除去された場合、それに対応する値は,あっても 構文解析器により後続して利用されることは決してなく、実質的に破棄される。 しかしながら,この仕方で属性を除去しても、~tokenizerの目的における “現在の属性” としての地位は変化しない。 ◎ If an attribute is so removed from a token, it, and the value that gets associated with it, if any, are never subsequently used by the parser, and are therefore effectively discarded. Removing the attribute in this way does not change its status as the "current attribute" for the purposes of the tokenizer, however.

12.2.5.34. `属性~名の後^st

`次n入力~文字$を消費する: ◎ Consume the next input character:

`0009^U
`000A^U
`000C^U
`0020^U
  1. この文字は無視する
◎ Ignore the character.
`002F^U
  1. `自己閉じ開始tag$stに`切替える$
◎ Switch to the self-closing start tag state.
`003D^U
  1. `属性~値の前$stに`切替える$
◎ Switch to the before attribute value state.
`003E^U
  1. `~data$stに`切替える$
  2. 現在の~tag~tokenを発する
◎ Switch to the data state. Emit the current tag token.
~EOF
  1. `eof-in-tag$pE
  2. ~eof~tokenを発する
◎ This is an eof-in-tag parse error. Emit an end-of-file token.
~AnyElse
  1. 現在の~tag~token内で新たな属性( 名前 ~SET 空~文字列, 値 ~SET 空~文字列 ) を開始する
  2. `属性~名$st内で`再消費-$する
◎ Start a new attribute in the current tag token. Set that attribute name and value to the empty string. Reconsume in the attribute name state.

12.2.5.35. `属性~値の前^st

`次n入力~文字$を消費する: ◎ Consume the next input character:

`0009^U
`000A^U
`000C^U
`0020^U
  1. この文字は無視する
◎ Ignore the character.
`0022^U
  1. `二重引用符付き属性~値$stに`切替える$
◎ Switch to the attribute value (double-quoted) state.
`0027^U
  1. `一重引用符付き属性~値$stに`切替える$
◎ Switch to the attribute value (single-quoted) state.
`003E^U
  1. `missing-attribute-value$pE
  2. `~data$stに`切替える$
  3. 現在の~tag~tokenを発する
◎ This is a missing-attribute-value parse error. Switch to the data state. Emit the current tag token.
~AnyElse
  1. `引用符無し属性~値$st内で`再消費-$する
◎ Reconsume in the attribute value (unquoted) state.

12.2.5.36. `二重引用符付き属性~値^st

`次n入力~文字$を消費する: ◎ Consume the next input character:

`0022^U
  1. `引用符付き属性~値の後$stに`切替える$
◎ Switch to the after attribute value (quoted) state.
`0026^U
  1. `戻先~状態$V ~SET `二重引用符付き属性~値$st
  2. `文字~参照$stに`切替える$
◎ Set the return state to the attribute value (double-quoted) state. Switch to the character reference state.
`0000^U
  1. `unexpected-null-character$pE
  2. 現在の属性の値 ~APPEND `FFFD^U
◎ This is an unexpected-null-character parse error. Append a U+FFFD REPLACEMENT CHARACTER character to the current attribute's value.
~EOF
  1. `eof-in-tag$pE
  2. ~eof~tokenを発する
◎ This is an eof-in-tag parse error. Emit an end-of-file token.
~AnyElse
  1. 現在の属性の値 ~APPEND `現在の入力~文字$
◎ Append the current input character to the current attribute's value.

12.2.5.37. `一重引用符付き属性~値^st

`次n入力~文字$を消費する: ◎ Consume the next input character:

`0027^U
  1. `引用符付き属性~値の後$stに`切替える$
◎ Switch to the after attribute value (quoted) state.
`0026^U
  1. `戻先~状態$V ~SET `一重引用符付き属性~値$st
  2. `文字~参照$stに`切替える$
◎ Set the return state to the attribute value (single-quoted) state. Switch to the character reference state.
`0000^U
  1. `unexpected-null-character$pE
  2. 現在の属性の値 ~APPEND `FFFD^U
◎ This is an unexpected-null-character parse error. Append a U+FFFD REPLACEMENT CHARACTER character to the current attribute's value.
~EOF
  1. `eof-in-tag$pE
  2. ~eof~tokenを発する
◎ This is an eof-in-tag parse error. Emit an end-of-file token.
~AnyElse
  1. 現在の属性の値 ~APPEND `現在の入力~文字$
◎ Append the current input character to the current attribute's value.

12.2.5.38. `引用符無し属性~値^st

`次n入力~文字$を消費する: ◎ Consume the next input character:

`0009^U
`000A^U
`000C^U
`0020^U
  1. `属性~名の前$stに`切替える$
◎ Switch to the before attribute name state.
`0026^U
  1. `戻先~状態$V ~SET `引用符無し属性~値$st
  2. `文字~参照$stに`切替える$
◎ Set the return state to the attribute value (unquoted) state. Switch to the character reference state.
`003E^U
  1. `~data$stに`切替える$
  2. 現在の~tag~tokenを発する
◎ Switch to the data state. Emit the current tag token.
`0000^U
  1. `unexpected-null-character$pE
  2. 現在の属性の値 ~APPEND `FFFD^U
◎ This is an unexpected-null-character parse error. Append a U+FFFD REPLACEMENT CHARACTER character to the current attribute's value.
`0022^U
`0027^U
`003C^U
`003D^U
`0060^U
  1. `unexpected-character-in-unquoted-attribute-value$pE
  2. ~GOTO ~AnyElse
◎ This is an unexpected-character-in-unquoted-attribute-value parse error. Treat it as per the "anything else" entry below.
~EOF
  1. `eof-in-tag$pE
  2. ~eof~tokenを発する
◎ This is an eof-in-tag parse error. Emit an end-of-file token.
~AnyElse
  1. 現在の属性の値 ~APPEND `現在の入力~文字$
◎ Append the current input character to the current attribute's value.

12.2.5.39. `引用符付き属性~値の後^st

`次n入力~文字$を消費する: ◎ Consume the next input character:

`0009^U
`000A^U
`000C^U
`0020^U
  1. `属性~名の前$stに`切替える$
◎ Switch to the before attribute name state.
`002F^U
  1. `自己閉じ開始tag$stに`切替える$
◎ Switch to the self-closing start tag state.
`003E^U
  1. `~data$stに`切替える$
  2. 現在の~tag~tokenを発する
◎ Switch to the data state. Emit the current tag token.
~EOF
  1. `eof-in-tag$pE
  2. ~eof~tokenを発する
◎ This is an eof-in-tag parse error. Emit an end-of-file token.
~AnyElse
  1. `missing-whitespace-between-attributes$pE
  2. `属性~名の前$st内で`再消費-$する
◎ This is a missing-whitespace-between-attributes parse error. Reconsume in the before attribute name state.

12.2.5.40. `自己閉じ開始tag^st

`次n入力~文字$を消費する: ◎ Consume the next input character:

`003E^U
  1. 現在の~tag~tokenの`自己閉じ~flag$ ~SET ~ON
  2. `~data$stに`切替える$
  3. 現在の~tag~tokenを発する
◎ Set the self-closing flag of the current tag token. Switch to the data state. Emit the current tag token.
~EOF
  1. `eof-in-tag$pE
  2. ~eof~tokenを発する
◎ This is an eof-in-tag parse error. Emit an end-of-file token.
~AnyElse
  1. `unexpected-solidus-in-tag$pE
  2. `属性~名の前$st内で`再消費-$する
◎ This is an unexpected-solidus-in-tag parse error. Reconsume in the before attribute name state.

12.2.5.41. `似非~comment^st

`次n入力~文字$を消費する: ◎ Consume the next input character:

`003E^U
  1. `~data$stに`切替える$
  2. 現在の~comment~tokenを発する
◎ Switch to the data state. Emit the comment token.
~EOF
  1. 現在の~comment~tokenを発する
  2. ~eof~tokenを発する
◎ Emit the comment. Emit an end-of-file token.
`0000^U
  1. `unexpected-null-character$pE
  2. 現在の~comment~tokenの~data ~APPEND `FFFD^U
◎ This is an unexpected-null-character parse error. Append a U+FFFD REPLACEMENT CHARACTER character to the comment token's data.
~AnyElse
  1. 現在の~comment~tokenの~data ~APPEND `現在の入力~文字$
◎ Append the current input character to the comment token's data.

12.2.5.42. `~markup宣言~open^st

次n少数の文字に応じて: ◎ If the next few characters are:

2 個の `002D^U ◎ Two U+002D HYPHEN-MINUS characters (-)
  1. それらの文字を消費する
  2. 新たな~comment~token( 空~文字列 ) を作成する
  3. `~comment始端$stに`切替える$
◎ Consume those two characters, create a comment token whose data is the empty string, and switch to the comment start state.
`~ASCII大小無視$で `DOCTYPE^l に合致する ◎ ASCII case-insensitive match for the word "DOCTYPE"
  1. それらの文字を消費する
  2. `~DOCTYPE$stに`切替える$
◎ Consume those characters and switch to the DOCTYPE state.
文字列 `[CDATA[^l ◎ Case-sensitive match for the string "[CDATA[" (the five uppercase letters "CDATA" with a U+005B LEFT SQUARE BRACKET character before and after)
  1. それらの文字を消費する ◎ Consume those characters.\
  2. ~IF[ `現在の調整-済み~node$がある ]~AND[ それは`~HTML名前空間$に属する要素でない ]:

    1. `~CDATAsec$stに`切替える$
    2. ~RET
    ◎ If there is an adjusted current node and it is not an element in the HTML namespace, then switch to the CDATA section state.\
  3. `cdata-in-html-content$pE ◎ Otherwise, this is a cdata-in-html-content parse error.\
  4. 新たな~comment~token( `[CDATA[^l ) を作成する ◎ Create a comment token whose data is the "[CDATA[" string.\
  5. `似非~comment$stに`切替える$ ◎ Switch to the bogus comment state.
~AnyElse
  1. `incorrectly-opened-comment$pE
  2. 新たな~comment~token( 空~文字列 ) を作成する
  3. `似非~comment$stに`切替える$

(現在の状態~内では何も消費しないこと。)

◎ This is an incorrectly-opened-comment parse error. Create a comment token whose data is the empty string. Switch to the bogus comment state (don't consume anything in the current state).

12.2.5.43. `~comment始端^st

`次n入力~文字$を消費する: ◎ Consume the next input character:

`002D^U
  1. `~comment始端~dash$stに`切替える$
◎ Switch to the comment start dash state.
`003E^U
  1. `abrupt-closing-of-empty-comment$pE
  2. `~data$stに`切替える$
  3. 現在の~comment~tokenを発する
◎ This is an abrupt-closing-of-empty-comment parse error. Switch to the data state. Emit the comment token.
~AnyElse
  1. `~comment$st内で`再消費-$する
◎ Reconsume in the comment state.

12.2.5.44. `~comment始端~dash^st

`次n入力~文字$を消費する: ◎ Consume the next input character:

`002D^U
  1. `~comment終端$stに`切替える$
◎ Switch to the comment end state
`003E^U
  1. `abrupt-closing-of-empty-comment$pE
  2. `~data$stに`切替える$
  3. 現在の~comment~tokenを発する
◎ This is an abrupt-closing-of-empty-comment parse error. Switch to the data state. Emit the comment token.
~EOF
  1. `eof-in-comment$pE
  2. 現在の~comment~tokenを発する
  3. ~eof~tokenを発する
◎ This is an eof-in-comment parse error. Emit the comment token. Emit an end-of-file token.
~AnyElse
  1. 現在の~comment~tokenの~data ~APPEND `002D^U
  2. `~comment$st内で`再消費-$する
◎ Append a U+002D HYPHEN-MINUS character (-) to the comment token's data. Reconsume in the comment state.

12.2.5.45 `~comment^st

`次n入力~文字$を消費する: ◎ Consume the next input character:

`003C^U
  1. 現在の~comment~tokenの~data ~APPEND `現在の入力~文字$
  2. `~comment~LTsign$stに`切替える$
◎ Append the current input character to the comment token's data. Switch to the comment less-than sign state.
`002D^U
  1. `~comment終端~dash$stに`切替える$
◎ Switch to the comment end dash state.
`0000^U
  1. `unexpected-null-character$pE
  2. 現在の~comment~tokenの~data ~APPEND `FFFD^U
◎ This is an unexpected-null-character parse error. Append a U+FFFD REPLACEMENT CHARACTER character to the comment token's data.
~EOF
  1. `eof-in-comment$pE
  2. 現在の~comment~tokenを発する
  3. ~eof~tokenを発する
◎ This is an eof-in-comment parse error. Emit the comment token. Emit an end-of-file token.
~AnyElse
  1. 現在の~comment~tokenの~data ~APPEND `現在の入力~文字$
◎ Append the current input character to the comment token's data.

12.2.5.46. `~comment~LTsign^st

`次n入力~文字$を消費する: ◎ Consume the next input character:

`0021^U
  1. 現在の~comment~tokenの~data ~APPEND `現在の入力~文字$
  2. `~comment~LTsign~bang$stに`切替える$
◎ Append the current input character to the comment token's data. Switch to the comment less-than sign bang state.
`003C^U
  1. 現在の~comment~tokenの~data ~APPEND `現在の入力~文字$
◎ Append the current input character to the comment token's data.
~AnyElse
  1. `~comment$st内で`再消費-$する
◎ Reconsume in the comment state.

12.2.5.47. `~comment~LTsign~bang^st

`次n入力~文字$を消費する: ◎ Consume the next input character:

`002D^U
  1. `~comment~LTsign~bang~dash$stに`切替える$
◎ Switch to the comment less-than sign bang dash state.
~AnyElse
  1. `~comment$st内で`再消費-$する
◎ Reconsume in the comment state.

12.2.5.48. `~comment~LTsign~bang~dash^st

`次n入力~文字$を消費する: ◎ Consume the next input character:

`002D^U
  1. `~comment~LTsign~bang~dash~dash$stに`切替える$
◎ Switch to the comment less-than sign bang dash dash state.
~AnyElse
  1. `~comment終端~dash$st内で`再消費-$する
◎ Reconsume in the comment end dash state.

12.2.5.49. `~comment~LTsign~bang~dash~dash^st

`次n入力~文字$を消費する: ◎ Consume the next input character:

`003E^U
~EOF
  1. `~comment終端$st内で`再消費-$する
◎ Reconsume in the comment end state.
~AnyElse
  1. `nested-comment$pE
  2. `~comment終端$st内で`再消費-$する
◎ This is a nested-comment parse error. Reconsume in the comment end state.

12.2.5.50. `~comment終端~dash^st

`次n入力~文字$を消費する: ◎ Consume the next input character:

`002D^U
  1. `~comment終端$stに`切替える$
◎ Switch to the comment end state
~EOF
  1. `eof-in-comment$pE
  2. 現在の~comment~tokenを発する
  3. ~eof~tokenを発する
◎ This is an eof-in-comment parse error. Emit the comment token. Emit an end-of-file token.
~AnyElse
  1. 現在の~comment~tokenの~data ~APPEND `002D^U
  2. `~comment$st内で`再消費-$する
◎ Append a U+002D HYPHEN-MINUS character (-) to the comment token's data. Reconsume in the comment state.

12.2.5.51. `~comment終端^st

`次n入力~文字$を消費する: ◎ Consume the next input character:

`003E^U
  1. `~data$stに`切替える$
  2. 現在の~comment~tokenを発する
◎ Switch to the data state. Emit the comment token.
`0021^U
  1. `~comment終端~bang$stに`切替える$
◎ Switch to the comment end bang state.
`002D^U
  1. 現在の~comment~tokenの~data ~APPEND `002D^U
◎ Append a U+002D HYPHEN-MINUS character (-) to the comment token's data.
~EOF
  1. `eof-in-comment$pE
  2. 現在の~comment~tokenを発する
  3. ~eof~tokenを発する
◎ This is an eof-in-comment parse error. Emit the comment token. Emit an end-of-file token.
~AnyElse
  1. 現在の~comment~tokenの~data ~APPEND `002D^U ~APPEND `002D^U
  2. `~comment$st内で`再消費-$する
◎ Append two U+002D HYPHEN-MINUS characters (-) to the comment token's data. Reconsume in the comment state.

12.2.5.52. `~comment終端~bang^st

`次n入力~文字$を消費する: ◎ Consume the next input character:

`002D^U
  1. 現在の~comment~tokenの~data ~APPEND `002D^U ~APPEND `0021^U
  2. `~comment終端~dash$stに`切替える$
◎ Append two U+002D HYPHEN-MINUS characters (-) and a U+0021 EXCLAMATION MARK character (!) to the comment token's data. Switch to the comment end dash state.
`003E^U
  1. `incorrectly-closed-comment$pE
  2. `~data$stに`切替える$
  3. 現在の~comment~tokenを発する
◎ This is an incorrectly-closed-comment parse error. Switch to the data state. Emit the comment token.
~EOF
  1. `eof-in-comment$pE
  2. 現在の~comment~tokenを発する
  3. ~eof~tokenを発する
◎ This is an eof-in-comment parse error. Emit the comment token. Emit an end-of-file token.
~AnyElse
  1. 現在の~comment~tokenの~data ~APPEND `002D^U ~APPEND `0021^U
  2. `~comment$st内で`再消費-$する
◎ Append two U+002D HYPHEN-MINUS characters (-) and a U+0021 EXCLAMATION MARK character (!) to the comment token's data. Reconsume in the comment state.

12.2.5.53. `~DOCTYPE^st

`次n入力~文字$を消費する: ◎ Consume the next input character:

`0009^U
`000A^U
`000C^U
`0020^U
  1. `~DOCTYPE名の前$stに`切替える$
◎ Switch to the before DOCTYPE name state.
`003E^U
  1. `~DOCTYPE名の前$st内で`再消費-$する
◎ Reconsume in the before DOCTYPE name state.
~EOF
  1. `eof-in-doctype$pE
  2. %~token ~LET 新たな~DOCTYPE~token
  3. `過去互換強制~flag$ ~SET ~ON
  4. %~token を発する
  5. ~eof~tokenを発する
◎ This is an eof-in-doctype parse error. Create a new DOCTYPE token. Set its force-quirks flag to on. Emit the token. Emit an end-of-file token.
~AnyElse
  1. `missing-whitespace-before-doctype-name$pE
  2. `~DOCTYPE名の前$st内で`再消費-$する
◎ This is a missing-whitespace-before-doctype-name parse error. Reconsume in the before DOCTYPE name state.

12.2.5.54. `~DOCTYPE名の前^st

`次n入力~文字$を消費する: ◎ Consume the next input character:

`0009^U
`000A^U
`000C^U
`0020^U
  1. この文字は無視する
◎ Ignore the character.
`~ASCII英大文字$
  1. %~token ~LET 新たな~DOCTYPE~token
  2. %~token の名前 ~SET `現在の入力~文字$に対応する小文字(文字の~cpに `0020^X を加算する)
  3. `~DOCTYPE名$stに`切替える$
◎ Create a new DOCTYPE token. Set the token's name to the lowercase version of the current input character (add 0x0020 to the character's code point). Switch to the DOCTYPE name state.
`0000^U
  1. `unexpected-null-character$pE
  2. %~token ~LET 新たな~DOCTYPE~token
  3. %~token の名前 ~SET `FFFD^U
  4. `~DOCTYPE名$stに`切替える$
◎ This is an unexpected-null-character parse error. Create a new DOCTYPE token. Set the token's name to a U+FFFD REPLACEMENT CHARACTER character. Switch to the DOCTYPE name state.
`003E^U
  1. `missing-doctype-name$pE
  2. %~token ~LET 新たな~DOCTYPE~token
  3. `過去互換強制~flag$ ~SET ~ON
  4. `~data$stに`切替える$
  5. %~token を発する
◎ This is a missing-doctype-name parse error. Create a new DOCTYPE token. Set its force-quirks flag to on. Switch to the data state. Emit the token.
~EOF
  1. `eof-in-doctype$pE
  2. %~token ~LET 新たな~DOCTYPE~token
  3. `過去互換強制~flag$ ~SET ~ON
  4. %~token を発する
  5. ~eof~tokenを発する
◎ This is an eof-in-doctype parse error. Create a new DOCTYPE token. Set its force-quirks flag to on. Emit the token. Emit an end-of-file token.
~AnyElse
  1. %~token ~LET 新たな~DOCTYPE~token
  2. %~token の名前 ~SET `現在の入力~文字$
  3. `~DOCTYPE名$stに`切替える$
◎ Create a new DOCTYPE token. Set the token's name to the current input character. Switch to the DOCTYPE name state.

12.2.5.55. `~DOCTYPE名^st

`次n入力~文字$を消費する: ◎ Consume the next input character:

`0009^U
`000A^U
`000C^U
`0020^U
  1. `~DOCTYPE名の後$stに`切替える$
◎ Switch to the after DOCTYPE name state.
`003E^U
  1. `~data$stに`切替える$
  2. 現在の~DOCTYPE~tokenを発する
◎ Switch to the data state. Emit the current DOCTYPE token.
`~ASCII英大文字$
  1. 現在の~DOCTYPE~tokenの名前 ~APPEND `現在の入力~文字$に対応する小文字(文字の~cpに `0020^X を加算する)
◎ Append the lowercase version of the current input character (add 0x0020 to the character's code point) to the current DOCTYPE token's name.
`0000^U
  1. `unexpected-null-character$pE
  2. 現在の~DOCTYPE~tokenの名前 ~APPEND `FFFD^U
◎ This is an unexpected-null-character parse error. Append a U+FFFD REPLACEMENT CHARACTER character to the current DOCTYPE token's name.
~EOF
  1. `eof-in-doctype$pE
  2. 現在の~DOCTYPE~tokenの`過去互換強制~flag$ ~SET ~ON
  3. 現在の~DOCTYPE~tokenを発する
  4. ~eof~tokenを発する
◎ This is an eof-in-doctype parse error. Set the DOCTYPE token's force-quirks flag to on. Emit that DOCTYPE token. Emit an end-of-file token.
~AnyElse
  1. 現在の~DOCTYPE~tokenの名前 ~APPEND `現在の入力~文字$
◎ Append the current input character to the current DOCTYPE token's name.

12.2.5.56. `~DOCTYPE名の後^st

`次n入力~文字$を消費する: ◎ Consume the next input character:

`0009^U
`000A^U
`000C^U
`0020^U
  1. この文字は無視する
◎ Ignore the character.
`003E^U
  1. `~data$stに`切替える$
  2. 現在の~DOCTYPE~tokenを発する
◎ Switch to the data state. Emit the current DOCTYPE token.
~EOF
  1. `eof-in-doctype$pE
  2. 現在の~DOCTYPE~tokenの`過去互換強制~flag$ ~SET ~ON
  3. 現在の~DOCTYPE~tokenを発する
  4. ~eof~tokenを発する
◎ This is an eof-in-doctype parse error. Set the DOCTYPE token's force-quirks flag to on. Emit that DOCTYPE token. Emit an end-of-file token.
~AnyElse
  1. ~IF[[ `現在の入力~文字$から開始する 6 個の文字~並び ] ~EQ`大小無視$sub `PUBLIC^l ]:

    1. それらの文字を消費する
    2. `~DOCTYPE~public-keywordの後$stに`切替える$
    ◎ If the six characters starting from the current input character are an ASCII case-insensitive match for the word "PUBLIC", then consume those characters and switch to the after DOCTYPE public keyword state.
  2. ~ELIF[[ `現在の入力~文字$から開始する 6 個の文字~並び ] ~EQ`大小無視$sub `SYSTEM^l ]:

    1. それらの文字を消費する
    2. `~DOCTYPE~system-keywordの後$stに`切替える$
    ◎ Otherwise, if the six characters starting from the current input character are an ASCII case-insensitive match for the word "SYSTEM", then consume those characters and switch to the after DOCTYPE system keyword state.
  3. ~ELSE:

    1. `invalid-character-sequence-after-doctype-name$pE
    2. 現在の~DOCTYPE~tokenの`過去互換強制~flag$ ~SET ~ON
    3. `似非~DOCTYPE$st内で`再消費-$する
    ◎ Otherwise, this is an invalid-character-sequence-after-doctype-name parse error. Set the DOCTYPE token's force-quirks flag to on. Reconsume in the bogus DOCTYPE state.

12.2.5.57. `~DOCTYPE~public-keywordの後^st

`次n入力~文字$を消費する: ◎ Consume the next input character:

`0009^U
`000A^U
`000C^U
`0020^U
  1. `~DOCTYPE~publicIDの前$stに`切替える$
◎ Switch to the before DOCTYPE public identifier state.
`0022^U
  1. `missing-whitespace-after-doctype-public-keyword$pE
  2. 現在の~DOCTYPE~tokenの~publicID ~SET 空~文字列
  3. `~DOCTYPE~publicID(二重引用符)$stに`切替える$
◎ This is a missing-whitespace-after-doctype-public-keyword parse error. Set the DOCTYPE token's public identifier to the empty string (not missing), then switch to the DOCTYPE public identifier (double-quoted) state.
`0027^U
  1. `missing-whitespace-after-doctype-public-keyword$pE
  2. 現在の~DOCTYPE~tokenの~publicID ~SET 空~文字列
  3. `~DOCTYPE~publicID(一重引用符)$stに`切替える$
◎ This is a missing-whitespace-after-doctype-public-keyword parse error. Set the DOCTYPE token's public identifier to the empty string (not missing), then switch to the DOCTYPE public identifier (single-quoted) state.
`003E^U
  1. `missing-doctype-public-identifier$pE
  2. 現在の~DOCTYPE~tokenの`過去互換強制~flag$ ~SET ~ON
  3. `~data$stに`切替える$
  4. 現在の~DOCTYPE~tokenを発する
◎ This is a missing-doctype-public-identifier parse error. Set the DOCTYPE token's force-quirks flag to on. Switch to the data state. Emit that DOCTYPE token.
~EOF
  1. `eof-in-doctype$pE
  2. 現在の~DOCTYPE~tokenの`過去互換強制~flag$ ~SET ~ON
  3. 現在の~DOCTYPE~tokenを発する
  4. ~eof~tokenを発する
◎ This is an eof-in-doctype parse error. Set the DOCTYPE token's force-quirks flag to on. Emit that DOCTYPE token. Emit an end-of-file token.
~AnyElse
  1. `missing-quote-before-doctype-public-identifier$pE
  2. 現在の~DOCTYPE~tokenの`過去互換強制~flag$ ~SET ~ON
  3. `似非~DOCTYPE$st内で`再消費-$する
◎ This is a missing-quote-before-doctype-public-identifier parse error. Set the DOCTYPE token's force-quirks flag to on. Reconsume in the bogus DOCTYPE state.

12.2.5.58. `~DOCTYPE~publicIDの前^st

`次n入力~文字$を消費する: ◎ Consume the next input character:

`0009^U
`000A^U
`000C^U
`0020^U
  1. この文字は無視する
◎ Ignore the character.
`0022^U
  1. 現在の~DOCTYPE~tokenの~publicID ~SET 空~文字列
  2. `~DOCTYPE~publicID(二重引用符)$stに`切替える$
◎ Set the DOCTYPE token's public identifier to the empty string (not missing), then switch to the DOCTYPE public identifier (double-quoted) state.
`0027^U
  1. 現在の~DOCTYPE~tokenの~publicID ~SET 空~文字列
  2. `~DOCTYPE~publicID(一重引用符)$stに`切替える$
◎ Set the DOCTYPE token's public identifier to the empty string (not missing), then switch to the DOCTYPE public identifier (single-quoted) state.
`003E^U
  1. `missing-doctype-public-identifier$pE
  2. 現在の~DOCTYPE~tokenの`過去互換強制~flag$ ~SET ~ON
  3. `~data$stに`切替える$
  4. 現在の~DOCTYPE~tokenを発する
◎ This is a missing-doctype-public-identifier parse error. Set the DOCTYPE token's force-quirks flag to on. Switch to the data state. Emit that DOCTYPE token.
~EOF
  1. `eof-in-doctype$pE
  2. 現在の~DOCTYPE~tokenの`過去互換強制~flag$ ~SET ~ON
  3. 現在の~DOCTYPE~tokenを発する
  4. ~eof~tokenを発する
◎ This is an eof-in-doctype parse error. Set the DOCTYPE token's force-quirks flag to on. Emit that DOCTYPE token. Emit an end-of-file token.
~AnyElse
  1. `missing-quote-before-doctype-public-identifier$pE
  2. 現在の~DOCTYPE~tokenの`過去互換強制~flag$ ~SET ~ON
  3. `似非~DOCTYPE$st内で`再消費-$する
◎ This is a missing-quote-before-doctype-public-identifier parse error. Set the DOCTYPE token's force-quirks flag to on. Reconsume in the bogus DOCTYPE state.

12.2.5.59. `~DOCTYPE~publicID(二重引用符)^st

`次n入力~文字$を消費する: ◎ Consume the next input character:

`0022^U
  1. `~DOCTYPE~publicIDの後$stに`切替える$
◎ Switch to the after DOCTYPE public identifier state.
`0000^U
  1. `unexpected-null-character$pE
  2. 現在の~DOCTYPE~tokenの~publicID ~APPEND `FFFD^U
◎ This is an unexpected-null-character parse error. Append a U+FFFD REPLACEMENT CHARACTER character to the current DOCTYPE token's public identifier.
`003E^U
  1. `abrupt-doctype-public-identifier$pE
  2. 現在の~DOCTYPE~tokenの`過去互換強制~flag$ ~SET ~ON
  3. `~data$stに`切替える$
  4. 現在の~DOCTYPE~tokenを発する
◎ This is an abrupt-doctype-public-identifier parse error. Set the DOCTYPE token's force-quirks flag to on. Switch to the data state. Emit that DOCTYPE token.
~EOF
  1. `eof-in-doctype$pE
  2. 現在の~DOCTYPE~tokenの`過去互換強制~flag$ ~SET ~ON
  3. 現在の~DOCTYPE~tokenを発する
  4. ~eof~tokenを発する
◎ This is an eof-in-doctype parse error. Set the DOCTYPE token's force-quirks flag to on. Emit that DOCTYPE token. Emit an end-of-file token.
~AnyElse
  1. 現在の~DOCTYPE~tokenの~publicID ~APPEND `現在の入力~文字$
◎ Append the current input character to the current DOCTYPE token's public identifier.

12.2.5.60. `~DOCTYPE~publicID(一重引用符)^st

`次n入力~文字$を消費する: ◎ Consume the next input character:

`0027^U
  1. `~DOCTYPE~publicIDの後$stに`切替える$
◎ Switch to the after DOCTYPE public identifier state.
`0000^U
  1. `unexpected-null-character$pE
  2. 現在の~DOCTYPE~tokenの~publicID ~APPEND `FFFD^U
◎ This is an unexpected-null-character parse error. Append a U+FFFD REPLACEMENT CHARACTER character to the current DOCTYPE token's public identifier.
`003E^U
  1. `abrupt-doctype-public-identifier$pE
  2. 現在の~DOCTYPE~tokenの`過去互換強制~flag$ ~SET ~ON
  3. `~data$stに`切替える$
  4. 現在の~DOCTYPE~tokenを発する
◎ This is an abrupt-doctype-public-identifier parse error. Set the DOCTYPE token's force-quirks flag to on. Switch to the data state. Emit that DOCTYPE token.
~EOF
  1. `eof-in-doctype$pE
  2. 現在の~DOCTYPE~tokenの`過去互換強制~flag$ ~SET ~ON
  3. 現在の~DOCTYPE~tokenを発する
  4. ~eof~tokenを発する
◎ This is an eof-in-doctype parse error. Set the DOCTYPE token's force-quirks flag to on. Emit that DOCTYPE token. Emit an end-of-file token.
~AnyElse
  1. 現在の~DOCTYPE~tokenの~publicID ~APPEND `現在の入力~文字$
◎ Append the current input character to the current DOCTYPE token's public identifier.

12.2.5.61. `~DOCTYPE~publicIDの後^st

`次n入力~文字$を消費する: ◎ Consume the next input character:

`0009^U
`000A^U
`000C^U
`0020^U
  1. `~DOCTYPE~publicIDと~systemIDの合間$stに`切替える$
◎ Switch to the between DOCTYPE public and system identifiers state.
`003E^U
  1. `~data$stに`切替える$
  2. 現在の~DOCTYPE~tokenを発する
◎ Switch to the data state. Emit the current DOCTYPE token.
`0022^U
  1. `missing-whitespace-between-doctype-public-and-system-identifiers$pE
  2. 現在の~DOCTYPE~tokenの~systemID ~SET 空~文字列
  3. `~DOCTYPE~systemID(二重引用符)$stに`切替える$
◎ This is a missing-whitespace-between-doctype-public-and-system-identifiers parse error. Set the DOCTYPE token's system identifier to the empty string (not missing), then switch to the DOCTYPE system identifier (double-quoted) state.
`0027^U
  1. `missing-whitespace-between-doctype-public-and-system-identifiers$pE
  2. 現在の~DOCTYPE~tokenの~systemID ~SET 空~文字列
  3. `~DOCTYPE~systemID(一重引用符)$stに`切替える$
◎ This is a missing-whitespace-between-doctype-public-and-system-identifiers parse error. Set the DOCTYPE token's system identifier to the empty string (not missing), then switch to the DOCTYPE system identifier (single-quoted) state.
~EOF
  1. `eof-in-doctype$pE
  2. 現在の~DOCTYPE~tokenの`過去互換強制~flag$ ~SET ~ON
  3. 現在の~DOCTYPE~tokenを発する
  4. ~eof~tokenを発する
◎ This is an eof-in-doctype parse error. Set the DOCTYPE token's force-quirks flag to on. Emit that DOCTYPE token. Emit an end-of-file token.
~AnyElse
  1. `missing-quote-before-doctype-system-identifier$pE
  2. 現在の~DOCTYPE~tokenの`過去互換強制~flag$ ~SET ~ON
  3. `似非~DOCTYPE$st内で`再消費-$する
◎ This is a missing-quote-before-doctype-system-identifier parse error. Set the DOCTYPE token's force-quirks flag to on. Reconsume in the bogus DOCTYPE state.

12.2.5.62. `~DOCTYPE~publicIDと~systemIDの合間^st

`次n入力~文字$を消費する: ◎ Consume the next input character:

`0009^U
`000A^U
`000C^U
`0020^U
  1. この文字は無視する
◎ Ignore the character.
`003E^U
  1. `~data$stに`切替える$
  2. 現在の~DOCTYPE~tokenを発する
◎ Switch to the data state. Emit the current DOCTYPE token.
`0022^U
  1. 現在の~DOCTYPE~tokenの~systemID ~SET 空~文字列
  2. `~DOCTYPE~systemID(二重引用符)$stに`切替える$
◎ Set the DOCTYPE token's system identifier to the empty string (not missing), then switch to the DOCTYPE system identifier (double-quoted) state.
`0027^U
  1. 現在の~DOCTYPE~tokenの~systemID ~SET 空~文字列
  2. `~DOCTYPE~systemID(一重引用符)$stに`切替える$
◎ Set the DOCTYPE token's system identifier to the empty string (not missing), then switch to the DOCTYPE system identifier (single-quoted) state.
~EOF
  1. `eof-in-doctype$pE
  2. 現在の~DOCTYPE~tokenの`過去互換強制~flag$ ~SET ~ON
  3. 現在の~DOCTYPE~tokenを発する
  4. ~eof~tokenを発する
◎ This is an eof-in-doctype parse error. Set the DOCTYPE token's force-quirks flag to on. Emit that DOCTYPE token. Emit an end-of-file token.
~AnyElse
  1. `missing-quote-before-doctype-system-identifier$pE
  2. 現在の~DOCTYPE~tokenの`過去互換強制~flag$ ~SET ~ON
  3. `似非~DOCTYPE$st内で`再消費-$する
◎ This is a missing-quote-before-doctype-system-identifier parse error. Set the DOCTYPE token's force-quirks flag to on. Reconsume in the bogus DOCTYPE state.

12.2.5.63. `~DOCTYPE~system-keywordの後^st

`次n入力~文字$を消費する: ◎ Consume the next input character:

`0009^U
`000A^U
`000C^U
`0020^U
  1. `~DOCTYPE~systemIDの前$stに`切替える$
◎ Switch to the before DOCTYPE system identifier state.
`0022^U
  1. `missing-whitespace-after-doctype-system-keyword$pE
  2. 現在の~DOCTYPE~tokenの~systemID ~SET 空~文字列
  3. `~DOCTYPE~systemID(二重引用符)$stに`切替える$
◎ This is a missing-whitespace-after-doctype-system-keyword parse error. Set the DOCTYPE token's system identifier to the empty string (not missing), then switch to the DOCTYPE system identifier (double-quoted) state.
`0027^U
  1. `missing-whitespace-after-doctype-system-keyword$pE
  2. 現在の~DOCTYPE~tokenの~systemID ~SET 空~文字列
  3. `~DOCTYPE~systemID(一重引用符)$stに`切替える$
◎ This is a missing-whitespace-after-doctype-system-keyword parse error. Set the DOCTYPE token's system identifier to the empty string (not missing), then switch to the DOCTYPE system identifier (single-quoted) state.
`003E^U
  1. `missing-doctype-system-identifier$pE
  2. 現在の~DOCTYPE~tokenの`過去互換強制~flag$ ~SET ~ON
  3. `~data$stに`切替える$
  4. 現在の~DOCTYPE~tokenを発する
◎ This is a missing-doctype-system-identifier parse error. Set the DOCTYPE token's force-quirks flag to on. Switch to the data state. Emit that DOCTYPE token.
~EOF
  1. `eof-in-doctype$pE
  2. 現在の~DOCTYPE~tokenの`過去互換強制~flag$ ~SET ~ON
  3. 現在の~DOCTYPE~tokenを発する
  4. ~eof~tokenを発する
◎ This is an eof-in-doctype parse error. Set the DOCTYPE token's force-quirks flag to on. Emit that DOCTYPE token. Emit an end-of-file token.
~AnyElse
  1. `missing-quote-before-doctype-system-identifier$pE
  2. 現在の~DOCTYPE~tokenの`過去互換強制~flag$ ~SET ~ON
  3. `似非~DOCTYPE$st内で`再消費-$する
◎ This is a missing-quote-before-doctype-system-identifier parse error. Set the DOCTYPE token's force-quirks flag to on. Reconsume in the bogus DOCTYPE state.

12.2.5.64. `~DOCTYPE~systemIDの前^st

`次n入力~文字$を消費する: ◎ Consume the next input character:

`0009^U
`000A^U
`000C^U
`0020^U
  1. この文字は無視する
◎ Ignore the character.
`0022^U
  1. 現在の~DOCTYPE~tokenの~systemID ~SET 空~文字列
  2. `~DOCTYPE~systemID(二重引用符)$stに`切替える$
◎ Set the DOCTYPE token's system identifier to the empty string (not missing), then switch to the DOCTYPE system identifier (double-quoted) state.
`0027^U
  1. 現在の~DOCTYPE~tokenの~systemID ~SET 空~文字列
  2. `~DOCTYPE~systemID(一重引用符)$stに`切替える$
◎ Set the DOCTYPE token's system identifier to the empty string (not missing), then switch to the DOCTYPE system identifier (single-quoted) state.
`003E^U
  1. `missing-doctype-system-identifier$pE
  2. 現在の~DOCTYPE~tokenの`過去互換強制~flag$ ~SET ~ON
  3. `~data$stに`切替える$
  4. 現在の~DOCTYPE~tokenを発する
◎ This is a missing-doctype-system-identifier parse error. Set the DOCTYPE token's force-quirks flag to on. Switch to the data state. Emit that DOCTYPE token.
~EOF
  1. `eof-in-doctype$pE
  2. 現在の~DOCTYPE~tokenの`過去互換強制~flag$ ~SET ~ON
  3. 現在の~DOCTYPE~tokenを発する
  4. ~eof~tokenを発する
◎ This is an eof-in-doctype parse error. Set the DOCTYPE token's force-quirks flag to on. Emit that DOCTYPE token. Emit an end-of-file token.
~AnyElse
  1. `missing-quote-before-doctype-system-identifier$pE
  2. 現在の~DOCTYPE~tokenの`過去互換強制~flag$ ~SET ~ON
  3. `似非~DOCTYPE$st内で`再消費-$する
◎ This is a missing-quote-before-doctype-system-identifier parse error. Set the DOCTYPE token's force-quirks flag to on. Reconsume in the bogus DOCTYPE state.

12.2.5.65. `~DOCTYPE~systemID(二重引用符)^st

`次n入力~文字$を消費する: ◎ Consume the next input character:

`0022^U
  1. `~DOCTYPE~systemIDの後$stに`切替える$
◎ Switch to the after DOCTYPE system identifier state.
`0000^U
  1. `unexpected-null-character$pE
  2. 現在の~DOCTYPE~tokenの~systemID ~APPEND `FFFD^U
◎ This is an unexpected-null-character parse error. Append a U+FFFD REPLACEMENT CHARACTER character to the current DOCTYPE token's system identifier.
`003E^U
  1. `abrupt-doctype-system-identifier$pE
  2. 現在の~DOCTYPE~tokenの`過去互換強制~flag$ ~SET ~ON
  3. `~data$stに`切替える$
  4. 現在の~DOCTYPE~tokenを発する
◎ This is an abrupt-doctype-system-identifier parse error. Set the DOCTYPE token's force-quirks flag to on. Switch to the data state. Emit that DOCTYPE token.
~EOF
  1. `eof-in-doctype$pE
  2. 現在の~DOCTYPE~tokenの`過去互換強制~flag$ ~SET ~ON
  3. 現在の~DOCTYPE~tokenを発する
  4. ~eof~tokenを発する
◎ This is an eof-in-doctype parse error. Set the DOCTYPE token's force-quirks flag to on. Emit that DOCTYPE token. Emit an end-of-file token.
~AnyElse
  1. 現在の~DOCTYPE~tokenの~systemID ~APPEND `現在の入力~文字$
◎ Append the current input character to the current DOCTYPE token's system identifier.

12.2.5.66. `~DOCTYPE~systemID(一重引用符)^st

`次n入力~文字$を消費する: ◎ Consume the next input character:

`0027^U
  1. `~DOCTYPE~systemIDの後$stに`切替える$
◎ Switch to the after DOCTYPE system identifier state.
`0000^U
  1. `unexpected-null-character$pE
  2. 現在の~DOCTYPE~tokenの~systemID ~APPEND `FFFD^U
◎ This is an unexpected-null-character parse error. Append a U+FFFD REPLACEMENT CHARACTER character to the current DOCTYPE token's system identifier.
`003E^U
  1. `abrupt-doctype-system-identifier$pE
  2. 現在の~DOCTYPE~tokenの`過去互換強制~flag$ ~SET ~ON
  3. `~data$stに`切替える$
  4. 現在の~DOCTYPE~tokenを発する
◎ This is an abrupt-doctype-system-identifier parse error. Set the DOCTYPE token's force-quirks flag to on. Switch to the data state. Emit that DOCTYPE token.
~EOF
  1. `eof-in-doctype$pE
  2. 現在の~DOCTYPE~tokenの`過去互換強制~flag$ ~SET ~ON
  3. 現在の~DOCTYPE~tokenを発する
  4. ~eof~tokenを発する
◎ This is an eof-in-doctype parse error. Set the DOCTYPE token's force-quirks flag to on. Emit that DOCTYPE token. Emit an end-of-file token.
~AnyElse
  1. 現在の~DOCTYPE~tokenの~systemID ~APPEND `現在の入力~文字$
◎ Append the current input character to the current DOCTYPE token's system identifier.

12.2.5.67. `~DOCTYPE~systemIDの後^st

`次n入力~文字$を消費する: ◎ Consume the next input character:

`0009^U
`000A^U
`000C^U
`0020^U
  1. この文字は無視する
◎ Ignore the character.
`003E^U
  1. `~data$stに`切替える$
  2. 現在の~DOCTYPE~tokenを発する
◎ Switch to the data state. Emit the current DOCTYPE token.
~EOF
  1. `eof-in-doctype$pE
  2. 現在の~DOCTYPE~tokenの`過去互換強制~flag$ ~SET ~ON
  3. 現在の~DOCTYPE~tokenを発する
  4. ~eof~tokenを発する
◎ This is an eof-in-doctype parse error. Set the DOCTYPE token's force-quirks flag to on. Emit that DOCTYPE token. Emit an end-of-file token.
~AnyElse
  1. `unexpected-character-after-doctype-system-identifier$pE
  2. `似非~DOCTYPE$st内で`再消費-$する (これは、現在の~DOCTYPE~tokenの`過去互換強制~flag$を ~ON にしない。)
◎ This is an unexpected-character-after-doctype-system-identifier parse error. Reconsume in the bogus DOCTYPE state. (This does not set the DOCTYPE token's force-quirks flag to on.)

12.2.5.68. `似非~DOCTYPE^st

`次n入力~文字$を消費する: ◎ Consume the next input character:

`003E^U
  1. `~data$stに`切替える$
  2. 現在の~DOCTYPE~tokenを発する
◎ Switch to the data state. Emit the DOCTYPE token.
`0000^U
  1. `unexpected-null-character$pE
  2. この文字は無視する
◎ This is an unexpected-null-character parse error. Ignore the character.
~EOF
  1. 現在の~DOCTYPE~tokenを発する
  2. ~eof~tokenを発する
◎ Emit the DOCTYPE token. Emit an end-of-file token.
~AnyElse
  1. この文字は無視する
◎ Ignore the character.

12.2.5.69. `~CDATAsec^st

`次n入力~文字$を消費する: ◎ Consume the next input character:

`005D^U
  1. `~CDATAsec~bracket$stに`切替える$
◎ Switch to the CDATA section bracket state.
~EOF
  1. `eof-in-cdata$pE
  2. ~eof~tokenを発する
◎ This is an eof-in-cdata parse error. Emit an end-of-file token.
~AnyElse
  1. 新たな文字~token( `現在の入力~文字$ ) を発する
◎ Emit the current input character as a character token.

注記: `0000^U は、木~構築~段階にて,`外来~内容~内$md内の一部として取扱われる — それは、`~CDATAsec$が現れ得る唯一の箇所である ◎ U+0000 NULL characters are handled in the tree construction stage, as part of the in foreign content insertion mode, which is the only place where CDATA sections can appear.

12.2.5.70. `~CDATAsec~bracket^st

`次n入力~文字$を消費する: ◎ Consume the next input character:

`005D^U
  1. `~CDATAsec終端$stに`切替える$
◎ Switch to the CDATA section end state.
~AnyElse
  1. 新たな文字~token( `005D^U ) を発する
  2. `~CDATAsec$st内で`再消費-$する
◎ Emit a U+005D RIGHT SQUARE BRACKET character token. Reconsume in the CDATA section state.

12.2.5.71. `~CDATAsec終端^st

`次n入力~文字$を消費する: ◎ Consume the next input character:

`005D^U
  1. 新たな文字~token( `005D^U ) を発する
◎ Emit a U+005D RIGHT SQUARE BRACKET character token.
`003E^U
  1. `~data$stに`切替える$
◎ Switch to the data state.
~AnyElse
  1. 新たな文字~token( `005D^U ) を発する
  2. 新たな文字~token( `005D^U ) を発する
  3. `~CDATAsec$st内で`再消費-$する
◎ Emit two U+005D RIGHT SQUARE BRACKET character tokens. Reconsume in the CDATA section state.

12.2.5.72. `文字~参照^st

  1. `一時~buffer$V ~SET 空~文字列 ~APPEND `0026^U ~APPEND `現在の入力~文字$ ◎ Set the temporary buffer to the empty string. Append a U+0026 AMPERSAND (&) character to the temporary buffer.\
  2. `次n入力~文字$を消費する: ◎ Consume the next input character:

    `~ASCII英数字$
    1. `有名~文字~参照$st内で`再消費-$する
    ◎ Reconsume in the named character reference state.
    `0023^U
    1. `一時~buffer$V ~APPEND `現在の入力~文字$
    2. `数的な文字~参照$stに`切替える$
    ◎ Append the current input character to the temporary buffer. Switch to the numeric character reference state.
    ~AnyElse
    1. `文字~参照として消費される~cpを一掃する$
    2. `戻先~状態$V 内で`再消費-$する
    ◎ Flush code points consumed as a character reference. Reconsume in the return state.

12.2.5.73. `有名~文字~参照^st

  1. %識別子 ~LET 次の条件を満たすような,可能な限り最大~個数の文字を消費して得られる文字列 ⇒ 消費して得られた文字列 ~IN 次に挙げる文字列からなる集合:

    • `有名~文字~参照$ 一覧の 1 列目に挙げられている識別子に~semicolon( `003B^U )を付加したもの
    • 同じ一覧の 1 列目に挙げられている識別子のうち,“†” が付与されているもの(~markup内で~semicolonを省略しても有効になるもの)
    • 空~文字列

    【 この訳における有名~文字~参照の一覧は、~semicolonを省略している( “†” に代えている)ため、この段の記述は,それに整合するように原文と違えている。 】

    ◎ Consume the maximum number of characters possible, with the consumed characters matching one of the identifiers in the first column of the named character references table (in a case-sensitive manner). Append each character to the temporary buffer when it's consumed.
  2. ~IF[ %識別子 ~NEQ 空~文字列 ] ◎ If there is a match

    1. %~semicolonなし ~LET [ %識別子 の最後の文字 ~NEQ `003B^U ならば ~T / ~ELSE_ ~F ] ◎ ↓
    2. ~IF[ 次がいずれも満たされる ]…:
      • 文字~参照は`属性の一部として消費されて$いる
      • %~semicolonなし ~EQ ~T
      • `次n入力~文字$ ~IN { `003D^U, `~ASCII英数字$ }

      …ならば ⇒ `一時~buffer$V ~APPEND %識別子 (これは、歴史的~理由による)

      ◎ If the character reference was consumed as part of an attribute, and the last character matched is not a U+003B SEMICOLON character (;), and the next input character is either a U+003D EQUALS SIGN character (=) or an ASCII alphanumeric, then, for historical reasons,\ ◎ ↓↓flush code points consumed as a character reference and switch to the return state.
    3. ~ELSE: ◎ Otherwise:

      1. ~IF[ %~semicolonなし ~EQ ~T ] ⇒ `missing-semicolon-after-character-reference$pE ◎ If the last character matched is not a U+003B SEMICOLON character (;), then this is a missing-semicolon-after-character-reference parse error.
      2. `一時~buffer$V ~SET `有名~文字~参照$ 一覧の 2 列目に与えられる, %識別子 に対応している 1 〜 2 個の文字 ◎ Set the temporary buffer to the empty string. Append one or two characters corresponding to the character reference name (as given by the second column of the named character references table) to the temporary buffer. ◎ ↓↓Flush code points consumed as a character reference. Switch to the return state.
  3. `文字~参照として消費される~cpを一掃する$ ◎ ↑↓
  4. [ %識別子 ~NEQ 空~文字列 ならば `戻先~状態$V / ~ELSE_ `多義的amp$st ]に`切替える$ ◎ Otherwise • Flush code points consumed as a character reference. Switch to the ambiguous ampersand state.

~markupが,属性の外で文字列 `I'm &notit; I tell you^l を包含する場合、文字~参照は、 `I'm ¬it; I tell you^l のように, “~~否定( not )” として構文解析される(これは~perrorでもある)。 が、文字列が `I'm &notin; I tell you^l であったなら、文字~参照は `notin;^l として構文解析される結果, `I'm ∉ I tell you^l になる(また,~perrorもない)。 ◎ If the markup contains (not in an attribute) the string I'm &notit; I tell you, the character reference is parsed as "not", as in, I'm ¬it; I tell you (and this is a parse error). But if the markup was I'm &notin; I tell you, the character reference would be parsed as "notin;", resulting in I'm ∉ I tell you (and no parse error).

一方で,~markupが ある属性~内に文字列 `I'm &notit; I tell you^l を包含する場合、構文解析される文字~参照はなく,文字列はそのままにされる(また,~perrorもない)。 ◎ However, if the markup contains the string I'm &notit; I tell you in an attribute, no character reference is parsed and string remains intact (and there is no parse error).

12.2.5.74. `多義的amp^st

`次n入力~文字$を消費する: ◎ Consume the next input character:

`~ASCII英数字$
  1. ~IF[ 文字~参照は`属性の一部として消費されて$いる ] ⇒ 現在の属性の値 ~APPEND `現在の入力~文字$
  2. ~ELSE ⇒ 新たな文字~token( `現在の入力~文字$ ) を発する
◎ If the character reference was consumed as part of an attribute, then append the current input character to the current attribute's value. Otherwise, emit the current input character as a character token.
`003B^U
  1. `unknown-named-character-reference$pE
  2. `戻先~状態$V 内で`再消費-$する
◎ This is an unknown-named-character-reference parse error. Reconsume in the return state.
~AnyElse
  1. `戻先~状態$V 内で`再消費-$する
◎ Reconsume in the return state.

12.2.5.75. `数的な文字~参照^st

  1. `文字~参照~code@V ~SET 0 ◎ Set the character reference code to zero (0).
  2. `次n入力~文字$を消費する: ◎ Consume the next input character:

    `0078^U
    `0058^U
    1. `一時~buffer$V ~APPEND `現在の入力~文字$
    2. `~hexademical文字~参照~始端$stに`切替える$
    ◎ Append the current input character to the temporary buffer. Switch to the hexademical character reference start state.
    ~AnyElse
    1. `~decimal文字~参照~始端$st内で`再消費-$する
    ◎ Reconsume in the decimal character reference start state.

12.2.5.76. `~hexademical文字~参照~始端^st

`次n入力~文字$を消費する: ◎ Consume the next input character:

`~ASCII~hex数字$
  1. `~hexademical文字~参照$st内で`再消費-$する
◎ Reconsume in the hexademical character reference state.
~AnyElse
  1. `absence-of-digits-in-numeric-character-reference$pE
  2. `文字~参照として消費される~cpを一掃する$
  3. `戻先~状態$V 内で`再消費-$する
◎ This is an absence-of-digits-in-numeric-character-reference parse error. Flush code points consumed as a character reference. Reconsume in the return state.

12.2.5.77. `~decimal文字~参照~始端^st

`次n入力~文字$を消費する: ◎ Consume the next input character:

`~ASCII数字$
  1. `~decimal文字~参照$st内で`再消費-$する
◎ Reconsume in the decimal character reference state.
~AnyElse
  1. `absence-of-digits-in-numeric-character-reference$pE
  2. `文字~参照として消費される~cpを一掃する$
  3. `戻先~状態$V 内で`再消費-$する
◎ This is an absence-of-digits-in-numeric-character-reference parse error. Flush code points consumed as a character reference. Reconsume in the return state.

12.2.5.78. `~hexademical文字~参照^st

`次n入力~文字$を消費する: ◎ Consume the next input character:

`~ASCII~hex数字$
  1. `文字~参照~code$V ~SET ( `文字~参照~code$V ~MUL 16 ) ~PLUS ( `現在の入力~文字$を 16 進数として解釈した結果の整数† )

† この整数は、`現在の入力~文字$が[ `~ASCII数字$ならば その~cpから`0030^X を減算した結果 / `~ASCII~hex数字(大文字)$ならば その~cpから`0037^X を減算した結果 / `~ASCII~hex数字(小文字)$ならば その~cpから`0057^X を減算した結果 ]になる。

◎ ASCII digit ◎ Multiply the character reference code by 16. Add a numeric version of the current input character (subtract 0x0030 from the character's code point) to the character reference code. ◎ ASCII upper hex digit ◎ Multiply the character reference code by 16. Add a numeric version of the current input character as a hexademical digit (subtract 0x0037 from the character's code point) to the character reference code. ◎ ASCII lower hex digit ◎ Multiply the character reference code by 16. Add a numeric version of the current input character as a hexademical digit (subtract 0x0057 from the character's code point) to the character reference code.
`003B^U
  1. `数的な文字~参照~終端$stに`切替える$
◎ Switch to the numeric character reference end state.
~AnyElse
  1. `missing-semicolon-after-character-reference$pE
  2. `数的な文字~参照~終端$st内で`再消費-$する
◎ This is a missing-semicolon-after-character-reference parse error. Reconsume in the numeric character reference end state.

12.2.5.79. `~decimal文字~参照^st

`次n入力~文字$を消費する: ◎ Consume the next input character:

`~ASCII数字$
  1. `文字~参照~code$V ~SET ( `文字~参照~code$V ~MUL 10 ) ~PLUS ( `現在の入力~文字$を 10 進数として解釈した結果の整数(文字の~cpから`0030^X を減算した結果) ) ◎ Multiply the character reference code by 10. Add a numeric version of the current input character (subtract 0x0030 from the character's code point) to the character reference code.
`003B^U
  1. `数的な文字~参照~終端$stに`切替える$
◎ Switch to the numeric character reference end state.
~AnyElse
  1. `missing-semicolon-after-character-reference$pE
  2. `数的な文字~参照~終端$st内で`再消費-$する
◎ This is a missing-semicolon-after-character-reference parse error. Reconsume in the numeric character reference end state.

12.2.5.80. `数的な文字~参照~終端^st

  1. `文字~参照~code$V (が指す符号位置)に応じて: ◎ Check the character reference code:

    `00^X
    1. `null-character-reference$pE
    2. `文字~参照~code$V ~SET `FFFD^X
    ◎ If the number is 0x00, then this is a null-character-reference parse error. Set the character reference code to 0xFFFD.
    `10FFFF^X を超える
    1. `character-reference-outside-unicode-range$pE
    2. `文字~参照~code$V ~SET `FFFD^X
    ◎ If the number is greater than 0x10FFFF, then this is a character-reference-outside-unicode-range parse error. Set the character reference code to 0xFFFD.
    `~surrogate$
    1. `surrogate-character-reference$pE
    2. `文字~参照~code$V ~SET `FFFD^X
    ◎ If the number is a surrogate, then this is a surrogate-character-reference parse error. Set the character reference code to 0xFFFD.
    `非文字$
    1. `noncharacter-character-reference$pE
    ◎ If the number is a noncharacter, then this is a noncharacter-character-reference parse error.
    `0D^X
    `~ASCII空白$以外の`制御文字$
    1. `control-character-reference$pE
    ◎ If the number is 0x0D, or a control that's not ASCII whitespace, then this is a control-character-reference parse error.\
    下の表の 1 列目に現れる

    `文字~参照~code$V ~SET 現れた行の 2 列目の数 ◎ If the number is one of the numbers in the first column of the following table, then find the row with that number in the first column, and set the character reference code to the number in the second column of that row.

    数◎ Number ~cp◎ Code point
    `80^X`20AC^XEURO SIGN (€)
    `82^X`201A^XSINGLE LOW-9 QUOTATION MARK (‚)
    `83^X`0192^XLATIN SMALL LETTER F WITH HOOK (ƒ)
    `84^X`201E^XDOUBLE LOW-9 QUOTATION MARK („)
    `85^X`2026^XHORIZONTAL ELLIPSIS (…)
    `86^X`2020^XDAGGER (†)
    `87^X`2021^XDOUBLE DAGGER (‡)
    `88^X`02C6^XMODIFIER LETTER CIRCUMFLEX ACCENT (ˆ)
    `89^X`2030^XPER MILLE SIGN (‰)
    `8A^X`0160^XLATIN CAPITAL LETTER S WITH CARON (Š)
    `8B^X`2039^XSINGLE LEFT-POINTING ANGLE QUOTATION MARK (‹)
    `8C^X`0152^XLATIN CAPITAL LIGATURE OE (Œ)
    `8E^X`017D^XLATIN CAPITAL LETTER Z WITH CARON (Ž)
    `91^X`2018^XLEFT SINGLE QUOTATION MARK (‘)
    `92^X`2019^XRIGHT SINGLE QUOTATION MARK (’)
    `93^X`201C^XLEFT DOUBLE QUOTATION MARK (“)
    `94^X`201D^XRIGHT DOUBLE QUOTATION MARK (”)
    `95^X`2022^XBULLET (•)
    `96^X`2013^XEN DASH (–)
    `97^X`2014^XEM DASH (—)
    `98^X`02DC^XSMALL TILDE (˜)
    `99^X`2122^XTRADE MARK SIGN (™)
    `9A^X`0161^XLATIN SMALL LETTER S WITH CARON (š)
    `9B^X`203A^XSINGLE RIGHT-POINTING ANGLE QUOTATION MARK (›)
    `9C^X`0153^XLATIN SMALL LIGATURE OE (œ)
    `9E^X`017E^XLATIN SMALL LETTER Z WITH CARON (ž)
    `9F^X`0178^XLATIN CAPITAL LETTER Y WITH DIAERESIS (Ÿ)
  2. `一時~buffer$V ~SET ~cp( `文字~参照~code$V ) ◎ Set the temporary buffer to the empty string. Append a code point equal to the character reference code to the temporary buffer.\
  3. `文字~参照として消費される~cpを一掃する$ ◎ Flush code points consumed as a character reference.\
  4. `戻先~状態$V に`切替える$ ◎ Switch to the return state.

12.2.6. 文書~木の構築

木~構築~段階には、`~token化~段階$から~token列が入力される。 木~構築~段階は、構文解析器の作成-時に`文書$に結付けられる。 この段階の “出力” は、当の文書[ を動的に改変する / の~DOM木を拡張する ]ことからなる。 ◎ The input to the tree construction stage is a sequence of tokens from the tokenization stage. The tree construction stage is associated with a DOM Document object when a parser is created. The "output" of this stage consists of dynamically modifying or extending that document's DOM tree.

この仕様は、対話的~UAが いつ[ 利用者に可用になるよう`文書$を具現化する必要があるか / 利用者~入力を受容し始める必要がある ]かは,定義しない。 ◎ This specification does not define when an interactive user agent has to render the Document so that it is available to the user, or when it has to begin accepting user input.


この節を通して, 現token は、~tokenizerから発され,木~構築~段階が現在~処理している~tokenを指すとする。

~UAは、~tokenizerから~tokenが発される度に, `木~構築~配送器@ と称される次の手続きに従わ~MUST:

◎ As each token is emitted from the tokenizer, the user agent must follow the appropriate steps from the following list, known as the tree construction dispatcher:
  1. %~node ~LET `現在の調整-済み~node$
  2. ~IF[ 次のいずれかが満たされる ]… ◎ ↓

    • `~open要素~stack$は空である ◎ If the stack of open elements is empty
    • %~node は`~HTML名前空間$に属する要素である ◎ If the adjusted current node is an element in the HTML namespace
    • [ %~node は`~MathML~text統合~地点$である ]~AND[ 現tokenは開始tag~tokenである ]~AND[ 現tokenの~tag名 ~NIN { `mglyph^l, `malignmark^l } ] ◎ If the adjusted current node is a MathML text integration point and the token is a start tag whose tag name is neither "mglyph" nor "malignmark"
    • [ %~node は`~MathML~text統合~地点$である ]~AND[ 現tokenは文字~tokenである ] ◎ If the adjusted current node is a MathML text integration point and the token is a character token
    • [ %~node は~MathML `annotation-xml$e 要素である ]~AND[ 現tokenは開始tag~tokenである ]~AND[ 現tokenの~tag名 ~EQ `svg^l ] ◎ If the adjusted current node is a MathML annotation-xml element and the token is a start tag whose tag name is "svg"
    • [ %~node は`~HTML統合~地点$である ]~AND[ 現tokenは開始tag~tokenである ] ◎ If the adjusted current node is an HTML integration point and the token is a start tag
    • [ %~node は`~HTML統合~地点$である ]~AND[ 現tokenは文字~tokenである ] ◎ If the adjusted current node is an HTML integration point and the token is a character token
    • 現tokenは~eof~tokenである ◎ If the token is an end-of-file token

    …ならば ⇒ [ ~HTML内容~内の~token 用の,現在の`挿入~mode$に対応する節 ]に与える規則に則って、現tokenを処理する ◎ Process the token according to the rules given in the section corresponding to the current insertion mode in HTML content.

  3. ~ELSE ⇒ `外来~内容~内$md節に与える規則に則って、現tokenを処理する ◎ Otherwise ◎ Process the token according to the rules given in the section for parsing tokens in foreign content.

`次n~token@ とは、`木~構築~配送器$により処理されようとしている~tokenを指す(その~tokenは後続して,単に無視される場合もある)。 ◎ The next token is the token that is about to be processed by the tree construction dispatcher (even if the token is subsequently just ignored).

【 この訳では、この用語は利用せず, `次n~LF文字~tokenは無視するようにしておく$ 手続きに置き換えている。 その用途にしか用いられていないので。 】

次に該当する~MathML要素~nodeは、 `~MathML~text統合~地点@ とされる ⇒ `mi$e, `mo$e, `mn$e, `ms$e, `mtext$e ◎ A node is a MathML text integration point if it is one of the following elements: • A MathML mi element • A MathML mo element • A MathML mn element • A MathML ms element • A MathML mtext element

次のいずれかに該当する~nodeは、 `~HTML統合~地点@ とされる: ◎ A node is an HTML integration point if it is one of the following elements:

  • ~MathML `annotation-xml$e 要素のうち,それを作成させた開始tag~tokenが 次を満たす属性を有していたもの ⇒ [ 名前 ~EQ `encoding^l ]~AND[ 値 ~IN`大小無視$sub { `text/html^l, `application/xhtml+xml^l } ] ◎ A MathML annotation-xml element whose start tag token had an attribute with the name "encoding" whose value was an ASCII case-insensitive match for the string "text/html" ◎ A MathML annotation-xml element whose start tag token had an attribute with the name "encoding" whose value was an ASCII case-insensitive match for the string "application/xhtml+xml"
  • ~SVG `foreignObject$e, `desc$e, `title$e 要素 ◎ An SVG foreignObject element An SVG desc element An SVG title element

注記: ~nodeが[ `~HTML素片の構文解析~algo$に渡された `文脈~要素$V ]である場合、その要素~用の開始tag~tokenは,その~algo内で作成された “模造” ~tokenである。 ◎ If the node in question is the context element passed to the HTML fragment parsing algorithm, then the start tag token for that element is the "fake" token created during by that HTML fragment parsing algorithm.


注記: 下に言及される~tag名には、この仕様に適合する~tag名にならないものもある — その多くは、旧来の内容を取扱うために含められている。 それらは依然として~algoの一部を形成し、適合性を主張する実装には,実装することが要求される。 ◎ Not all of the tag names mentioned below are conformant tag names in this specification; many are included to handle legacy content. They still form part of the algorithm that implementations are required to implement to claim conformance.

注記: 以下に述べる~algoは、生成される~DOM木の深さにも, [ ~tag名, 属性~名, 属性~値, `Text$I ~node, 等々 ]の長さにも制限-は設けない。 実装者には,恣意的な制限-は避けることが奨励されるが、 実施上の懸念 により,~UAは入子~の深さに拘束を課すよう強いられるであろうことも認識されている。 ◎ The algorithm described below places no limit on the depth of the DOM tree generated, or on the length of tag names, attribute names, attribute values, Text nodes, etc. While implementers are encouraged to avoid arbitrary limits, it is recognized that practical concerns will likely force user agents to impose nesting depth constraints.

12.2.6.1. ~nodeの作成-法と挿入-法

%構文解析器 は、ある~tokenを処理している間, `親を違える@ ( foster parenting )のを 可能化-/不能化- することもある。 これは、次の~algoに影響する。 ◎ While the parser is processing a token, it can enable or disable foster parenting. This affects the following algorithm.

`適切な~node挿入-先@ は、所与の ( `上書き~target^i %~target ) に対し,次の手続きを走らせた結果で与えられる[ ある要素~内の位置 ]である: ◎ The appropriate place for inserting a node, optionally using a particular override target, is the position in an element returned by running the following steps: • If there was an override target specified, then let target be the override target. • Otherwise, let target be the current node.

  1. %調整-済み挿入-先 ~LET %~target 内の末尾 ◎ ↓↓
  2. ~IF[ `親を違える$のは可能化されている ]~AND[ %~target は[ `table$e / `tbody$e / `tfoot$e / `thead$e / `tr$e ]要素である ⇒ %調整-済み挿入-先 ~SET 次の下位手続きを走らせた結果: ◎ Determine the adjusted insertion location using the first matching steps from the following list: ◎ If foster parenting is enabled and target is a table, tbody, tfoot, thead, or tr element

    注記: 親を違えるのは、ある内容が~table内に誤入子にされたときに起こる。 ◎ Foster parenting happens when content is misnested in tables. ◎ Run these substeps:

    1. %~stack ~LET `~open要素~stack$ ◎ ↓
    2. %最後の~template ~LET %~stack 内に `template$e 要素が[ 在れば それらのうち最後のもの / 無ければ ε ] ◎ Let last template be the last template element in the stack of open elements, if any.
    3. %最後の~table ~LET %~stack 内に `table$e 要素が[ 在れば それらのうち最後のもの / 無ければ ε ] ◎ Let last table be the last table element in the stack of open elements, if any.
    4. ~IF[ %最後の~template ~NEQ ε ] ⇒ ~IF[[ %最後の~table ~EQ ε ]~OR[[ %最後の~table ~NEQ ε ]~AND[ %最後の~template は %~stack 内で %最後の~table より後にある(より近過去に追加された) ]]] ⇒ ~RET %最後の~template の`~template内容$内の末尾 ◎ If there is a last template and either there is no last table, or there is one, but last template is lower (more recently added) than last table in the stack of open elements, then: let adjusted insertion location be inside last template's template contents, after its last child (if any), and abort these substeps.
    5. ~IF[ %最後の~table ~EQ ε (`素片~事例$) ] ⇒ ~RET %~stack の先頭の要素( `html$e 要素)内の末尾 ◎ If there is no last table, then let adjusted insertion location be inside the first element in the stack of open elements (the html element), after its last child (if any), and abort these substeps. (fragment case)
    6. ~IF[ %最後の~table の親~node %親 はある ] ⇒ ~RET %親 の内側の, %最後の~table の直前 ◎ If last table has a parent node, then let adjusted insertion location be inside last table's parent node, immediately before last table, and abort these substeps.
    7. ~RET[ %~stack 内で, %最後の~table の直前にある要素 ]内の末尾 ◎ Let previous element be the element immediately above last table in the stack of open elements. ◎ Let adjusted insertion location be inside previous element, after its last child (if any).

    注記: この下位手続きが孕まれているわけは、要素 — この事例では特に `table$e 要素 — が構文解析器により挿入された後でも,~scriptにより~DOM内のどこかへ移動されたり, まるごと~DOMから除去されることもあり得るためである。 ◎ These steps are involved in part because it's possible for elements, the table element in this case in particular, to have been moved by a script around in the DOM, or indeed removed from the DOM entirely, after the element was inserted by the parser.

  3. ~IF[ %調整-済み挿入-先 が所属する~nodeは `template$e 要素である ] ⇒ ~RET `template$e 要素の`~template内容$内の末尾 ◎ Otherwise • Let adjusted insertion location be inside target, after its last child (if any). ◎ If the adjusted insertion location is inside a template element, let it instead be inside the template element's template contents, after its last child (if any).
  4. ~RET %調整-済み挿入-先 ◎ Return the adjusted insertion location.

以下の手続きにて `~tokenから要素を作成する@ ときは、所与の ( %~token, %名前空間, %意図される親 ) に対し,次を走らせ~MUST: ◎ When the steps below require the UA to create an element for a token in a particular given namespace and with a particular intended parent, the UA must run the following steps:

  1. %文書 ~LET %意図される親 の`~node文書$ ◎ Let document be intended parent's node document.
  2. %局所~名 ~LET %~token の~tag名 ◎ Let local name be the tag name of the token.
  3. %is ~LET %~token 内に `is$a 属性が[ 在れば その値 / 無ければ ~NULL ] ◎ Let is be the value of the "is" attribute in the given token, if such an attribute exists, or null otherwise.
  4. %定義 ~LET `~custom要素~定義を検索する$( %文書, %所与の名前空間, %局所~名, %is ) ◎ Let definition be the result of looking up a custom element definition given document, given namespace, local name, and is.
  5. %~scriptを実行する ~LET ~F
  6. ~IF [ %定義 ~NEQ ~NULL ]~AND[ %構文解析器 は `~HTML素片~用$でない ] ⇒ %~scriptを実行する ~SET ~T ◎ If definition is non-null and the parser was not originally created for the HTML fragment parsing algorithm, then let will execute script be true. Otherwise, let it be false.
  7. ~IF[ %~scriptを実行する ~EQ ~T ]: ◎ If will execute script is true, then:

    1. %文書 の`動的~markup挿入-時には投出する~counter$ ~INCBY 1 ◎ Increment document's throw-on-dynamic-markup-insertion counter.
    2. ~IF[ `~JS実行~文脈~stack$は空である ] ⇒ `小task~checkpointを遂行する$ ◎ If the JavaScript execution context stack is empty, then perform a microtask checkpoint.
    3. `~custom要素~反応~stack$に新たな`要素~queue$を~pushする ◎ Push a new element queue onto the custom element reactions stack.
  8. %同期~custom要素~flag ~LET %~scriptを実行する に応じて[ ~T ならば `同期~custom要素^i / ~F ならば ε ] ◎ ↓
  9. %要素 ~LET `要素を作成する$( %文書, %局所~名, %名前空間, ~NULL, %is, %同期~custom要素~flag ) ◎ Let element be the result of creating an element given document, localName, given namespace, null, and is. If will execute script is true, set the synchronous custom elements flag; otherwise, leave it unset.

    注記: これは、[ %~scriptを実行する ~EQ ~T ]ならば`~custom要素~構築子$を走らすことになる。 しかしながら,`動的~markup挿入-時には投出する~counter$は増やしたので、これにより,[ ~tokenizerの中に新たな文字が挿入される文書が吹飛ばされる ]ことはない。 ◎ This will cause custom element constructors to run, if will execute script is true. However, since we incremented the throw-on-dynamic-markup-insertion counter, this cannot cause new characters to be inserted into the tokenizer, or the document to be blown away.

  10. %~token 内の ~EACH( %属性 ) に対し ⇒ %要素 に`属性を付加する$( %属性 ) ◎ Append each attribute in the given token to element.

    注記: これは、 `attributeChangedCallback^c 用の`~custom要素~callback反応を~enqueueする$こともある — それは(次~段にて)即時に走るかもしれない。 ◎ This can enqueue a custom element callback reaction for the attributeChangedCallback, which might run immediately (in the next step).

    注記: `is$a 属性は,`~custom化された組込みの要素$の`作成$elemを統治するが、関連する`~custom要素~構築子$を実行する間は,まだ無い — それは、この段にて,他の属性とともに付加されるので。 ◎ Even though the is attribute governs the creation of a customized built-in element, it is not present during the execution of the relevant custom element constructor; it is appended in this step, along with all other attributes.

  11. ~IF[ %~scriptを実行する ~EQ ~T ]: ◎ If will execute script is true, then:

    1. %~queue ~LET `~custom要素~反応~stack$から`現在の要素~queue$を~popする (これは、上で~pushしたのと同じ`要素~queue$になる。) ◎ Let queue be the result of popping the current element queue from the custom element reactions stack. (This will be the same element queue as was pushed above.)
    2. `~custom要素~反応を呼出す$( %~queue ) ◎ Invoke custom element reactions in queue.
    3. %文書 の`動的~markup挿入-時には投出する~counter$ ~DECBY 1 ◎ Decrement document's throw-on-dynamic-markup-insertion counter.
  12. ~IF[ %要素 は`~XMLNS名前空間$に属する `xmlns^a 属性を有していて,その値 ~EQ 要素の名前空間 ] ⇒ `~perror$ ◎ If element has an xmlns attribute in the XMLNS namespace whose value is not exactly the same as the element's namespace, that is a parse error.\
  13. ~IF[ %要素 は`~XMLNS名前空間$に属する `xmlns:xlink^a 属性を有していて,その値 ~NEQ `~XLink名前空間$ ] ⇒ `~perror$ ◎ Similarly, if element has an xmlns:xlink attribute in the XMLNS namespace whose value is not the XLink Namespace, that is a parse error.
  14. ~IF[ %要素 は`再設定-可能な要素$である ] ⇒ %要素 を`再設定する~algo$を呼出す (これは、要素の属性に基いて,要素の`値$と`~checkedness$を初期化する。) ◎ If element is a resettable element, invoke its reset algorithm. (This initializes the element's value and checkedness based on the element's attributes.)
  15. %form ~LET `~form要素~pointer$ ◎ ↓
  16. ~IF[ 次がすべて満たされる ]…:

    • %要素 は`~formに所有され得る要素$である
    • %form ~NEQ ~NULL
    • `~open要素~stack$内に `template$e 要素はない
    • [ %要素 は`~listされる要素$でない ]~OR[ %要素 は `form$a 属性を有さない ]
    • ( %form, %意図される親 ) は同じ`木$内にある

    …ならば:

    1. %要素 の`~form所有者$ ~SET %form
    2. %要素 の`構文解析器挿入~flag$ ~SET ~ON
    ◎ If element is a form-associated element, the form element pointer is not null, there is no template element on the stack of open elements, element is either not listed or doesn't have a form attribute, and the intended parent is in the same tree as the element pointed to by the form element pointer, then associate element with the form element pointed to by the form element pointer and set element's parser inserted flag.
  17. ~RET %要素 ◎ Return element.

以下の手続きにて `要素を挿入する@ ときは、所与の ( 開始tag~token %~token, 名前空間 %名前空間 (省略時は `~HTML名前空間$)) に対し,次の手続きを走らせ~MUST: ◎ When the steps below require the user agent to insert a foreign element for a token in a given namespace, the user agent must run these steps:

【 この訳では、原文による 2 つの手続き[ `外来の要素を挿入する@, `~HTML要素を挿入する@ ]を この手続きに集約して,命名を簡素化する(これらの手続きは、順に,この手続きにて %名前空間 を[ 明示的に与えた場合, 省略した場合 ]の挙動に一致する)。 】

  1. %調整-済み挿入-先 ~LET `適切な~node挿入-先$( `現在の~node$ ) ◎ Let the adjusted insertion location be the appropriate place for inserting a node.
  2. %要素 ~LET `~tokenから要素を作成する$( %~token, %名前空間, %調整-済み挿入-先 が所属する要素 ) ◎ Let element be the result of creating an element for the token in the given namespace, with the intended parent being the element in which the adjusted insertion location finds itself.
  3. ~IF[ %要素 を %調整-済み挿入-先 に挿入-可能である 【下の注記を見よ】 ]: ◎ If it is possible to insert element at the adjusted insertion location, then:

    1. `~custom要素~反応~stack$に新たな`要素~queue$を~pushする ◎ Push a new element queue onto the custom element reactions stack.
    2. %要素 を %調整-済み挿入-先 に挿入する ◎ Insert element at the adjusted insertion location.
    3. %~queue ~LET `~custom要素~反応~stack$から`要素~queue$を~popする ◎ Pop the element queue from the custom element reactions stack, and\
    4. `~custom要素~反応を呼出す$( %~queue ) ◎ invoke custom element reactions in that queue.

    注記: %調整-済み挿入-先 がそれ以上~要素を受容できない場合、 %要素 は弾き出される — 例えば、そこは すでに ある要素を子に有している`文書$内である場合。 【すなわち、挿入すると~DOM木に課される拘束を満たせなくなる場合。】 ◎ If the adjusted insertion location cannot accept more elements, e.g. because it's a Document that already has an element child, then element is dropped on the floor.

  4. `~open要素~stack$に %要素 を~pushする ◎ Push element onto the stack of open elements so that it is the new current node.
  5. ~RET %要素 ◎ Return element. ◎ ↑↑When the steps below require the user agent to insert an HTML element for a token, the user agent must insert a foreign element for the token, in the HTML namespace.

以下の手続きにて `~MathML属性たちを調整する@ ときは、所与の ( %~token ) に対し,次を走らす ⇒ %~token 内の ~EACH( %属性 ) に対し ⇒ ~IF[ %属性 の名前 ~EQ `definitionurl^l ] ⇒ %属性 の名前 ~SET `definitionURL^l ◎ When the steps below require the user agent to adjust MathML attributes for a token, then, if the token has an attribute named definitionurl, change its name to definitionURL (note the case difference).

以下の手続きにて `~SVG属性たちを調整する@ ときは、所与の ( %~token ) に対し,次を走らす ⇒ %~token 内の ~EACH( %属性 )に対し ⇒ ~IF[ %属性 の名前 ~IN { 次の表の 1 列目に挙げる名前 } ] ⇒ %属性 の名前 ~SET 同じ行の 2 列目に与えられる名前 (これは、名前に大文字を含むような~SVG属性の文字大小を修正する) ◎ When the steps below require the user agent to adjust SVG attributes for a token, then, for each attribute on the token whose attribute name is one of the ones in the first column of the following table, change the attribute's name to the name given in the corresponding cell in the second column. (This fixes the case of SVG attributes that are not all lowercase.)

~token上の属性~名◎ Attribute name on token 要素~上の属性~名◎ Attribute name on element
`attributename^c `attributeName^c
`attributetype^c `attributeType^c
`basefrequency^c `baseFrequency^c
`baseprofile^c `baseProfile^c
`calcmode^c `calcMode^c
`clippathunits^c `clipPathUnits^c
`diffuseconstant^c `diffuseConstant^c
`edgemode^c `edgeMode^c
`filterunits^c `filterUnits^c
`glyphref^c `glyphRef^c
`gradienttransform^c `gradientTransform^c
`gradientunits^c `gradientUnits^c
`kernelmatrix^c `kernelMatrix^c
`kernelunitlength^c `kernelUnitLength^c
`keypoints^c `keyPoints^c
`keysplines^c `keySplines^c
`keytimes^c `keyTimes^c
`lengthadjust^c `lengthAdjust^c
`limitingconeangle^c `limitingConeAngle^c
`markerheight^c `markerHeight^c
`markerunits^c `markerUnits^c
`markerwidth^c `markerWidth^c
`maskcontentunits^c `maskContentUnits^c
`maskunits^c `maskUnits^c
`numoctaves^c `numOctaves^c
`pathlength^c `pathLength^c
`patterncontentunits^c `patternContentUnits^c
`patterntransform^c `patternTransform^c
`patternunits^c `patternUnits^c
`pointsatx^c `pointsAtX^c
`pointsaty^c `pointsAtY^c
`pointsatz^c `pointsAtZ^c
`preservealpha^c `preserveAlpha^c
`preserveaspectratio^c `preserveAspectRatio^c
`primitiveunits^c `primitiveUnits^c
`refx^c `refX^c
`refy^c `refY^c
`repeatcount^c `repeatCount^c
`repeatdur^c `repeatDur^c
`requiredextensions^c `requiredExtensions^c
`requiredfeatures^c `requiredFeatures^c
`specularconstant^c `specularConstant^c
`specularexponent^c `specularExponent^c
`spreadmethod^c `spreadMethod^c
`startoffset^c `startOffset^c
`stddeviation^c `stdDeviation^c
`stitchtiles^c `stitchTiles^c
`surfacescale^c `surfaceScale^c
`systemlanguage^c `systemLanguage^c
`tablevalues^c `tableValues^c
`targetx^c `targetX^c
`targety^c `targetY^c
`textlength^c `textLength^c
`viewbox^c `viewBox^c
`viewtarget^c `viewTarget^c
`xchannelselector^c `xChannelSelector^c
`ychannelselector^c `yChannelSelector^c
`zoomandpan^c `zoomAndPan^c

以下の手続きにて `外来の属性たちを調整する@ ときは、所与の ( %~token ) に対し,次を走らす ⇒ %~token 上の ~EACH( %属性 ) に対し ⇒ ~IF[ %属性 は次の表のある行の 1 列目に与える文字列に合致する ] ⇒ %属性 ~SET 同じ行の ( 2, 3, 4 ) 列目に与える ( 接頭辞, 局所~名, 名前空間 ) を伴う名前空間~付きの属性

(これは、名前空間~付きの属性の利用 — 特に ~XML名前空間に属する `lang^a 属性 — を修正する。)

◎ When the steps below require the user agent to adjust foreign attributes for a token, then, if any of the attributes on the token match the strings given in the first column of the following table, let the attribute be a namespaced attribute, with the prefix being the string given in the corresponding cell in the second column, the local name being the string given in the corresponding cell in the third column, and the namespace being the namespace given in the corresponding cell in the fourth column. (This fixes the use of namespaced attributes, in particular lang attributes in the XML namespace.)
属性~名◎ Attribute name 接頭辞◎ Prefix 局所~名◎ Local name 名前空間◎ Namespace
`xlink:actuate^l `xlink^l `actuate^l `~XLink名前空間$
`xlink:arcrole^l `xlink^l `arcrole^l `~XLink名前空間$
`xlink:href^l `xlink^l `href^l `~XLink名前空間$
`xlink:role^l `xlink^l `role^l `~XLink名前空間$
`xlink:show^l `xlink^l `show^l `~XLink名前空間$
`xlink:title^l `xlink^l `title^l `~XLink名前空間$
`xlink:type^l `xlink^l `type^l `~XLink名前空間$
`xml:lang^l `xml^l `lang^l `~XML名前空間$
`xml:space^l `xml^l `space^l `~XML名前空間$
`xmlns^l (なし)◎ (none) `xmlns^l `~XMLNS名前空間$
`xmlns:xlink^l `xmlns^l `xlink^l `~XMLNS名前空間$

以下の手続きにて~tokenを処理している間に, `文字を挿入する@ ときは、所与の ( %文字 ) に対し,次を走らせ~MUST: ◎ When the steps below require the user agent to insert a character while processing a token, the user agent must run the following steps:

  1. %~data ~LET %文字 ◎ Let data be the characters passed to the algorithm, or, if no characters were explicitly specified, the character of the character token being processed.
  2. %調整-済み挿入-先 ~LET `適切な~node挿入-先$( `現在の~node$ ) ◎ Let the adjusted insertion location be the appropriate place for inserting a node.
  3. ~IF[ %調整-済み挿入-先 が所属する~nodeは`文書$である ] ⇒ ~RET ◎ If the adjusted insertion location is in a Document node, then return.

    注記: ~DOMの~~制約により、 `Text$I ~nodeは,`文書$の子になれないので弾き出される。 ◎ The DOM will not let Document nodes have Text node children, so they are dropped on the floor.

  4. ~IF[ %調整-済み挿入-先 の直前に `Text$I ~nodeはある ] ⇒ その~nodeの~dataに %~data を付加する ◎ If there is a Text node immediately before the adjusted insertion location, then append data to that Text node's data.
  5. ~ELSE ⇒ 次のようにされた新たな `Text$I ~nodeを %調整-済み挿入-先 に挿入する

    • %text の~data ~SET %~data
    • %text の`~node文書$ ~SET %調整-済み挿入-先 が所属する要素の`~node文書$
    ◎ Otherwise, create a new Text node whose data is data and whose node document is the same as that of the element in which the adjusted insertion location finds itself, and insert the newly created node at the adjusted insertion location.

構文解析器への見本~入力と対応する `Text$I ~nodeを,以下にいくつか挙げる — ここでは、~UAは~scriptを実行すると見做す: ◎ Here are some sample inputs to the parser and the corresponding number of Text nodes that they result in, assuming a user agent that executes scripts.

入力◎ Input `Text$I ~nodeの個数◎ Number of Text nodes
A<script>
var %script = document.getElementsByTagName('script')[0];
document.body.removeChild(%script);
</script>B
文書~内に, `AB^l を包含している 1 個の `Text$I ~node。 ◎ One Text node in the document, containing "AB".
A<script>
var %text = document.createTextNode('B');
document.body.appendChild(%text);
</script>C
3 個の `Text$I ~node — 順に、 `script^e の前に `A^l, `script^e の内容, `script^e の後に `BC^l (構文解析器は、~scriptが作成した `Text$I ~nodeを付加する)。 ◎ Three Text nodes; "A" before the script, the script's contents, and "BC" after the script (the parser appends to the Text node created by the script).
A<script>
var %text = document.getElementsByTagName('script')[0].firstChild;
%text.data = 'B';
document.body.appendChild(%text);
</script>C
文書~内に,隣接する 2 個の, 順に `A^l, `BC^l を包含している `Text$I ~node。 ◎ Two adjacent Text nodes in the document, containing "A" and "BC".
A<table>B<tr>C</tr>D</table>
`table^e の前に, `ABCD^l を包含している 1 個の `Text$I ~node (これは、`親を違える$ことにより生じる)。 ◎ One Text node before the table, containing "ABCD". (This is caused by foster parenting.)
A<table><tr> B</tr> C</table>
`table^e の前に, `A B C^l ( A-space-B-space-C )を包含している 1 個の `Text$I ~node(これは、`親を違える$ことにより生じる)。 ◎ One Text node before the table, containing "A B C" (A-space-B-space-C). (This is caused by foster parenting.)
A<table><tr> B</tr> </em>C</table>
`table^e の前に, `A BC^l ( A-space-B-C )を包含している 1 個の `Text$I ~node。 `table^e の内側に, 1 個の~space文字を包含している 1 個の `Text$I ~node( `tbody$e の子として)。 (~space文字は、文字~tokenでない~token 【ここでは `</em>^l 】 により~spaceでない文字から分離される場合には,`親を違える$ことにより影響されない — その後,分離している~tokenが無視されることになる場合でも。) ◎ One Text node before the table, containing "A BC" (A-space-B-C), and one Text node inside the table (as a child of a tbody) with a single space character. (Space characters separated from non-space characters by non-character tokens are not affected by foster parenting, even if those other tokens then get ignored.)

以下の手続きにて~comment~tokenを処理している間に `~commentを挿入する@ ときは、所与の ( ~comment~token %~comment, 挿入~位置 %位置 (省略時は ε ) ) に対し,次を走らせ~MUST:

  1. ~IF[ %位置 ~EQ ε ] ⇒ %位置 ~SET `適切な~node挿入-先$( `現在の~node$ )
  2. 次のようにされた新たな `Comment$I ~nodeを %位置 に挿入する ⇒# `data^m 属性 ~SET %~comment の~data, `~node文書$ ~SET %位置 が所属する~nodeの`~node文書$
◎ When the steps below require the user agent to insert a comment while processing a comment token, optionally with an explicitly insertion position position, the user agent must run the following steps: • Let data be the data given in the comment token being processed. • If position was specified, then let the adjusted insertion location be position. Otherwise, let adjusted insertion location be the appropriate place for inserting a node. • Create a Comment node whose data attribute is set to data and whose 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.

~UAは、文書の構文解析による変更に対しては,~DOM変異~eventは発火しては~MUST_NOT。 これには、[ `document.write()$m / `document.writeln()$m ]~callを利用して挿入される内容の構文解析も含まれる。 `UIEVENTS$r ◎ DOM mutation events must not fire for changes caused by the UA parsing the document. This includes the parsing of any content inserted using document.write() and document.writeln() calls. [UIEVENTS]

しかしながら,`変異~observer$は、発火する — WHATWG DOM Standard により要求されるように。 ◎ However, mutation observers do fire, as required by the WHATWG DOM Standard.

12.2.6.2. ~textのみを包含する要素の構文解析

[ `生~text要素の汎用~構文解析~algo@ / `~RCDATA要素の汎用~構文解析~algo@ ]は、所与の ( 開始tag~token %~token ) に対し,次を走らす: ◎ The generic raw text element parsing algorithm and the generic RCDATA element parsing algorithm consist of the following steps. These algorithms are always invoked in response to a start tag token.

  1. `要素を挿入する$( %~token ) ◎ Insert an HTML element for the token.
  2. %次n状態 ~LET [ `生~text要素の汎用~構文解析~algo$に対しては `~RAWTEXT$st / `~RCDATA要素の汎用~構文解析~algo$に対しては `~RCDATA$st ] ◎ If the algorithm that was invoked is the generic raw text element parsing algorithm, switch the tokenizer to the RAWTEXT state; otherwise the algorithm invoked was the generic RCDATA element parsing algorithm,\
  3. ~tokenizerを %次n状態 に`切替える$ ◎ switch the tokenizer to the RCDATA state.
  4. `元の挿入~mode$V ~SET 現在の`挿入~mode$ ◎ Let the original insertion mode be the current insertion mode.
  5. `挿入~mode$ ~SET `~text$md ◎ Then, switch the insertion mode to "text".

12.2.6.3. 暗黙の終了tagを有する要素を閉じるとき

以下の手続きにて `暗黙の終了tagたちを生成する@ ときは、所与の ( 要素~型 %除外-~node型 (省略時は ε ) ) に対し,次を走らせ~MUST ⇒ ~WHILE[ `現在の~node$の要素~型は[ `dd$e, `dt$e, `li$e, `optgroup$e, `option$e, `p$e, `rb$e, `rp$e, `rt$e, `rtc$e ]のいずれかであって %除外-~node型 ではない ] ⇒ `~open要素~stack$から~popする ◎ When the steps below require the UA to generate implied end tags, then, while the current node is a dd element, a dt element, an li element, an optgroup element, an option element, a p element, an rb element, an rp element, an rt element, or an rtc element, the UA must pop the current node off the stack of open elements. ◎ If a step requires the UA to generate implied end tags but lists an element to exclude from the process, then the UA must perform the above steps as if that element was not in the above list.

以下の手続きにて `暗黙の終了tagすべてを生成する@ ときは、次を走らせ~MUST ⇒ ~WHILE[ `現在の~node$の要素~型は[ `caption$e, `colgroup$e, `dd$e, `dt$e, `li$e, `optgroup$e, `option$e, `p$e, `rb$e, `rp$e, `rt$e, `rtc$e, `tbody$e, `td$e, `tfoot$e, `th$e, `thead$e, `tr$e ]のいずれかである ] ⇒ `~open要素~stack$から~popする ◎ When the steps below require the UA to generate all implied end tags thoroughly, then, while the current node is a caption element, a colgroup element, a dd element, a dt element, an li element, an optgroup element, an option element, a p element, an rb element, an rp element, an rt element, an rtc element, a tbody element, a td element, a tfoot element, a th element, a thead element, or a tr element, the UA must pop the current node off the stack of open elements.

12.2.6.X. 要素を閉じるとき

【 次に与える手続きは、以下を簡潔に記述するために,この訳に導入している。 これは、~DOMにおいて,当の要素とその子孫が成す木を “閉じる” ことに相当する。 】

所与の %条件 を満たす要素が `出るまで~open要素~stackから~popする@ ときは、次を走らす — ここで、 %条件 として:

  • 単に 1 個以上の要素~型が与えられた場合(例: “`div^e 要素が出るまで…”)、 %条件 は “それらのうち, いずれかの要素~型である” と解釈する。
  • 単にある要素~instanceが与えられた場合、 %条件 は “その要素と同じ~instance” と解釈する。
  1. ~Assert: `~open要素~stack$内には %条件 を満たす要素はある
  2. ~WHILE 無条件:

    1. %要素 ~LET `~open要素~stack$から~popした結果
    2. ~IF[ %要素 は %条件 を満たす ] ⇒ ~BREAK

12.2.6.4. ~HTML内容~内の~tokenを構文解析するための規則

12.2.6.4.1. `初期^md

[ `挿入~mode$ ~EQ `初期$md ]の下では、現tokenを以下に従って取扱わ~MUST: ◎ When the user agent is to apply the rules for the "initial" insertion mode, the user agent must handle the token as follows:

文字~token { `~ASCII空白$ } ◎ 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
  1. 現tokenは無視する
◎ Ignore the token.
~comment~token ◎ A comment token
  1. `~commentを挿入する$( 現token, `文書$内の末尾 )
◎ Insert a comment as the last child of the Document object.
~DOCTYPE~token ◎ A DOCTYPE token
  1. %名前 ~LET 現~token(すなわち,現在の~DOCTYPE~token)の名前 ◎ ↓
  2. %~publicID ~LET 現~tokenの~publicID ◎ ↓
  3. %~systemID ~LET 現~tokenの~systemID ◎ ↓
  4. ~IF[ %名前 ~NEQ `html^l ]~OR[ %~publicID ~NEQ ε ]~OR[ %~systemID ~NIN { ε, `about:legacy-compat^l } ] ⇒ `~perror$ ◎ If the DOCTYPE token's name is not a case-sensitive match for the string "html", or the token's public identifier is not missing, or the token's system identifier is neither missing nor a case-sensitive match for the string "about:legacy-compat", then there is a parse error.
  5. %doctype ~LET 次のように初期化された,新たな `DocumentType$I ~node:

    • `name^m 属性 ~SET [ %名前 ~NEQ ε ならば %名前 / ~ELSE_ 空~文字列 ]
    • `publicId^m 属性 ~SET [ %~publicID ~NEQ ε ならば %~publicID / ~ELSE_ 空~文字列 ]
    • `systemId^m 属性 ~SET [ %~systemID ~NEQ ε ならば %~systemID / ~ELSE_ 空~文字列 ]
    • `DocumentType$I ~objに特有の他の属性は[ ~NULL, 空~list ]のうち適切な方に設定する
    ◎ Append a DocumentType node to the Document node, with the name attribute set to the name given in the DOCTYPE token, or the empty string if the name was missing; the publicId attribute set to the public identifier given in the DOCTYPE token, or the empty string if the public identifier was missing; the systemId attribute set to the system identifier given in the DOCTYPE token, or the empty string if the system identifier was missing; and the other attributes specific to DocumentType objects set to null and empty lists as appropriate.\
  6. `文書$に %doctype を付加する ◎ ↑\
  7. `文書$に %doctype を結付けて, `文書$の `doctype$m 属性の値が %doctype を返すようにする ◎ Associate the DocumentType node with the Document object so that it is returned as the value of the doctype attribute of the Document object.
  8. ~IF[ `文書$は`~iframe-srcdoc文書$でない ]:

    1. ~IF[ 現~tokenは、次に挙げるいずれかの条件を満たす ]…:

      • `過去互換強制~flag$ ~EQ ~ON
      • %名前 ~NEQ `html^l
      • ( %~publicID, %~systemID ) は ある “込み入った条件†” を満たす

      …ならば ⇒ `文書$の`~mode$doc ~SET `quirks^l

      ◎ Then, if the document is not an iframe srcdoc document, and the DOCTYPE token matches one of the conditions in the following list, then set the Document to quirks mode: • The force-quirks flag is set to on. • The name is set to anything other than "html" (compared case-sensitively). • The public identifier is set to: "-//W3O//DTD W3 HTML Strict 3.0//EN//" • The public identifier is set to: "-/W3C/DTD HTML 4.0 Transitional/EN" • The public identifier is set to: "HTML" • The system identifier is set to: "http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd" • The public identifier starts with: "+//Silmaril//dtd html Pro v0r11 19970101//" • The public identifier starts with: "-//AS//DTD HTML 3.0 asWedit + extensions//" • The public identifier starts with: "-//AdvaSoft Ltd//DTD HTML 3.0 asWedit + extensions//" • The public identifier starts with: "-//IETF//DTD HTML 2.0 Level 1//" • The public identifier starts with: "-//IETF//DTD HTML 2.0 Level 2//" • The public identifier starts with: "-//IETF//DTD HTML 2.0 Strict Level 1//" • The public identifier starts with: "-//IETF//DTD HTML 2.0 Strict Level 2//" • The public identifier starts with: "-//IETF//DTD HTML 2.0 Strict//" • The public identifier starts with: "-//IETF//DTD HTML 2.0//" • The public identifier starts with: "-//IETF//DTD HTML 2.1E//" • The public identifier starts with: "-//IETF//DTD HTML 3.0//" • The public identifier starts with: "-//IETF//DTD HTML 3.2 Final//" • The public identifier starts with: "-//IETF//DTD HTML 3.2//" • The public identifier starts with: "-//IETF//DTD HTML 3//" • The public identifier starts with: "-//IETF//DTD HTML Level 0//" • The public identifier starts with: "-//IETF//DTD HTML Level 1//" • The public identifier starts with: "-//IETF//DTD HTML Level 2//" • The public identifier starts with: "-//IETF//DTD HTML Level 3//" • The public identifier starts with: "-//IETF//DTD HTML Strict Level 0//" • The public identifier starts with: "-//IETF//DTD HTML Strict Level 1//" • The public identifier starts with: "-//IETF//DTD HTML Strict Level 2//" • The public identifier starts with: "-//IETF//DTD HTML Strict Level 3//" • The public identifier starts with: "-//IETF//DTD HTML Strict//" • The public identifier starts with: "-//IETF//DTD HTML//" • The public identifier starts with: "-//Metrius//DTD Metrius Presentational//" • The public identifier starts with: "-//Microsoft//DTD Internet Explorer 2.0 HTML Strict//" • The public identifier starts with: "-//Microsoft//DTD Internet Explorer 2.0 HTML//" • The public identifier starts with: "-//Microsoft//DTD Internet Explorer 2.0 Tables//" • The public identifier starts with: "-//Microsoft//DTD Internet Explorer 3.0 HTML Strict//" • The public identifier starts with: "-//Microsoft//DTD Internet Explorer 3.0 HTML//" • The public identifier starts with: "-//Microsoft//DTD Internet Explorer 3.0 Tables//" • The public identifier starts with: "-//Netscape Comm. Corp.//DTD HTML//" • The public identifier starts with: "-//Netscape Comm. Corp.//DTD Strict HTML//" • The public identifier starts with: "-//O'Reilly and Associates//DTD HTML 2.0//" • The public identifier starts with: "-//O'Reilly and Associates//DTD HTML Extended 1.0//" • The public identifier starts with: "-//O'Reilly and Associates//DTD HTML Extended Relaxed 1.0//" • The public identifier starts with: "-//SQ//DTD HTML 2.0 HoTMetaL + extensions//" • The public identifier starts with: "-//SoftQuad Software//DTD HoTMetaL PRO 6.0::19990601::extensions to HTML 4.0//" • The public identifier starts with: "-//SoftQuad//DTD HoTMetaL PRO 4.0::19971010::extensions to HTML 4.0//" • The public identifier starts with: "-//Spyglass//DTD HTML 2.0 Extended//" • The public identifier starts with: "-//Sun Microsystems Corp.//DTD HotJava HTML//" • The public identifier starts with: "-//Sun Microsystems Corp.//DTD HotJava Strict HTML//" • The public identifier starts with: "-//W3C//DTD HTML 3 1995-03-24//" • The public identifier starts with: "-//W3C//DTD HTML 3.2 Draft//" • The public identifier starts with: "-//W3C//DTD HTML 3.2 Final//" • The public identifier starts with: "-//W3C//DTD HTML 3.2//" • The public identifier starts with: "-//W3C//DTD HTML 3.2S Draft//" • The public identifier starts with: "-//W3C//DTD HTML 4.0 Frameset//" • The public identifier starts with: "-//W3C//DTD HTML 4.0 Transitional//" • The public identifier starts with: "-//W3C//DTD HTML Experimental 19960712//" • The public identifier starts with: "-//W3C//DTD HTML Experimental 970421//" • The public identifier starts with: "-//W3C//DTD W3 HTML//" • The public identifier starts with: "-//W3O//DTD W3 HTML 3.0//" • The public identifier starts with: "-//WebTechs//DTD Mozilla HTML 2.0//" • The public identifier starts with: "-//WebTechs//DTD Mozilla HTML//" • The system identifier is missing and the public identifier starts with: "-//W3C//DTD HTML 4.01 Frameset//" • The system identifier is missing and the public identifier starts with: "-//W3C//DTD HTML 4.01 Transitional//"
    2. ~ELIF[ ( %~publicID, %~systemID ) は 上とは別の “込み入った条件†” を満たす ] ⇒ `文書$の`~mode$doc ~SET `limited-quirks^l ◎ Otherwise, if the document is not an iframe srcdoc document, and the DOCTYPE token matches one of the conditions in the following list, then set the Document to limited-quirks mode: • The public identifier starts with: "-//W3C//DTD XHTML 1.0 Frameset//" • The public identifier starts with: "-//W3C//DTD XHTML 1.0 Transitional//" • The system identifier is not missing and the public identifier starts with: "-//W3C//DTD HTML 4.01 Frameset//" • The system identifier is not missing and the public identifier starts with: "-//W3C//DTD HTML 4.01 Transitional//" ◎ The system identifier and public identifier strings must be compared to the values given in the lists above in an ASCII case-insensitive manner. A system identifier whose value is the empty string is not considered missing for the purposes of the conditions above.

    【† この段の “込み入った条件” の具体的な内容は、未訳(いずれにせよ %~publicID, %~systemID のみから真偽が定まるが)。 】

  9. `挿入~mode$ ~SET `~htmlの前$md ◎ Then, switch the insertion mode to "before html".
~AnyElse
  1. ~IF[ `文書$は`~iframe-srcdoc文書$でない ]:

    1. `~perror$
    2. `文書$の`~mode$doc ~SET `quirks^l
    ◎ If the document is not an iframe srcdoc document, then this is a parse error; set the Document to quirks mode.
  2. `挿入~mode$ ~SET `~htmlの前$md
  3. 現tokenを再処理する ◎ In any case, switch the insertion mode to "before html", then reprocess the token.
12.2.6.4.2. `~htmlの前^md

[ `挿入~mode$ ~EQ `~htmlの前$md ]の下では、現tokenを以下に従って取扱わ~MUST: ◎ When the user agent is to apply the rules for the "before html" insertion mode, the user agent must handle the token as follows:

~DOCTYPE~token ◎ A DOCTYPE token
  1. `~perror$ — 現tokenは無視する
◎ Parse error. Ignore the token.
~comment~token ◎ A comment token
  1. `~commentを挿入する$( 現token, `文書$内の末尾 )
◎ Insert a comment as the last child of the Document object.
文字~token { `~ASCII空白$ } ◎ 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
  1. 現tokenは無視する
◎ Ignore the token.
開始tag { `html^l } ◎ A start tag whose tag name is "html"
  1. %html ~LET `~tokenから要素を作成する$( 現token, `~HTML名前空間$, `文書$ ) ◎ Create an element for the token in the HTML namespace, with the Document as the intended parent.\
  2. `文書$に %html を付加する ◎ Append it to the Document object.\
  3. `~open要素~stack$に %html を~pushする ◎ Put this element in the stack of open elements.
  4. ~app~cache関連の処理】 ◎ If the Document is being loaded as part of navigation of a browsing context, run these steps: • If the result of running match service worker registration for the document's URL is non-null, run the application cache selection algorithm passing the Document object with no manifest. • Otherwise, run these substeps: •• If the newly created element has a manifest attribute whose value is not the empty string, then parse the value of that attribute, relative to the newly created element's node document, and if that is successful, run the application cache selection algorithm passing the Document object with the result of applying the URL serializer algorithm to the resulting URL record with the exclude fragment flag set. • Otherwise, run the application cache selection algorithm passing the Document object with no manifest.
  5. `挿入~mode$ ~SET `~headの前$md ◎ Switch the insertion mode to "before head".
終了tag { `head^l, `body^l, `html^l, `br^l } ◎ An end tag whose tag name is one of: "head", "body", "html", "br"
  1. ~GOTO ~AnyElse
◎ Act as described in the "anything else" entry below.
その他の終了tag ◎ Any other end tag
  1. `~perror$ — 現tokenは無視する
◎ Parse error. Ignore the token.
~AnyElse
  1. %html ~LET 新たな `html$e 要素 ◎ Create an html element\
  2. %html の`~node文書$ ~SET `文書$ ◎ whose node document is the Document object.\
  3. `文書$に %html を付加する ◎ Append it to the Document object.\
  4. `~open要素~stack$に %html を~pushする ◎ Put this element in the stack of open elements.
  5. ~app~cache関連の処理】 ◎ If the Document is being loaded as part of navigation of a browsing context, then: run the application cache selection algorithm with no manifest, passing it the Document object.
  6. `挿入~mode$ ~SET `~headの前$md
  7. 現tokenを再処理する ◎ Switch the insertion mode to "before head", then reprocess the token.

`文書~要素$は — 例えば~scriptにより — `文書$から除去される結果になり得る。 そのような事例でも,特に何も起こらず、次~節に述べるように,内容は~nodeたち 【すなわち、文書~要素, またはその子孫】 に付加され続ける。 ◎ The document element can end up being removed from the Document object, e.g. by scripts; nothing in particular happens in such cases, content continues being appended to the nodes as described in the next section.

12.2.6.4.3. `~headの前^md

[ `挿入~mode$ ~EQ `~headの前$md ]の下では、現tokenを以下に従って取扱わ~MUST: ◎ When the user agent is to apply the rules for the "before head" insertion mode, the user agent must handle the token as follows:

文字~token { `~ASCII空白$ } ◎ 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
  1. 現tokenは無視する
◎ Ignore the token.
~comment~token ◎ A comment token
  1. `~commentを挿入する$( 現token )
◎ Insert a comment.
~DOCTYPE~token ◎ A DOCTYPE token
  1. `~perror$ — 現tokenは無視する
◎ Parse error. Ignore the token.
開始tag { `html^l } ◎ A start tag whose tag name is "html"
  1. `~body内$md`用の規則を用いて$現tokenを処理する
◎ Process the token using the rules for the "in body" insertion mode.
開始tag { `head^l } ◎ A start tag whose tag name is "head"
  1. %head ~LET `要素を挿入する$( 現token ) ◎ Insert an HTML element for the token.
  2. `~head要素~pointer$ ~SET %head ◎ Set the head element pointer to the newly created head element.
  3. `挿入~mode$ ~SET `~head内$md ◎ Switch the insertion mode to "in head".
終了tag { `head^l, `body^l, `html^l, `br^l } ◎ An end tag whose tag name is one of: "head", "body", "html", "br"
  1. ~GOTO ~AnyElse
◎ Act as described in the "anything else" entry below.
その他の終了tag ◎ Any other end tag
  1. `~perror$ — 現tokenは無視する
◎ Parse error. Ignore the token.
~AnyElse
  1. %head ~LET `要素を挿入する$( 新たな開始tag~token( `head^l ) ) ◎ Insert an HTML element for a "head" start tag token with no attributes.
  2. `~head要素~pointer$ ~SET %head ◎ Set the head element pointer to the newly created head element.
  3. `挿入~mode$ ~SET `~head内$md ◎ Switch the insertion mode to "in head".
  4. 現tokenを再処理する ◎ Reprocess the current token.
12.2.6.4.4. `~head内^md

[ `挿入~mode$ ~EQ `~head内$md ]の下では、現tokenを以下に従って取扱わ~MUST: ◎ When the user agent is to apply the rules for the "in head" insertion mode, the user agent must handle the token as follows:

文字~token { `~ASCII空白$ } ◎ 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
  1. `文字を挿入する$( ~tokenの文字 )
◎ Insert the character.
~comment~token ◎ A comment token
  1. `~commentを挿入する$( 現token )
◎ Insert a comment.
~DOCTYPE~token ◎ A DOCTYPE token
  1. `~perror$ — 現tokenは無視する
◎ Parse error. Ignore the token.
開始tag { `html^l } ◎ A start tag whose tag name is "html"
  1. `~body内$md`用の規則を用いて$現tokenを処理する
◎ Process the token using the rules for the "in body" insertion mode.
開始tag { `base^l, `basefont^l, `bgsound^l, `link^l } ◎ A start tag whose tag name is one of: "base", "basefont", "bgsound", "link"
  1. `要素を挿入する$( 現token ) ◎ Insert an HTML element for the token.\
  2. `~open要素~stack$から~popする ◎ Immediately pop the current node off the stack of open elements.
  3. ~IF[ 現tokenの`自己閉じ~flag$ ~EQ ~ON ] ⇒ `自己閉じ~flagを承認する$( 現token ) ◎ Acknowledge the token's self-closing flag, if it is set.
開始tag { `meta^l } ◎ A start tag whose tag name is "meta"
  1. %meta ~LET `要素を挿入する$( 現token ) ◎ Insert an HTML element for the token.\
  2. `~open要素~stack$から~popする ◎ Immediately pop the current node off the stack of open elements.
  3. ~IF[ 現tokenの`自己閉じ~flag$ ~EQ ~ON ] ⇒ `自己閉じ~flagを承認する$( 現token ) ◎ Acknowledge the token's self-closing flag, if it is set.
  4. ~IF[ `確度$ ~NEQ `暫定的^i ] ⇒ ~RET ◎ ↓
  5. ~IF[ %meta は `charset$a 属性を有する ]:

    1. %符号化法 ~LET `~labelから符号化法を取得する$( `charset$a 属性の値 )
    2. ~IF[ %符号化法 ~NEQ `失敗^i ]:

      1. `符号化法を変更する$( %符号化法 )
      2. ~RET
    ◎ If the element has a charset attribute, and getting an encoding from its value results in an encoding, and the confidence is currently tentative, then change the encoding to the resulting encoding.
  6. ~IF[ %meta は `http-equiv$a 属性を有していて その値 ~EQ`大小無視$sub `Content-Type^l ]~AND[ %meta は `content$a 属性を有する ]:

    1. %符号化法 ~LET `~meta要素から符号化法を抽出する$( `content$a 属性の値 )
    2. ~IF[ %符号化法 ~NEQ ε ] ⇒ `符号化法を変更する$( %符号化法 )
    ◎ Otherwise, if the element has an http-equiv attribute whose value is an ASCII case-insensitive match for the string "Content-Type", and the element has a content attribute, and applying the algorithm for extracting a character encoding from a meta element to that attribute's value returns an encoding, and the confidence is currently tentative, then change the encoding to the extracted encoding.
開始tag { `title^l } ◎ A start tag whose tag name is "title"
  1. `~RCDATA要素の汎用~構文解析~algo$に従う
◎ Follow the generic RCDATA element parsing algorithm.
開始tag { `noframes^l, `style^l } ◎ A start tag whose tag name is "noscript", if the scripting flag is enabled ◎ A start tag whose tag name is one of: "noframes", "style"
  1. `生~text要素の汎用~構文解析~algo$に従う
◎ Follow the generic raw text element parsing algorithm.
開始tag { `noscript^l } ◎ A start tag whose tag name is "noscript", if the scripting flag is disabled
  1. ~IF[ `~scripting~flag$ ~EQ `可能化^i ]:

    1. `生~text要素の汎用~構文解析~algo$に従う
    2. ~RET
    ◎ ↑↑
  2. `要素を挿入する$( 現token ) ◎ Insert an HTML element for the token.
  3. `挿入~mode$ ~SET `~head~noscript内$md ◎ Switch the insertion mode to "in head noscript".
開始tag { `script^l } ◎ A start tag whose tag name is "script" ◎ Run these steps:
  1. %調整-済み挿入-先 ~LET `適切な~node挿入-先$( `現在の~node$ ) ◎ Let the adjusted insertion location be the appropriate place for inserting a node.
  2. %script ~LET `~tokenから要素を作成する$( 現token, `~HTML名前空間$, %調整-済み挿入-先 が所属する要素 ) ◎ Create an element for the token in the HTML namespace, with the intended parent being the element in which the adjusted insertion location finds itself.
  3. %script の ( `解析器挿入~flag$, `阻まず~flag$ ) ~SET ( ~ON, ~OFF ) ◎ Mark the element as being "parser-inserted" and unset the element's "non-blocking" flag.

    注記: これは、[ %script が外部~scriptを与えている場合に,~script内の `document.write()$m の~callは~in-lineに実行する ]ことを確保する — 他のほとんどの事例では、それは,文書を吹飛ばすことになる。 また、終了tagに出くわすまで %script を実行されるのも防ぐ。 ◎ This ensures that, if the script is external, any document.write() calls in the script will execute in-line, instead of blowing the document away, as would happen in most other cases. It also prevents the script from executing until the end tag is seen.

  4. ~IF[ %構文解析器 は `~HTML素片~用$である (`素片~事例$) ] ⇒ %script の`開始済み~flag$ ~SET ~ON ◎ If the parser was originally created for the HTML fragment parsing algorithm, then mark the script element as "already started". (fragment case)
  5. ~IF[ %構文解析器 は[ `document.write()$m / `document.writeln()$m ]~methodを介して呼出されている ] ⇒ ~UAの任意選択で ⇒ %script の`開始済み~flag$ ~SET ~ON

    (例えば~UAは,[ ~networkが遅い/ 頁を読込むのに長時間かかっていた ]条件~下では、この条項を利用して,挿入された`非同一生成元$~scriptの実行を防ぐかもしれない。)

    ◎ If the parser was invoked via the document.write() or document.writeln() methods, then optionally mark the script element as "already started". (For example, the user agent might use this clause to prevent execution of cross-origin scripts inserted via document.write() under slow network conditions, or when the page has already taken a long time to load.)
  6. %script を %調整-済み挿入-先 に挿入する ◎ Insert the newly created element at the adjusted insertion location.
  7. `~open要素~stack$に %script を~pushする ◎ Push the element onto the stack of open elements so that it is the new current node.
  8. ~tokenizerを `~script~data$st に`切替える$ ◎ Switch the tokenizer to the script data state.
  9. `元の挿入~mode$V ~LET 現在の`挿入~mode$ ◎ Let the original insertion mode be the current insertion mode.

  10. `挿入~mode$ ~SET `~text$md ◎ Switch the insertion mode to "text".
終了tag { `head^l } ◎ An end tag whose tag name is "head"
  1. ~Assert: `現在の~node$は `head$e 要素である ◎ ↓
  2. `~open要素~stack$から~popする ◎ Pop the current node (which will be the head element) off the stack of open elements.
  3. `挿入~mode$ ~SET `~headの後$md ◎ Switch the insertion mode to "after head".
終了tag { `body^l, `html^l, `br^l } ◎ An end tag whose tag name is one of: "body", "html", "br"
  1. ~GOTO ~AnyElse
◎ Act as described in the "anything else" entry below.
開始tag { `template^l } ◎ A start tag whose tag name is "template"
  1. `要素を挿入する$( 現token ) ◎ Insert an HTML element for the token.
  2. `作動中の整形~要素~list$に`~marker$を付加する ◎ Insert a marker at the end of the list of active formatting elements.
  3. `~frameset-ok~flag$ ~SET `not-ok^i ◎ Set the frameset-ok flag to "not ok".
  4. `挿入~mode$ ~SET `~template内$md ◎ Switch the insertion mode to "in template".
  5. `~template挿入~mode~stack$に`~template内$mdを~pushする ◎ Push "in template" onto the stack of template insertion modes so that it is the new current template insertion mode.
終了tag { `template^l } ◎ An end tag whose tag name is "template"
  1. ~IF[ `~open要素~stack$内には `template$e 要素はない ]:

    1. `~perror$
    2. ~RET — 現tokenは無視する
    ◎ If there is no template element on the stack of open elements, then this is a parse error; ignore the token. ◎ Otherwise, run these steps:
  2. `暗黙の終了tagすべてを生成する$ ◎ Generate all implied end tags thoroughly.

  3. ~IF[ `現在の~node$は `template$e 要素でない ] ⇒ `~perror$ ◎ If the current node is not a template element, then this is a parse error.
  4. `template$e 要素が`出るまで~open要素~stackから~popする$ ◎ Pop elements from the stack of open elements until a template element has been popped from the stack.
  5. `作動中の整形~要素~listを最後の~markerまで~clearする$ ◎ Clear the list of active formatting elements up to the last marker.
  6. `~template挿入~mode~stack$から~popする ◎ Pop the current template insertion mode off the stack of template insertion modes.
  7. `挿入~modeを適切に再設定する$ ◎ Reset the insertion mode appropriately.
開始tag { `head^l } ◎ A start tag whose tag name is "head"
その他の終了tag ◎ Any other end tag
  1. `~perror$ — 現tokenは無視する
◎ Parse error. Ignore the token.
~AnyElse
  1. ~Assert: `現在の~node$は `head$e 要素である ◎ ↓
  2. `~open要素~stack$から~popする ◎ Pop the current node (which will be the head element) off the stack of open elements.
  3. `挿入~mode$ ~SET `~headの後$md ◎ Switch the insertion mode to "after head".
  4. 現tokenを再処理する ◎ Reprocess the token.
12.2.6.4.5. `~head~noscript内^md

[ `挿入~mode$ ~EQ `~head~noscript内$md ]の下では、現tokenを以下に従って取扱わ~MUST: ◎ When the user agent is to apply the rules for the "in head noscript" insertion mode, the user agent must handle the token as follows:

~DOCTYPE~token ◎ A DOCTYPE token
  1. `~perror$ — 現tokenは無視する
◎ Parse error. Ignore the token.
開始tag { `html^l } ◎ A start tag whose tag name is "html"
  1. `~body内$md`用の規則を用いて$現tokenを処理する
◎ Process the token using the rules for the "in body" insertion mode.
終了tag { `noscript^l } ◎ An end tag whose tag name is "noscript"
  1. ~Assert: `現在の~node$は `noscript$e 要素である ◎ ↓
  2. `~open要素~stack$から~popする ◎ Pop the current node (which will be a noscript element) from the stack of open elements;
  3. ~Assert: `現在の~node$は `head$e 要素である ◎ the new current node will be a head element.
  4. `挿入~mode$ ~SET `~head内$md ◎ Switch the insertion mode to "in head".
文字~token { `~ASCII空白$ } ◎ 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
~comment~token ◎ A comment token
開始tag { `basefont^l, `bgsound^l, `link^l, `meta^l, `noframes^l, `style^l } ◎ A start tag whose tag name is one of: "basefont", "bgsound", "link", "meta", "noframes", "style"
  1. `~head内$md`用の規則を用いて$現tokenを処理する
◎ Process the token using the rules for the "in head" insertion mode.
終了tag { `br^l } ◎ An end tag whose tag name is "br"
  1. ~GOTO ~AnyElse
◎ Act as described in the "anything else" entry below.
開始tag { `head^l, `noscript^l } ◎ A start tag whose tag name is one of: "head", "noscript"
その他の終了tag ◎ Any other end tag
  1. `~perror$ — 現tokenは無視する
◎ Parse error. Ignore the token.
~AnyElse
  1. `~perror$ ◎ Parse error.
  2. ~Assert: `現在の~node$は `noscript$e 要素である ◎ ↓
  3. `~open要素~stack$から~popする ◎ Pop the current node (which will be a noscript element) from the stack of open elements;
  4. ~Assert: `現在の~node$は `head$e 要素である ◎ the new current node will be a head element.
  5. `挿入~mode$ ~SET `~head内$md ◎ Switch the insertion mode to "in head".
  6. 現tokenを再処理する ◎ Reprocess the token.
12.2.6.4.6. `~headの後^md

[ `挿入~mode$ ~EQ `~headの後$md ]の下では、現tokenを以下に従って取扱わ~MUST: ◎ When the user agent is to apply the rules for the "after head" insertion mode, the user agent must handle the token as follows:

文字~token { `~ASCII空白$ } ◎ 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
  1. `文字を挿入する$( 現tokenの文字 )
◎ Insert the character.
~comment~token ◎ A comment token
  1. `~commentを挿入する$( 現token )
◎ Insert a comment.
~DOCTYPE~token ◎ A DOCTYPE token
  1. `~perror$ — 現tokenは無視する
◎ Parse error. Ignore the token.
開始tag { `html^l } ◎ A start tag whose tag name is "html"
  1. `~body内$md`用の規則を用いて$現tokenを処理する
◎ Process the token using the rules for the "in body" insertion mode.
開始tag { `body^l } ◎ A start tag whose tag name is "body"
  1. `要素を挿入する$( 現token ) ◎ Insert an HTML element for the token.
  2. `~frameset-ok~flag$ ~SET `not-ok^i ◎ Set the frameset-ok flag to "not ok".
  3. `挿入~mode$ ~SET `~body内$md ◎ Switch the insertion mode to "in body".
開始tag { `frameset^l } ◎ A start tag whose tag name is "frameset"
  1. `要素を挿入する$( 現token ) ◎ Insert an HTML element for the token.
  2. `挿入~mode$ ~SET `~frameset内$md ◎ Switch the insertion mode to "in frameset".
開始tag { `base^l, `basefont^l, `bgsound^l, `link^l, `meta^l, `noframes^l, `script^l, `style^l, `template^l, `title^l } ◎ A start tag whose tag name is one of: "base", "basefont", "bgsound", "link", "meta", "noframes", "script", "style", "template", "title"
  1. `~perror$ ◎ Parse error.
  2. `~open要素~stack$に `~head要素~pointer$が指す~nodeを~pushする ◎ Push the node pointed to by the head element pointer onto the stack of open elements.
  3. `~head内$md`用の規則を用いて$現tokenを処理する ◎ Process the token using the rules for the "in head" insertion mode.
  4. `~open要素~stack$から `~head要素~pointer$が指す~nodeを除去する (この時点では、それは`現在の~node$でないかもしれない) ◎ Remove the node pointed to by the head element pointer from the stack of open elements. (It might not be the current node at this point.)

    注記: この時点では、`~head要素~pointer$は ~NULL になり得ない。 ◎ The head element pointer cannot be null at this point.

終了tag { `template^l } ◎ An end tag whose tag name is "template"
  1. `~head内$md`用の規則を用いて$現tokenを処理する
◎ Process the token using the rules for the "in head" insertion mode.
終了tag { `body^l, `html^l, `br^l } ◎ An end tag whose tag name is one of: "body", "html", "br"
  1. ~GOTO ~AnyElse
◎ Act as described in the "anything else" entry below.
開始tag { `head^l } ◎ A start tag whose tag name is "head"
その他の終了tag ◎ Any other end tag
  1. `~perror$ — 現tokenは無視する
◎ Parse error. Ignore the token.
~AnyElse
  1. `要素を挿入する$( 新たな開始tag~token( `body^l ) ) ◎ Insert an HTML element for a "body" start tag token with no attributes.
  2. `挿入~mode$ ~SET `~body内$md ◎ Switch the insertion mode to "in body".
  3. 現tokenを再処理する ◎ Reprocess the current token.
12.2.6.4.7. `~body内^md

[ `挿入~mode$ ~EQ `~body内$md ]の下では、現tokenを以下に従って取扱わ~MUST: ◎ When the user agent is to apply the rules for the "in body" insertion mode, the user agent must handle the token as follows:

文字~token { `0000^U } ◎ A character token that is U+0000 NULL
  1. `~perror$ — 現tokenは無視する
◎ Parse error. Ignore the token.
文字~token { `~ASCII空白$ } ◎ 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
  1. `作動中の整形~要素たちを再構築する$ ◎ Reconstruct the active formatting elements, if any.
  2. `文字を挿入する$( 現tokenの文字 ) ◎ Insert the token's character.
その他の文字~token ◎ Any other character token
  1. `作動中の整形~要素たちを再構築する$ ◎ Reconstruct the active formatting elements, if any.
  2. `文字を挿入する$( 現tokenの文字 ) ◎ Insert the token's character.
  3. `~frameset-ok~flag$ ~SET `not-ok^i ◎ Set the frameset-ok flag to "not ok".
~comment~token ◎ A comment token
  1. `~commentを挿入する$( 現token )
◎ Insert a comment.
~DOCTYPE~token ◎ A DOCTYPE token
  1. `~perror$ — 現tokenは無視する
◎ Parse error. Ignore the token.
開始tag { `html^l } ◎ A start tag whose tag name is "html"
  1. `~perror$ ◎ Parse error.
  2. ~IF[ `~open要素~stack$内に `template$e 要素はある ] ⇒ ~RET — 現tokenは無視する ◎ If there is a template element on the stack of open elements, then ignore the token.
  3. %要素 ~LET `~open要素~stack$の先頭の要素 ◎ ↓
  4. ~tokenの属性~list内の~EACH( %属性 ) に対し ⇒ ~IF[ %要素 は[ %属性 と同じ名前の属性 ]を有していない ] ⇒ %要素 に[ %属性 の[ 名前, 値 ]で与えられる属性 ]を追加する ◎ Otherwise, for each attribute on the token, check to see if the attribute is already present on the top element of the stack of open elements. If it is not, add the attribute and its corresponding value to that element.
開始tag { `base^l, `basefont^l, `bgsound^l, `link^l, `meta^l, `noframes^l, `script^l, `style^l, `template^l, `title^l } ◎ A start tag whose tag name is one of: "base", "basefont", "bgsound", "link", "meta", "noframes", "script", "style", "template", "title"
終了tag { `template^l } ◎ An end tag whose tag name is "template"
  1. `~head内$md`用の規則を用いて$現tokenを処理する
◎ Process the token using the rules for the "in head" insertion mode.
開始tag { `body^l } ◎ A start tag whose tag name is "body"
  1. `~perror$ ◎ Parse error.
  2. %body ~LET `~open要素~stack$内に 2 個目の要素が[ 在れば それ / 無ければ ε ] ◎ ↓
  3. ~IF[ %body は `body$e 要素でない ]~OR[ `~open要素~stack$内には `template$e 要素はある ](`素片~事例$) ⇒ ~RET — 現tokenは無視する ◎ If the second element on the stack of open elements is not a body element, if the stack of open elements has only one node on it, or if there is a template element on the stack of open elements, then ignore the token. (fragment case)
  4. `~frameset-ok~flag$ ~SET `not-ok^i ◎ Otherwise, set the frameset-ok flag to "not ok"; then,\
  5. ~token上の~EACH( %属性 ) に対し ⇒ ~IF[ %body は,まだ %属性 を有していない ] ⇒ %body に %属性 を(対応している値とともに)追加する ◎ for each attribute on the token, check to see if the attribute is already present on the body element (the second element) on the stack of open elements, and if it is not, add the attribute and its corresponding value to that element.
開始tag { `frameset^l } ◎ A start tag whose tag name is "frameset"
  1. `~perror$ ◎ Parse error.
  2. %body ~LET `~open要素~stack$内に 2 個目の要素が[ 在れば それ / 無ければ ε ] ◎ ↓
  3. ~IF[ %body は `body$e 要素でない (`素片~事例$) ] ⇒ ~RET — 現tokenは無視する ◎ If the stack of open elements has only one node on it, or if the second element on the stack of open elements is not a body element, then ignore the token. (fragment case)
  4. ~IF[ `~frameset-ok~flag$ ~EQ `not-ok^i ] ⇒ ~RET — 現tokenは無視する ◎ If the frameset-ok flag is set to "not ok", ignore the token. ◎ Otherwise, run the following steps:
  5. ~IF[ %body の親~nodeはある ] ⇒ %body を親~nodeから除去する ◎ Remove the second element on the stack of open elements from its parent node, if it has one.
  6. ~WHILE[ `現在の~node$は根 `html$e 要素でない ] ⇒ `~open要素~stack$から~popする ◎ Pop all the nodes from the bottom of the stack of open elements, from the current node up to, but not including, the root html element.
  7. `要素を挿入する$( 現token ) ◎ Insert an HTML element for the token.
  8. `挿入~mode$ ~SET `~frameset内$md ◎ Switch the insertion mode to "in frameset".
~eof~token ◎ An end-of-file token
  1. ~IF[ `~template挿入~mode~stack$は空でない ]:

    1. `~template内$md`用の規則を用いて$現tokenを処理する
    2. ~RET
    ◎ If the stack of template insertion modes is not empty, then process the token using the rules for the "in template" insertion mode. ◎ Otherwise, follow these steps:
  2. ~IF[ `~open要素~stack$内に,次に挙げる要素~型~以外の~nodeはある ]… ⇒ `dd$e, `dt$e, `li$e, `optgroup$e, `option$e, `p$e, `rb$e, `rp$e, `rt$e, `rtc$e, `tbody$e, `td$e, `tfoot$e, `th$e, `thead$e, `tr$e, `body$e, `html$e

    …ならば ⇒ `~perror$

    ◎ If there is a node in the stack of open elements that is not either a dd element, a dt element, an li element, an optgroup element, an option element, a p element, an rb element, an rp element, an rt element, an rtc element, a tbody element, a td element, a tfoot element, a th element, a thead element, a tr element, the body element, or the html element, then this is a parse error.
  3. `構文解析を停止する$ ◎ Stop parsing.
終了tag { `body^l } ◎ An end tag whose tag name is "body"
  1. ~IF[ `視野~内$に無い( `既定の視野$, `body^e ) ]:

    1. `~perror$
    2. ~RET — 現tokenは無視する
    ◎ If the stack of open elements does not have a body element in scope, this is a parse error; ignore the token.
  2. ~IF[ `~open要素~stack$内に,次に挙げる要素~型~以外の~nodeはある ]… ⇒ `dd$e, `dt$e, `li$e, `optgroup$e, `option$e, `p$e, `rb$e, `rp$e, `rt$e, `rtc$e, `tbody$e, `td$e, `tfoot$e, `th$e, `thead$e, `tr$e, `body$e, `html$e

    …ならば ⇒ `~perror$

    ◎ Otherwise, if there is a node in the stack of open elements that is not either a dd element, a dt element, an li element, an optgroup element, an option element, a p element, an rb element, an rp element, an rt element, an rtc element, a tbody element, a td element, a tfoot element, a th element, a thead element, a tr element, the body element, or the html element, then this is a parse error.
  3. `挿入~mode$ ~SET `~bodyの後$md ◎ Switch the insertion mode to "after body".
終了tag { `html^l } ◎ An end tag whose tag name is "html"
  1. ~IF[ `視野~内$に無い( `既定の視野$, `body^e ) ]:

    1. `~perror$
    2. ~RET — 現tokenは無視する
    ◎ If the stack of open elements does not have a body element in scope, this is a parse error; ignore the token.
  2. ~IF[ `~open要素~stack$内に,次に挙げる要素~型~以外の~nodeはある ]… ⇒ `dd$e, `dt$e, `li$e, `optgroup$e, `option$e, `p$e, `rb$e, `rp$e, `rt$e, `rtc$e, `tbody$e, `td$e, `tfoot$e, `th$e, `thead$e, `tr$e, `body$e, `html$e

    …ならば ⇒ `~perror$

    ◎ Otherwise, if there is a node in the stack of open elements that is not either a dd element, a dt element, an li element, an optgroup element, an option element, a p element, an rb element, an rp element, an rt element, an rtc element, a tbody element, a td element, a tfoot element, a th element, a thead element, a tr element, the body element, or the html element, then this is a parse error.
  3. `挿入~mode$ ~SET `~bodyの後$md ◎ Switch the insertion mode to "after body".
  4. 現tokenを再処理する ◎ Reprocess the token.
開始tag { `address^l, `article^l, `aside^l, `blockquote^l, `center^l, `details^l, `dialog^l, `dir^l, `div^l, `dl^l, `fieldset^l, `figcaption^l, `figure^l, `footer^l, `header^l, `hgroup^l, `main^l, `menu^l, `nav^l, `ol^l, `p^l, `section^l, `summary^l, `ul^l } ◎ A start tag whose tag name is one of: "address", "article", "aside", "blockquote", "center", "details", "dialog", "dir", "div", "dl", "fieldset", "figcaption", "figure", "footer", "header", "hgroup", "main", "menu", "nav", "ol", "p", "section", "summary", "ul"
  1. ~IF[ `視野~内$に在る( `~button視野$, `p^e ) ] ⇒ `~p要素を閉じる$ ◎ If the stack of open elements has a p element in button scope, then close a p element.
  2. `要素を挿入する$( 現token ) ◎ Insert an HTML element for the token.
開始tag { `h1^l, `h2^l, `h3^l, `h4^l, `h5^l, `h6^l } ◎ A start tag whose tag name is one of: "h1", "h2", "h3", "h4", "h5", "h6"
  1. ~IF[ `視野~内$に在る( `~button視野$, `p^e ) ] ⇒ `~p要素を閉じる$ ◎ If the stack of open elements has a p element in button scope, then close a p element.
  2. ~IF[ `現在の~node$は`~HTML要素$である ]~AND[ その~tag名 ~IN { `h1^l, `h2^l, `h3^l, `h4^l, `h5^l, `h6^l } ]:

    1. `~perror$
    2. `~open要素~stack$から~popする
    ◎ If the current node is an HTML element whose tag name is one of "h1", "h2", "h3", "h4", "h5", or "h6", then this is a parse error; pop the current node off the stack of open elements.
  3. `要素を挿入する$( 現token ) ◎ Insert an HTML element for the token.
開始tag { `pre^l, `listing^l } ◎ A start tag whose tag name is one of: "pre", "listing"
  1. ~IF[ `視野~内$に在る( `~button視野$, `p^e ) ] ⇒ `~p要素を閉じる$ ◎ If the stack of open elements has a p element in button scope, then close a p element.
  2. `要素を挿入する$( 現token ) ◎ Insert an HTML element for the token.
  3. `次n~LF文字~tokenは無視するようにしておく$ ◎ If the next token is a U+000A LINE FEED (LF) character token, then ignore that token and move on to the next one. (Newlines at the start of pre blocks are ignored as an authoring convenience.)
  4. `~frameset-ok~flag$ ~SET `not-ok^i ◎ Set the frameset-ok flag to "not ok".
開始tag { `form^l } ◎ A start tag whose tag name is "form"
  1. ~IF[ `~form要素~pointer$ ~NEQ ~NULL ]~AND[ `~open要素~stack$内には `template$e 要素はない ]:

    1. `~perror$
    2. ~RET — 現tokenは無視する
    ◎ If the form element pointer is not null, and there is no template element on the stack of open elements, then this is a parse error; ignore the token. ◎ Otherwise:
  2. ~IF[ `視野~内$に在る( `~button視野$, `p^e ) ] ⇒ `~p要素を閉じる$ ◎ If the stack of open elements has a p element in button scope, then close a p element.
  3. %要素 ~LET `要素を挿入する$( 現token ) ◎ ↓
  4. ~IF[ `~open要素~stack$内には `template$e 要素はない ] ⇒ `~form要素~pointer$ ~SET %要素 ◎ Insert an HTML element for the token, and, if there is no template element on the stack of open elements, set the form element pointer to point to the element created.
開始tag { `li^l } ◎ A start tag whose tag name is "li" ◎ Run these steps:
  1. `~frameset-ok~flag$ ~SET `not-ok^i ◎ Set the frameset-ok flag to "not ok".
  2. `~open要素~stack$内の~EACH( %~node ) に対し,末尾から順に: ◎ Initialize node to be the current node (the bottommost node of the stack).

    1. ~IF[ %~node は `li$e 要素である ]: ◎ Loop: If node is an li element, then run these substeps:

      1. `暗黙の終了tagたちを生成する$( `li$e ) ◎ Generate implied end tags, except for li elements.
      2. ~IF[ `現在の~node$は `li$e 要素でない ] ⇒ `~perror$ ◎ If the current node is not an li element, then this is a parse error.
      3. `li$e 要素が`出るまで~open要素~stackから~popする$ ◎ Pop elements from the stack of open elements until an li element has been popped from the stack.
      4. ~BREAK ◎ Jump to the step labeled done below.
    2. ~IF[ %~node は`特別$である ]~AND[ %~node は[ `address$e, `div$e, `p$e ]要素ではない ] ⇒ ~BREAK ◎ If node is in the special category, but is not an address, div, or p element, then jump to the step labeled done below. ◎ Otherwise, set node to the previous entry in the stack of open elements and return to the step labeled loop.
  3. ~IF[ `視野~内$に在る( `~button視野$, `p^e ) ] ⇒ `~p要素を閉じる$ ◎ Done: If the stack of open elements has a p element in button scope, then close a p element.
  4. `要素を挿入する$( 現token ) ◎ Finally, insert an HTML element for the token.
開始tag { `dd^l, `dt^l } ◎ A start tag whose tag name is one of: "dd", "dt" ◎ Run these steps:
  1. `~frameset-ok~flag$ ~SET `not-ok^i ◎ Set the frameset-ok flag to "not ok".
  2. `~open要素~stack$内の~EACH( %~node ) に対し,末尾から順に: ◎ Initialize node to be the current node (the bottommost node of the stack).

    1. ~IF[ %~node は `dd$e 要素である ]: ◎ Loop: If node is a dd element, then run these substeps:

      1. `暗黙の終了tagたちを生成する$( `dd$e ) ◎ Generate implied end tags, except for dd elements.
      2. ~IF[ `現在の~node$は `dd$e 要素でない ] ⇒ `~perror$ ◎ If the current node is not a dd element, then this is a parse error.
      3. `dd$e 要素が`出るまで~open要素~stackから~popする$ ◎ Pop elements from the stack of open elements until a dd element has been popped from the stack.
      4. ~BREAK ◎ Jump to the step labeled done below.
    2. ~IF[ %~node は `dt$e 要素である ]: ◎ If node is a dt element, then run these substeps:

      1. `暗黙の終了tagたちを生成する$( `dt$e ) ◎ Generate implied end tags, except for dt elements.
      2. ~IF[ `現在の~node$は `dt$e 要素でない ] ⇒ `~perror$ ◎ If the current node is not a dt element, then this is a parse error.
      3. `dt$e 要素が`出るまで~open要素~stackから~popする$ ◎ Pop elements from the stack of open elements until a dt element has been popped from the stack.
      4. ~BREAK ◎ Jump to the step labeled done below.
    3. ~IF[ %~node は`特別$であって[ `address$e / `div$e / `p$e ] 要素ではない ] ⇒ ~BREAK ◎ If node is in the special category, but is not an address, div, or p element, then jump to the step labeled done below. ◎ Otherwise, set node to the previous entry in the stack of open elements and return to the step labeled loop.
  3. ~IF[ `視野~内$に在る( `~button視野$, `p^e ) ] ⇒ `~p要素を閉じる$ ◎ Done: If the stack of open elements has a p element in button scope, then close a p element.
  4. `要素を挿入する$( 現token ) ◎ Finally, insert an HTML element for the token.
開始tag { `plaintext^l } ◎ A start tag whose tag name is "plaintext"
  1. ~IF[ `視野~内$に在る( `~button視野$, `p^e ) ] ⇒ `~p要素を閉じる$ ◎ If the stack of open elements has a p element in button scope, then close a p element.
  2. `要素を挿入する$( 現token ) ◎ Insert an HTML element for the token.
  3. ~tokenizerを `~PLAINTEXT$st に`切替える$ ◎ Switch the tokenizer to the PLAINTEXT state.
注記: [ 開始tagであって[ その~tag名 ~EQ `plaintext^l ]なるもの ]に出くわしたならば、それが[ 文字~token(および~eof~token)以外に出くわしたことがある,最後の~token ]になる — `~PLAINTEXT$st から外へ`切替える$仕方はないので。 ◎ Once a start tag with the tag name "plaintext" has been seen, that will be the last token ever seen other than character tokens (and the end-of-file token), because there is no way to switch out of the PLAINTEXT state.
開始tag { `button^l } ◎ A start tag whose tag name is "button"
  1. ~IF[ `視野~内$に在る( `既定の視野$, `button^e ) ]: ◎ If the stack of open elements has a button element in scope, then run these substeps:

    1. `~perror$ ◎ Parse error.
    2. `暗黙の終了tagたちを生成する$() ◎ Generate implied end tags.
    3. `button$e 要素が`出るまで~open要素~stackから~popする$ ◎ Pop elements from the stack of open elements until a button element has been popped from the stack.
  2. `作動中の整形~要素たちを再構築する$ ◎ Reconstruct the active formatting elements, if any.
  3. `要素を挿入する$( 現token ) ◎ Insert an HTML element for the token.
  4. `~frameset-ok~flag$ ~SET `not-ok^i ◎ Set the frameset-ok flag to "not ok".
終了tag { `address^l, `article^l, `aside^l, `blockquote^l, `button^l, `center^l, `details^l, `dialog^l, `dir^l, `div^l, `dl^l, `fieldset^l, `figcaption^l, `figure^l, `footer^l, `header^l, `hgroup^l, `listing^l, `main^l, `menu^l, `nav^l, `ol^l, `pre^l, `section^l, `summary^l, `ul^l } ◎ An end tag whose tag name is one of: "address", "article", "aside", "blockquote", "button", "center", "details", "dialog", "dir", "div", "dl", "fieldset", "figcaption", "figure", "footer", "header", "hgroup", "listing", "main", "menu", "nav", "ol", "pre", "section", "summary", "ul"
  1. ~IF[ `視野~内$に無い( `既定の視野$, 現tokenと~tag名が同じ`~HTML要素$ ) ]:

    1. `~perror$
    2. ~RET — 現tokenは無視する
    ◎ If the stack of open elements does not have an element in scope that is an HTML element with the same tag name as that of the token, then this is a parse error; ignore the token. ◎ Otherwise, run these steps:
  2. `暗黙の終了tagたちを生成する$() ◎ Generate implied end tags.
  3. ~IF[ `現在の~node$は[ 現tokenと~tag名が同じ`~HTML要素$ ]ではない ] ⇒ `~perror$ ◎ If the current node is not an HTML element with the same tag name as that of the token, then this is a parse error.
  4. 現tokenと~tag名が同じ`~HTML要素$が`出るまで~open要素~stackから~popする$ ◎ Pop elements from the stack of open elements until an HTML element with the same tag name as the token has been popped from the stack.
終了tag { `form^l } ◎ An end tag whose tag name is "form"
  1. ~IF[ `~open要素~stack$内には `template$e 要素はない ]: ◎ If there is no template element on the stack of open elements, then run these substeps:

    1. %~node ~LET [ `~form要素~pointer$ は要素ならば それ / ~ELSE_ ~NULL ] ◎ Let node be the element that the form element pointer is set to, or null if it is not set to an element.
    2. `~form要素~pointer$ ~SET ~NULL ◎ Set the form element pointer to null.
    3. ~IF[ %~node ~EQ ~NULL ]~OR[ `視野~内$に無い( `既定の視野$, %~node ) ]:

      1. `~perror$
      2. ~RET — 現tokenは無視する
      ◎ If node is null or if the stack of open elements does not have node in scope, then this is a parse error; return and ignore the token.
    4. `暗黙の終了tagたちを生成する$() ◎ Generate implied end tags.
    5. ~IF[ `現在の~node$ ~NEQ %~node ] ⇒ `~perror$ ◎ If the current node is not node, then this is a parse error.
    6. `~open要素~stack$から %~node を除去する ◎ Remove node from the stack of open elements.
  2. ~IF[ `~open要素~stack$内に `template$e 要素はある ]: ◎ If there is a template element on the stack of open elements, then run these substeps instead:

    1. ~IF[ `視野~内$に無い( `既定の視野$, `form^e ) ]:

      1. `~perror$
      2. ~RET — 現tokenは無視する
      ◎ If the stack of open elements does not have a form element in scope, then this is a parse error; return and ignore the token.
    2. `暗黙の終了tagたちを生成する$() ◎ Generate implied end tags.
    3. ~IF[ `現在の~node$は `form$e 要素でない ] ⇒ `~perror$ ◎ If the current node is not a form element, then this is a parse error.
    4. `form$e 要素が`出るまで~open要素~stackから~popする$ ◎ Pop elements from the stack of open elements until a form element has been popped from the stack.
終了tag { `p^l } ◎ An end tag whose tag name is "p"
  1. ~IF[ `視野~内$に無い( `~button視野$, `p^e ) ]:

    1. `~perror$
    2. `要素を挿入する$( 新たな開始tag~token( `p^l ) )
    ◎ If the stack of open elements does not have a p element in button scope, then this is a parse error; insert an HTML element for a "p" start tag token with no attributes.
  2. `~p要素を閉じる$ ◎ Close a p element.
終了tag { `li^l } ◎ An end tag whose tag name is "li"
  1. ~IF[ `視野~内$に無い( `~list~item視野$, `li^e ) ]:

    1. `~perror$
    2. ~RET — 現tokenは無視する
    ◎ If the stack of open elements does not have an li element in list item scope, then this is a parse error; ignore the token. ◎ Otherwise, run these steps:
  2. `暗黙の終了tagたちを生成する$( `li$e ) ◎ Generate implied end tags, except for li elements.
  3. ~IF[ `現在の~node$は `li$e 要素でない ] ⇒ `~perror$ ◎ If the current node is not an li element, then this is a parse error.
  4. `li$e 要素が`出るまで~open要素~stackから~popする$ ◎ Pop elements from the stack of open elements until an li element has been popped from the stack.
終了tag { `dd^l, `dt^l } ◎ An end tag whose tag name is one of: "dd", "dt"
  1. ~IF[ `視野~内$に無い( `既定の視野$, 現tokenと~tag名が同じ`~HTML要素$ ) ]:

    1. `~perror$
    2. ~RET — 現tokenは無視する
    ◎ If the stack of open elements does not have an element in scope that is an HTML element with the same tag name as that of the token, then this is a parse error; ignore the token. ◎ Otherwise, run these steps:
  2. `暗黙の終了tagたちを生成する$( 現tokenと~tag名が同じ`~HTML要素$ ) ◎ Generate implied end tags, except for HTML elements with the same tag name as the token.
  3. ~IF[ `現在の~node$は[ 現tokenと~tag名が同じ`~HTML要素$ ]ではない ] ⇒ `~perror$ ◎ If the current node is not an HTML element with the same tag name as that of the token, then this is a parse error.
  4. 現tokenと~tag名が同じ`~HTML要素$が`出るまで~open要素~stackから~popする$ ◎ Pop elements from the stack of open elements until an HTML element with the same tag name as the token has been popped from the stack.
終了tag { `h1^l, `h2^l, `h3^l, `h4^l, `h5^l, `h6^l } ◎ An end tag whose tag name is one of: "h1", "h2", "h3", "h4", "h5", "h6"
  1. ~IF[ `視野~内$に無い( `既定の視野$, { `h1^e, `h2^e, `h3^e, `h4^e, `h5^e, `h6^e } ) ]:

    1. `~perror$
    2. ~RET — 現tokenは無視する
    ◎ If the stack of open elements does not have an element in scope that is an HTML element and whose tag name is one of "h1", "h2", "h3", "h4", "h5", or "h6", then this is a parse error; ignore the token. ◎ Otherwise, run these steps:
  2. `暗黙の終了tagたちを生成する$() ◎ Generate implied end tags.
  3. ~IF[ `現在の~node$は[ 現tokenと~tag名が同じ`~HTML要素$ ]ではない ] ⇒ `~perror$ ◎ If the current node is not an HTML element with the same tag name as that of the token, then this is a parse error.
  4. { `h1^e, `h2^e, `h3^e, `h4^e, `h5^e, `h6^e } いずれかの要素が`出るまで~open要素~stackから~popする$ ◎ Pop elements from the stack of open elements until an HTML element whose tag name is one of "h1", "h2", "h3", "h4", "h5", or "h6" has been popped from the stack.
終了tag { `sarcasm^l } ◎ An end tag whose tag name is "sarcasm"
  1. Take a deep breath, then…
  2. ~GOTO その他の終了tag
◎ Take a deep breath, then act as described in the "any other end tag" entry below.
開始tag { `a^l } ◎ A start tag whose tag name is "a"
  1. ~IF[ `作動中の整形~要素~list$内に次を満たす %要素 はある ]…:

    • %要素 は `a$e 要素である
    • ~list内の %要素 より後には`~marker$はない

    …ならば:

    ◎ If the list of active formatting elements contains an a element between the end of the list and the last marker on the list (or the start of the list if there is no marker on the list), then\
    1. `~perror$ ◎ this is a parse error;\
    2. `養子縁組~algo$を走らす( 現token ) ◎ run the adoption agency algorithm for the token, then\
    3. [ `作動中の整形~要素~list$, `~open要素~stack$ ]から %要素 を除去する — 前~段による結果、 %要素 は除去されていなければ(`視野~内$に無い( `~table視野$, %要素 ) の場合,除去されていないかもしれない。) ◎ remove that element from the list of active formatting elements and the stack of open elements if the adoption agency algorithm didn't already remove it (it might not have if the element is not in table scope).

    適合してない~stream `<a href="a">a<table><a href="b">b</table>x^c 内では、 1 個目の `a$e 要素は 2 個目のそれに出くわした所で閉じられ,文字 `x^l は "a" への~linkではなく "b" への~linkの内側に置かれることになる — 1 個目の `a$e 要素は,~table視野~内に無い(~tableの始端に定例の`</a>^c 終了tagがあっても, 1 個目の `a$e 要素を閉じないことを意味する)事実にもかかわらず。 その結果、この 2 個の `a$e 要素は間接的に互いの内側に 【~markup的な意味で】 入子にされる — 適合してない~markupを構文解析した結果は、適合してない~DOMになることが多い。 ◎ In the non-conforming stream <a href="a">a<table><a href="b">b</table>x, the first a element would be closed upon seeing the second one, and the "x" character would be inside a link to "b", not to "a". This is despite the fact that the outer a element is not in table scope (meaning that a regular </a> end tag at the start of the table wouldn't close the outer a element). The result is that the two a elements are indirectly nested inside each other — non-conforming markup will often result in non-conforming DOMs when parsed.

  2. `作動中の整形~要素たちを再構築する$ ◎ Reconstruct the active formatting elements, if any.
  3. %要素 ~LET `要素を挿入する$( 現token ) ◎ Insert an HTML element for the token.\
  4. `作動中の整形~要素~listに~pushする$( %要素 ) ◎ Push onto the list of active formatting elements that element.
開始tag { `b^l, `big^l, `code^l, `em^l, `font^l, `i^l, `s^l, `small^l, `strike^l, `strong^l, `tt^l, `u^l } ◎ A start tag whose tag name is one of: "b", "big", "code", "em", "font", "i", "s", "small", "strike", "strong", "tt", "u"
  1. `作動中の整形~要素たちを再構築する$ ◎ Reconstruct the active formatting elements, if any.
  2. %要素 ~LET `要素を挿入する$( 現token ) ◎ Insert an HTML element for the token.\
  3. `作動中の整形~要素~listに~pushする$( %要素 ) ◎ Push onto the list of active formatting elements that element.
開始tag { `nobr^l } ◎ A start tag whose tag name is "nobr"
  1. `作動中の整形~要素たちを再構築する$ ◎ Reconstruct the active formatting elements, if any.
  2. ~IF[ `視野~内$に在る( `既定の視野$, `nobr^e ) ]:

    1. `~perror$
    2. `養子縁組~algo$を走らす( 現token )
    3. `作動中の整形~要素たちを再構築する$
    ◎ If the stack of open elements has a nobr element in scope, then this is a parse error; run the adoption agency algorithm for the token, then once again reconstruct the active formatting elements, if any.
  3. %要素 ~LET `要素を挿入する$( 現token ) ◎ Insert an HTML element for the token.\
  4. `作動中の整形~要素~listに~pushする$( %要素 ) ◎ Push onto the list of active formatting elements that element.
終了tag { `a^l, `b^l, `big^l, `code^l, `em^l, `font^l, `i^l, `nobr^l, `s^l, `small^l, `strike^l, `strong^l, `tt^l, `u^l } ◎ An end tag whose tag name is one of: "a", "b", "big", "code", "em", "font", "i", "nobr", "s", "small", "strike", "strong", "tt", "u"
  1. `養子縁組~algo$を走らす( 現token )
◎ Run the adoption agency algorithm for the token.
開始tag { `applet^l, `marquee^l, `object^l } ◎ A start tag whose tag name is one of: "applet", "marquee", "object"
  1. `作動中の整形~要素たちを再構築する$ ◎ Reconstruct the active formatting elements, if any.
  2. `要素を挿入する$( 現token ) ◎ Insert an HTML element for the token.
  3. `作動中の整形~要素~list$に`~marker$を付加する ◎ Insert a marker at the end of the list of active formatting elements.
  4. `~frameset-ok~flag$ ~SET `not-ok^i ◎ Set the frameset-ok flag to "not ok".
終了tag { `applet^l, `marquee^l, `object^l } ◎ An end tag token whose tag name is one of: "applet", "marquee", "object"
  1. ~IF[ `視野~内$に無い( `既定の視野$, 現tokenと~tag名が同じ`~HTML要素$ ) ]:

    1. `~perror$
    2. ~RET — 現tokenは無視する
    ◎ If the stack of open elements does not have an element in scope that is an HTML element with the same tag name as that of the token, then this is a parse error; ignore the token. ◎ Otherwise, run these steps:
  2. `暗黙の終了tagたちを生成する$() ◎ Generate implied end tags.
  3. ~IF[ `現在の~node$は[ 現tokenと~tag名が同じ`~HTML要素$ ]ではない ] ⇒ `~perror$ ◎ If the current node is not an HTML element with the same tag name as that of the token, then this is a parse error.
  4. 現tokenと~tag名が同じ`~HTML要素$が`出るまで~open要素~stackから~popする$ ◎ Pop elements from the stack of open elements until an HTML element with the same tag name as the token has been popped from the stack.
  5. `作動中の整形~要素~listを最後の~markerまで~clearする$ ◎ Clear the list of active formatting elements up to the last marker.
開始tag { `table^l } ◎ A start tag whose tag name is "table"
  1. ~IF[ `文書$の`~mode$doc ~NEQ `quirks^l ]~AND[ `視野~内$に在る( `~button視野$, `p^e ) ] ⇒ `~p要素を閉じる$ ◎ If the Document is not set to quirks mode, and the stack of open elements has a p element in button scope, then close a p element.
  2. `要素を挿入する$( 現token ) ◎ Insert an HTML element for the token.
  3. `~frameset-ok~flag$ ~SET `not-ok^i ◎ Set the frameset-ok flag to "not ok".
  4. `挿入~mode$ ~SET `~table内$md ◎ Switch the insertion mode to "in table".
終了tag { `br^l } ◎ An end tag whose tag name is "br"
  1. `~perror$
  2. 現token ~SET 新たな開始tag~token( `br^l ) とする下で,現tokenを再処理する
◎ Parse error. Drop the attributes from the token, and act as described in the next entry; i.e. act as if this was a "br" start tag token with no attributes, rather than the end tag token that it actually is.
開始tag { `area^l, `br^l, `embed^l, `img^l, `keygen^l, `wbr^l } ◎ A start tag whose tag name is one of: "area", "br", "embed", "img", "keygen", "wbr"
  1. `作動中の整形~要素たちを再構築する$ ◎ Reconstruct the active formatting elements, if any.
  2. `要素を挿入する$( 現token ) ◎ Insert an HTML element for the token.\
  3. `~open要素~stack$から~popする ◎ Immediately pop the current node off the stack of open elements.
  4. ~IF[ 現tokenの`自己閉じ~flag$ ~EQ ~ON ] ⇒ `自己閉じ~flagを承認する$( 現token ) ◎ Acknowledge the token's self-closing flag, if it is set.
  5. `~frameset-ok~flag$ ~SET `not-ok^i ◎ Set the frameset-ok flag to "not ok".
開始tag { `input^l } ◎ A start tag whose tag name is "input"
  1. `作動中の整形~要素たちを再構築する$ ◎ Reconstruct the active formatting elements, if any.
  2. `要素を挿入する$( 現token ) ◎ Insert an HTML element for the token.\
  3. `~open要素~stack$から~popする ◎ Immediately pop the current node off the stack of open elements.
  4. ~IF[ 現tokenの`自己閉じ~flag$ ~EQ ~ON ] ⇒ `自己閉じ~flagを承認する$( 現token ) ◎ Acknowledge the token's self-closing flag, if it is set.
  5. ~IF[ 現token上に次を満たす属性はある ]…

    • 名前 ~EQ `type^l
    • 値 ~EQ`大小無視$sub `hidden^l

    …ならば ⇒ ~RET

    ◎ If the token does not have an attribute with the name "type", or if it does, but that attribute's value is not an ASCII case-insensitive match for the string "hidden", then:\
  6. `~frameset-ok~flag$ ~SET `not-ok^i ◎ set the frameset-ok flag to "not ok".
開始tag { `param^l, `source^l, `track^l } ◎ A start tag whose tag name is one of: "param", "source", "track"
  1. `要素を挿入する$( 現token ) ◎ Insert an HTML element for the token.\
  2. `~open要素~stack$から~popする ◎ Immediately pop the current node off the stack of open elements.
  3. ~IF[ 現tokenの`自己閉じ~flag$ ~EQ ~ON ] ⇒ `自己閉じ~flagを承認する$( 現token ) ◎ Acknowledge the token's self-closing flag, if it is set.
開始tag { `hr^l } ◎ A start tag whose tag name is "hr"
  1. ~IF[ `視野~内$に在る( `~button視野$, `p^e ) ] ⇒ `~p要素を閉じる$ ◎ If the stack of open elements has a p element in button scope, then close a p element.
  2. `要素を挿入する$( 現token ) ◎ Insert an HTML element for the token.\
  3. `~open要素~stack$から~popする ◎ Immediately pop the current node off the stack of open elements.
  4. ~IF[ 現tokenの`自己閉じ~flag$ ~EQ ~ON ] ⇒ `自己閉じ~flagを承認する$( 現token ) ◎ Acknowledge the token's self-closing flag, if it is set.
  5. `~frameset-ok~flag$ ~SET `not-ok^i ◎ Set the frameset-ok flag to "not ok".
開始tag { `image^l } ◎ A start tag whose tag name is "image"
  1. `~perror$
  2. 現tokenの~tag名 ~SET `img^l
  3. 現tokenを再処理する

Don’t ask. 【わけは聞かないでくれ?】

◎ Parse error. Change the token's tag name to "img" and reprocess it. (Don't ask.)
開始tag { `textarea^l } ◎ A start tag whose tag name is "textarea" ◎ Run these steps:
  1. `要素を挿入する$( 現token ) ◎ Insert an HTML element for the token.
  2. `次n~LF文字~tokenは無視するようにしておく$ ◎ If the next token is a U+000A LINE FEED (LF) character token, then ignore that token and move on to the next one. (Newlines at the start of textarea elements are ignored as an authoring convenience.)
  3. ~tokenizerを `~RCDATA$st に`切替える$ ◎ Switch the tokenizer to the RCDATA state.
  4. `元の挿入~mode$V ~LET 現在の`挿入~mode$ ◎ Let the original insertion mode be the current insertion mode.
  5. `~frameset-ok~flag$ ~SET `not-ok^i ◎ Set the frameset-ok flag to "not ok".
  6. `挿入~mode$ ~SET `~text$md ◎ Switch the insertion mode to "text".
開始tag { `xmp^l } ◎ A start tag whose tag name is "xmp"
  1. ~IF[ `視野~内$に在る( `~button視野$, `p^e ) ] ⇒ `~p要素を閉じる$ ◎ If the stack of open elements has a p element in button scope, then close a p element.
  2. `作動中の整形~要素たちを再構築する$ ◎ Reconstruct the active formatting elements, if any.
  3. `~frameset-ok~flag$ ~SET `not-ok^i ◎ Set the frameset-ok flag to "not ok".
  4. `生~text要素の汎用~構文解析~algo$に従う ◎ Follow the generic raw text element parsing algorithm.
開始tag { `iframe^l } ◎ A start tag whose tag name is "iframe"
  1. `~frameset-ok~flag$ ~SET `not-ok^i ◎ Set the frameset-ok flag to "not ok".
  2. `生~text要素の汎用~構文解析~algo$に従う ◎ Follow the generic raw text element parsing algorithm.
開始tag { `noembed^l } ◎ A start tag whose tag name is "noembed"
  1. `生~text要素の汎用~構文解析~algo$に従う
◎ ↓
開始tag { `noscript^l } ◎ A start tag whose tag name is "noscript", if the scripting flag is enabled
  1. ~IF[ `~scripting~flag$ ~NEQ `可能化^i ] ⇒ ~GOTO その他の開始tag
  2. `生~text要素の汎用~構文解析~algo$に従う
◎ Follow the generic raw text element parsing algorithm.
開始tag { `select^l } ◎ A start tag whose tag name is "select"
  1. `作動中の整形~要素たちを再構築する$ ◎ Reconstruct the active formatting elements, if any.
  2. `要素を挿入する$( 現token ) ◎ Insert an HTML element for the token.
  3. `~frameset-ok~flag$ ~SET `not-ok^i ◎ Set the frameset-ok flag to "not ok".
  4. `挿入~mode$ ~SET [ `挿入~mode$ ~IN { `~table内$md, `~caption内$md, `~table~body内$md, `~row内$md, `~cell内$md } ならば `~table内~select内$md / ~ELSE_ `~select内$md ] ◎ If the insertion mode is one of "in table", "in caption", "in table body", "in row", or "in cell", then switch the insertion mode to "in select in table". Otherwise, switch the insertion mode to "in select".
開始tag { `optgroup^l, `option^l } ◎ A start tag whose tag name is one of: "optgroup", "option"
  1. ~IF[ `現在の~node$ は `option$e 要素である ] ⇒ `~open要素~stack$から~popする ◎ If the current node is an option element, then pop the current node off the stack of open elements.
  2. `作動中の整形~要素たちを再構築する$ ◎ Reconstruct the active formatting elements, if any.
  3. `要素を挿入する$( 現token ) ◎ Insert an HTML element for the token.
開始tag { `rb^l, `rtc^l } ◎ A start tag whose tag name is one of: "rb", "rtc"
  1. ~IF[ `視野~内$に在る( `既定の視野$, `ruby^e ) ]:

    1. `暗黙の終了tagたちを生成する$()
    2. ~IF[ `現在の~node$は `ruby$e 要素でない ] ⇒ `~perror$
    ◎ If the stack of open elements has a ruby element in scope, then generate implied end tags. If the current node is not now a ruby element, this is a parse error.
  2. `要素を挿入する$( 現token ) ◎ Insert an HTML element for the token.
開始tag { `rp^l, `rt^l } ◎ A start tag whose tag name is one of: "rp", "rt"
  1. ~IF[ `視野~内$に在る( `既定の視野$, `ruby^e ) ]:

    1. `暗黙の終了tagたちを生成する$( `rtc$e )
    2. ~IF[ `現在の~node$は[ `rtc$e / `ruby$e ]要素でない ] ⇒ `~perror$
    ◎ If the stack of open elements has a ruby element in scope, then generate implied end tags, except for rtc elements. If the current node is not now a rtc element or a ruby element, this is a parse error.
  2. `要素を挿入する$( 現token ) ◎ Insert an HTML element for the token.
開始tag { `math^l } ◎ A start tag whose tag name is "math"
  1. `作動中の整形~要素たちを再構築する$ ◎ Reconstruct the active formatting elements, if any.
  2. `~MathML属性たちを調整する$( 現token ) (これは、~MathML属性に非~小文字が含まれている事例を修正する。) ◎ Adjust MathML attributes for the token. (This fixes the case of MathML attributes that are not all lowercase.)
  3. `外来の属性たちを調整する$( 現token ) (これは、名前空間~付きの属性の利用 — 特に~XLink — を修正する。) ◎ Adjust foreign attributes for the token. (This fixes the use of namespaced attributes, in particular XLink.)
  4. `要素を挿入する$( 現token, `~MathML名前空間$ ) ◎ Insert a foreign element for the token, in the MathML namespace.
  5. ~IF[ 現tokenの`自己閉じ~flag$ ~EQ ~ON ]:

    1. `~open要素~stack$から~popする
    2. `自己閉じ~flagを承認する$( 現token )
    ◎ If the token has its self-closing flag set, pop the current node off the stack of open elements and acknowledge the token's self-closing flag.
開始tag { `svg^l } ◎ A start tag whose tag name is "svg"
  1. `作動中の整形~要素たちを再構築する$ ◎ Reconstruct the active formatting elements, if any.
  2. `~SVG属性たちを調整する$( 現token ) (これは、~SVG属性に非~小文字が含まれている事例を修正する。) ◎ Adjust SVG attributes for the token. (This fixes the case of SVG attributes that are not all lowercase.)
  3. `外来の属性たちを調整する$( 現token ) (これは、名前空間~付きの属性の利用 — 特に~SVGにおける~XLink — を修正する。) ◎ Adjust foreign attributes for the token. (This fixes the use of namespaced attributes, in particular XLink in SVG.)
  4. `要素を挿入する$( 現token, `~SVG名前空間$ ) ◎ Insert a foreign element for the token, in the SVG namespace.
  5. ~IF[ 現tokenの`自己閉じ~flag$ ~EQ ~ON ]:

    1. `~open要素~stack$から~popする
    2. `自己閉じ~flagを承認する$( 現token )
    ◎ If the token has its self-closing flag set, pop the current node off the stack of open elements and acknowledge the token's self-closing flag.
開始tag { `caption^l, `col^l, `colgroup^l, `frame^l, `head^l, `tbody^l, `td^l, `tfoot^l, `th^l, `thead^l, `tr^l } ◎ A start tag whose tag name is one of: "caption", "col", "colgroup", "frame", "head", "tbody", "td", "tfoot", "th", "thead", "tr"
  1. `~perror$ — 現tokenは無視する
◎ Parse error. Ignore the token.
その他の開始tag ◎ Any other start tag
  1. `作動中の整形~要素たちを再構築する$ ◎ Reconstruct the active formatting elements, if any.
  2. `要素を挿入する$( 現token ) ◎ Insert an HTML element for the token.

    注記: この要素は、`普通の要素$になる。 ◎ This element will be an ordinary element.

その他の終了tag ◎ Any other end tag ◎ Run these steps:
  1. `~open要素~stack$内の~EACH( %~node ) に対し,末尾から順に: ◎ Initialize node to be the current node (the bottommost node of the stack).

    1. ~IF[ %~node は現tokenと~tag名が同じ`~HTML要素$である ]: ◎ Loop: If node is an HTML element with the same tag name as the token, then:

      1. `暗黙の終了tagたちを生成する$( 現tokenと~tag名が同じ`~HTML要素$ ) ◎ Generate implied end tags, except for HTML elements with the same tag name as the token.
      2. ~IF[ %~node は`現在の~node$でない ] ⇒ `~perror$ ◎ If node is not the current node, then this is a parse error.
      3. %~node が`出るまで~open要素~stackから~popする$ ◎ Pop all the nodes from the current node up to node, including node, then stop these steps.
      4. ~RET
    2. ~IF[ %~node は`特別$である ]:

      1. `~perror$
      2. ~RET — 現tokenは無視する
      ◎ Otherwise, if node is in the special category, then this is a parse error; ignore the token, and return. ◎ Set node to the previous entry in the stack of open elements. ◎ Return to the step labeled loop.

上の手続きにおいて `次n~LF文字~tokenは無視するようにしておく@ と記された所では、次回に発された~tokenが次を満たす場合には,それは無視する(飛ばす)ようにしておくことを意味する ⇒ 文字~tokenであって,その文字 ~EQ `000A^U である ◎ ↑↑

(これは,著作~利便のため、[ `pre$e ~block / `textarea$e 要素 ]の始端にある改行文字を無視するためにある。) ◎ ↑↑

上の手続きにおいて `~p要素を閉じる@ ときは、次を走らせ~MUST: ◎ When the steps above say the user agent is to close a p element, it means that the user agent must run the following steps:

  1. `暗黙の終了tagたちを生成する$( `p$e ) ◎ Generate implied end tags, except for p elements.
  2. ~IF[ `現在の~node$は `p$e 要素でない ] ⇒ `~perror$ ◎ If the current node is not a p element, then this is a parse error.
  3. `p$e 要素が`出るまで~open要素~stackから~popする$ ◎ Pop elements from the stack of open elements until a p element has been popped from the stack.

`養子縁組~algo@ は、所与の~token %~token に対し,次を走らす: ◎ The adoption agency algorithm, which takes as its only argument a token token for which the algorithm is being run, consists of the following steps:

  1. %整形~要素~list ~LET `作動中の整形~要素~list$
  2. ~IF[ `現在の~node$は`~HTML要素$である ]~AND[ `現在の~node$の~tag名 ~EQ %~token の~tag名 ]~AND[ `現在の~node$ ~NIN %整形~要素~list ]:

    1. `~open要素~stack$から~popする
    2. ~RET
    ◎ Let subject be token's tag name. ◎ If the current node is an HTML element whose tag name is subject, and the current node is not in the list of active formatting elements, then pop the current node off the stack of open elements, and return.
  3. %外縁~loop~counter ~LET 0 ◎ Let outer loop counter be zero.
  4. ~WHILE[ %外縁~loop~counter ~LT 8 ]: ◎ Outer loop: If outer loop counter is greater than or equal to eight, then return.

    1. %外縁~loop~counter ~INCBY 1 ◎ Increment outer loop counter by one.
    2. %整形~要素 ~LET %整形~要素~list 内に次を満たす要素が[ 在れば それらのうち最後のもの/ 無ければ ε ]: ◎ Let formatting element be the last element in the list of active formatting elements that:

      • %整形~要素~list 内の要素より後には`~marker$はない ◎ is between the end of the list and the last marker in the list, if any, or the start of the list otherwise, and
      • 要素の~tag名 ~EQ %~token の~tag名 ◎ has the tag name subject.
    3. ~IF[ %整形~要素 ~EQ ε ]:

      1. 上に述べた “その他の終了tag” と同じに動作する
      2. ~RET
      ◎ If there is no such element, then return and instead act as described in the "any other end tag" entry above.
    4. ~IF[ %整形~要素 ~NIN `~open要素~stack$ ]:

      1. `~perror$
      2. %整形~要素~list から %整形~要素 を除去する
      3. ~RET
      ◎ If formatting element is not in the stack of open elements, then this is a parse error; remove the element from the list, and return.
    5. ~IF[ `視野~内$に無い( `既定の視野$, %整形~要素 ) ]:

      1. `~perror$
      2. ~RET
      ◎ If formatting element is in the stack of open elements, but the element is not in scope, then this is a parse error; return.
    6. ~IF[ %整形~要素 ~NEQ `現在の~node$ ] ⇒ `~perror$ ◎ If formatting element is not the current node, this is a parse error. (But do not return.)
    7. %最遠の~block ~LET `~open要素~stack$内で %整形~要素 より後に`特別な要素$が[ 在れば それらのうち最初のもの / 無ければ ε ] ◎ Let furthest block be the topmost node in the stack of open elements that is lower in the stack than formatting element, and is an element in the special category. There might not be one.
    8. ~IF[ %最遠の~block ~EQ ε ]:

      1. %整形~要素 が`出るまで~open要素~stackから~popする$
      2. %整形~要素~list から %整形~要素 を除去する
      3. ~RET
      ◎ If there is no furthest block, then the UA must first pop all the nodes from the bottom of the stack of open elements, from the current node up to and including formatting element, then remove formatting element from the list of active formatting elements, and finally return.
    9. %共通の先祖 ~LET `~open要素~stack$内で %整形~要素 の直前にある要素 ◎ Let common ancestor be the element immediately above formatting element in the stack of open elements.
    10. %~bookmark ~LET %整形~要素~list 内で %整形~要素 の直後を指す位置 ◎ Let a bookmark note the position of formatting element in the list of active formatting elements relative to the elements on either side of it in the list.
    11. %最後の~node ~LET %最遠の~block ◎ Let node and last node be furthest block. Follow these steps: ↓↓
    12. %内縁~loop~counter ~LET 0 ◎ Let inner loop counter be zero.
    13. `~open要素~stack$内で %整形~要素 より後にある, かつ %最遠の~block より前にある ~EACH( %~node ) に対し,最後のものから順に: ◎ Inner loop: Increment inner loop counter by one. ◎ Let node be the element immediately above node in the stack of open elements, or if node is no longer in the stack of open elements (e.g. because it got removed by this algorithm), the element that was immediately above node in the stack of open elements before node was removed. ◎ If node is formatting element, then go to the next step in the overall algorithm.

      1. %内縁~loop~counter ~INCBY 1 ◎ ↑
      2. ~IF[ %内縁~loop~counter ~GT 3 ]~AND[ %~node ~IN %整形~要素~list ] ⇒ %整形~要素~list から %~node を除去する ◎ If inner loop counter is greater than three and node is in the list of active formatting elements, then remove node from the list of active formatting elements.
      3. ~IF[ %~node ~NIN %整形~要素~list ]:

        1. %~node を`~open要素~stack$から除去する
        2. ~CONTINUE
        ◎ If node is not in the list of active formatting elements, then remove node from the stack of open elements and then go back to the step labeled inner loop.
      4. %新たな要素 ~LET `~tokenから要素を作成する$( 要素 %~node を`作成させた~token$, `~HTML名前空間$, %共通の先祖 ) ◎ Create an element for the token for which the element node was created, in the HTML namespace, with common ancestor as the intended parent;\
      5. %整形~要素~list 内で %~node を %新たな要素 に置換する ◎ replace the entry for node in the list of active formatting elements with an entry for the new element,\
      6. `~open要素~stack$内で %~node を %新たな要素 に置換する ◎ replace the entry for node in the stack of open elements with an entry for the new element, and\
      7. %~node ~SET %新たな要素 ◎ let node be the new element.
      8. ~IF[ %最後の~node ~EQ %最遠の~block ] ⇒ %~bookmark ~SET %整形~要素~list 内で %~node の直後を指す位置 ◎ If last node is furthest block, then move the aforementioned bookmark to be immediately after the new node in the list of active formatting elements.
      9. ~IF[ %最後の~node の親~nodeはある ] ⇒ %最後の~node を親~nodeから除去する ◎ ↓
      10. %最後の~node を %~node の中に挿入する ◎ Insert last node into node, first removing it from its previous parent node if any.
      11. %最後の~node ~SET %~node ◎ Let last node be node. ◎ Return to the step labeled inner loop.
    14. %最後の~node を`適切な~node挿入-先$( %共通の先祖 ) に挿入する — この段に達した時点での %最後の~node が何であれ ◎ Insert whatever last node ended up being in the previous step at the appropriate place for inserting a node, but using common ancestor as the override target.
    15. %新たな要素 ~LET `~tokenから要素を作成する$( %整形~要素 を`作成させた~token$, `~HTML名前空間$, %最遠の~block ) ◎ Create an element for the token for which formatting element was created, in the HTML namespace, with furthest block as the intended parent.
    16. %最遠の~block 内の~EACH( 子~node %子 ) に対し:

      1. %最遠の~block から %子 を除去する
      2. %新たな要素 に %子 を付加する
      ◎ Take all of the child nodes of furthest block and append them to the element created in the last step.
    17. %最遠の~block に %新たな要素 を付加する ◎ Append that new element to furthest block.
    18. %整形~要素 を %整形~要素~list から除去する ◎ Remove formatting element from the list of active formatting elements, and\
    19. %整形~要素~list 内で %~bookmark が指す位置に, %新たな要素 を挿入する ◎ insert the new element into the list of active formatting elements at the position of the aforementioned bookmark.
    20. %整形~要素 を`~open要素~stack$から除去する ◎ Remove formatting element from the stack of open elements, and\
    21. `~open要素~stack$内で %最遠の~block の直後に, %新たな要素 を挿入する ◎ insert the new element into the stack of open elements immediately below the position of furthest block in that stack. ◎ Jump back to the step labeled outer loop.

注記: この~algoの名前 “養子縁組” は、それが要素の親を変更する仕方に~~由来する — 誤入子な内容を取り扱う~algoの ~~候補は他にもあったが。 ◎ This algorithm's name, the "adoption agency algorithm", comes from the way it causes elements to change parents, and is in contrast with other possible algorithms for dealing with misnested content.

12.2.6.4.8. `~text^md

[ `挿入~mode$ ~EQ `~text$md ]の下では、現tokenを以下に従って取扱わ~MUST: ◎ When the user agent is to apply the rules for the "text" insertion mode, the user agent must handle the token as follows:

文字~token ◎ A character token
  1. `文字を挿入する$( 現tokenの文字 )
◎ Insert the token's character.
注記: この~tokenの文字が、 `0000^U になることは決してない — そのような文字は、~tokenizerにより `FFFD^U に変換されるので。 ◎ This can never be a U+0000 NULL character; the tokenizer converts those to U+FFFD REPLACEMENT CHARACTER characters.
~eof~token ◎ An end-of-file token
  1. `~perror$ ◎ Parse error.
  2. ~IF[ `現在の~node$は `script$e 要素である ] ⇒ `現在の~node$の`開始済み~flag$ ~SET ~ON ◎ If the current node is a script element, mark the script element as "already started".
  3. `~open要素~stack$から~popする ◎ Pop the current node off the stack of open elements.
  4. `挿入~mode$ ~SET `元の挿入~mode$V ◎ Switch the insertion mode to the original insertion mode and\
  5. 現tokenを再処理する ◎ reprocess the token.
終了tag { `script^l } ◎ An end tag whose tag name is "script"
  1. ~IF[ `~JS実行~文脈~stack$は空である ] ⇒ `小task~checkpointを遂行する$ ◎ If the JavaScript execution context stack is empty, perform a microtask checkpoint.
  2. %~script ~LET `現在の~node$ ◎ Let script be the current node\
  3. ~Assert: %~script は `script$e 要素である ◎ (which will be a script element).
  4. `~open要素~stack$から~popする ◎ Pop the current node off the stack of open elements.
  5. `挿入~mode$ ~SET `元の挿入~mode$V ◎ Switch the insertion mode to the original insertion mode.
  6. %旧~挿入~地点~LET 現在の`挿入~地点$ ◎ Let the old insertion point have the same value as the current insertion point.\
  7. `挿入~地点$ ~SET `次n入力~文字$の直前 ◎ Let the insertion point be just before the next input character.
  8. %構文解析器 の`~script入子~level$ ~INCBY 1 ◎ Increment the parser's script nesting level by one.
  9. %~script を`準備-$する ⇒ これは何らかの~scriptを実行させ得る — その結果 ⇒ ~tokenizerに 新たな文字たちが挿入され得る — その結果 ⇒ ~tokenizerにさらに~tokenたちを出力させ得る — その結果 ⇒ %構文解析器 は再入的に呼出される ◎ Prepare the script. This might cause some script to execute, which might cause new characters to be inserted into the tokenizer, and might cause the tokenizer to output more tokens, resulting in a reentrant invocation of the parser.
  10. %構文解析器 の`~script入子~level$ ~DECBY 1 ◎ Decrement the parser's script nesting level by one.\
  11. ~IF[ %構文解析器 の`~script入子~level$ ~EQ 0 ] ⇒ %構文解析器 の`静止~flag$ ~SET ~F ◎ If the parser's script nesting level is zero, then set the parser pause flag to false.
  12. `挿入~地点$ ~SET %旧~挿入~地点 ◎ Let the insertion point have the value of the old insertion point. (In other words, restore the insertion point to its previous value. This value might be the "undefined" value.)
  13. ~IF[ `文書$の`構文解析器を阻んでいる~script$ ~EQ ε ] ⇒ ~RET ◎ At this stage, if there is a pending parsing-blocking script, then:
  14. ~IF[ `~script入子~level$ ~NEQ 0 ]: ◎ If the script nesting level is not zero:

    1. %構文解析器 の`静止~flag$ ~SET ~T ◎ Set the parser pause flag to true, and\
    2. 入子で呼出されている~tokenizerがあれば その処理も中止して、その~call元に制御を明け渡す(~token化は、~call元が “外縁の” 木~構築~段階に戻ったとき,再開することになる。) ◎ abort the processing of any nested invocations of the tokenizer, yielding control back to the caller. (Tokenization will resume when the caller returns to the "outer" tree construction stage.)

      注記: %構文解析器 の木~構築~段階は、 再入的に~callされている — 例えば `document.write()$m の~callから。 ◎ The tree construction stage of this particular parser is being called reentrantly, say from a call to document.write().

    3. ~RET ◎ Otherwise: • Run these steps:
  15. %当の~script ~LET `文書$の`構文解析器を阻んでいる~script$ ◎ Let the script be the pending parsing-blocking script.\
  16. `文書$の`構文解析器を阻んでいる~script$ ~SET ε ◎ There is no longer a pending parsing-blocking script.
  17. %構文解析器 の`~tokenizer$を阻む — `~event~loop$が その`~tokenizer$を呼出す`~task$を走らすことのないよう ◎ Block the tokenizer for this instance of the HTML parser, such that the event loop will not run tasks that invoke the tokenizer.
  18. ~IF[ 次のいずれかの条件は満たされていない ]…:

    • `文書$には`~scriptを阻んでいる~stylesheetは無い$
    • %当の~script の`解析器実行準備済み~flag$ ~EQ ~ON

    …ならば ⇒ これらの条件がいずれも満たされるまで`~event~loopを回す$

    ◎ If the parser's Document has a style sheet that is blocking scripts or the script's "ready to be parser-executed" flag is not set: spin the event loop until the parser's Document has no style sheet that is blocking scripts and the script's "ready to be parser-executed" flag is set.
  19. ~IF[ %構文解析器 は(当面の間)`中止-$されている ] ⇒ ~RET ◎ If this parser has been aborted in the meantime, return.

    注記: これは,例えば、`~event~loopを回す$~algoが走っている間に,[ `文書$が`属する閲覧文脈$が閉じられた / `文書$上で `document.open(type, replace)$m ~methodが呼出された ]場合に起こり得る。 ◎ This could happen if, e.g., while the spin the event loop algorithm is running, the browsing context gets closed, or the document.open(type, replace) method gets invoked on the Document.

  20. %構文解析器 の`~tokenizer$を阻むのをやめて、`~tokenizer$を呼出している`~task$が,再度~走れるようにする ◎ Unblock the tokenizer for this instance of the HTML parser, such that tasks that invoke the tokenizer can again be run.
  21. `挿入~地点$ ~SET `次n入力~文字$の直前 ◎ Let the insertion point be just before the next input character.
  22. ~Assert: %構文解析器 の`~script入子~level$ ~EQ 0 であるべき ◎ ↓
  23. %構文解析器 の`~script入子~level$ ~INCBY 1 ◎ Increment the parser's script nesting level by one (it should be zero before this step, so this sets it to one).
  24. %当の~script の`~script~blockを実行する$ ◎ Execute the script.
  25. %構文解析器 の`~script入子~level$ ~DECBY 1 ◎ Decrement the parser's script nesting level by one.\
  26. ~Assert: %構文解析器 の`~script入子~level$ ~EQ 0 であるべき ◎ ↓
  27. ~IF[ %構文解析器 の`~script入子~level$ ~EQ 0 ] ⇒ %構文解析器 の`静止~flag$ ~SET ~F ◎ If the parser's script nesting level is zero (which it always should be at this point), then set the parser pause flag to false.
  28. `挿入~地点$ ~SET ε ◎ Let the insertion point be undefined again.
  29. ~IF[ `文書$の`構文解析器を阻んでいる~script$ ~NEQ ε ] ⇒ ~GOTO 最初の段 ◎ If there is once again a pending parsing-blocking script, then repeat these steps from step 1.
その他の終了tag ◎ Any other end tag
  1. `~open要素~stack$から~popする ◎ Pop the current node off the stack of open elements.
  2. `挿入~mode$ ~SET `元の挿入~mode$V ◎ Switch the insertion mode to the original insertion mode.
12.2.6.4.9. `~table内^md

[ `挿入~mode$ ~EQ `~table内$md ]の下では、現tokenを以下に従って取扱わ~MUST: ◎ When the user agent is to apply the rules for the "in table" insertion mode, the user agent must handle the token as follows:

文字~token ◎ A character token, \
  1. ~IF[ `現在の~node$は[ `table$e, `tbody$e, `tfoot$e, `thead$e, `tr$e ]のいずれの要素でもない ] ⇒ ~GOTO ~AnyElse ◎ if the current node is table, tbody, tfoot, thead, or tr element
  2. `処理待ち~table文字~token~list@V ~LET 空の~token~list ◎ Let the pending table character tokens be an empty list of tokens.
  3. `元の挿入~mode$V ~SET `~table内$md ◎ Let the original insertion mode be the current insertion mode.
  4. `挿入~mode$ ~SET `~table~text内$md ◎ Switch the insertion mode to "in table text" and\
  5. 現tokenを再処理する ◎ reprocess the token.
~comment~token ◎ A comment token
  1. `~commentを挿入する$( 現token )
◎ Insert a comment.
~DOCTYPE~token ◎ A DOCTYPE token
  1. `~perror$ — 現tokenは無視する
◎ Parse error. Ignore the token.
開始tag { `caption^l } ◎ A start tag whose tag name is "caption"
  1. `~stackを~table文脈まで遡って~clearする$ ◎ Clear the stack back to a table context. (See below.)
  2. `作動中の整形~要素~list$に`~marker$を付加する ◎ Insert a marker at the end of the list of active formatting elements.
  3. `要素を挿入する$( 現token ) ◎ Insert an HTML element for the token, then\
  4. `挿入~mode$ ~SET `~caption内$md ◎ switch the insertion mode to "in caption".
開始tag { `colgroup^l } ◎ A start tag whose tag name is "colgroup"
  1. `~stackを~table文脈まで遡って~clearする$ ◎ Clear the stack back to a table context. (See below.)
  2. `要素を挿入する$( 現token ) ◎ Insert an HTML element for the token, then\
  3. `挿入~mode$ ~SET `~column-group内$md ◎ switch the insertion mode to "in column group".
開始tag { `col^l } ◎ A start tag whose tag name is "col"
  1. `~stackを~table文脈まで遡って~clearする$ ◎ Clear the stack back to a table context. (See below.)
  2. `要素を挿入する$( 新たな開始tag~token( `colgroup^l ) ) ◎ Insert an HTML element for a "colgroup" start tag token with no attributes, then\
  3. `挿入~mode$ ~SET `~column-group内$md ◎ switch the insertion mode to "in column group".
  4. 現tokenを再処理する ◎ Reprocess the current token.
開始tag { `tbody^l, `tfoot^l, `thead^l } ◎ A start tag whose tag name is one of: "tbody", "tfoot", "thead"
  1. `~stackを~table文脈まで遡って~clearする$ ◎ Clear the stack back to a table context. (See below.)
  2. `要素を挿入する$( 現token ) ◎ Insert an HTML element for the token, then\
  3. `挿入~mode$ ~SET `~table~body内$md ◎ switch the insertion mode to "in table body".
開始tag { `td^l, `th^l, `tr^l } ◎ A start tag whose tag name is one of: "td", "th", "tr"
  1. `~stackを~table文脈まで遡って~clearする$ ◎ Clear the stack back to a table context. (See below.)
  2. `要素を挿入する$( 新たな開始tag~token( `tbody^l ) ) ◎ Insert an HTML element for a "tbody" start tag token with no attributes, then\
  3. `挿入~mode$ ~SET `~table~body内$md ◎ switch the insertion mode to "in table body".
  4. 現tokenを再処理する ◎ Reprocess the current token.
開始tag { `table^l } ◎ A start tag whose tag name is "table"
  1. `~perror$ ◎ Parse error.
  2. ~IF[ `視野~内$に無い( `~table視野$, `table^e ) ] ⇒ ~RET — 現tokenは無視する ◎ If the stack of open elements does not have a table element in table scope, ignore the token. ◎ Otherwise:
  3. `table$e 要素が`出るまで~open要素~stackから~popする$ ◎ Pop elements from this stack until a table element has been popped from the stack.
  4. `挿入~modeを適切に再設定する$ ◎ Reset the insertion mode appropriately.
  5. 現tokenを再処理する ◎ Reprocess the token.
終了tag { `table^l } ◎ An end tag whose tag name is "table"
  1. ~IF[ `視野~内$に無い( `~table視野$, `table^e ) ]:

    1. `~perror$
    2. ~RET — 現tokenは無視する
    ◎ If the stack of open elements does not have a table element in table scope, this is a parse error; ignore the token. ◎ Otherwise:
  2. `table$e 要素が`出るまで~open要素~stackから~popする$ ◎ Pop elements from this stack until a table element has been popped from the stack.
  3. `挿入~modeを適切に再設定する$ ◎ Reset the insertion mode appropriately.
終了tag { `body^l, `caption^l, `col^l, `colgroup^l, `html^l, `tbody^l, `td^l, `tfoot^l, `th^l, `thead^l, `tr^l } ◎ An end tag whose tag name is one of: "body", "caption", "col", "colgroup", "html", "tbody", "td", "tfoot", "th", "thead", "tr"
  1. `~perror$ — 現tokenは無視する
◎ Parse error. Ignore the token.
開始tag { `style^l, `script^l, `template^l } ◎ A start tag whose tag name is one of: "style", "script", "template"
終了tag { `template^l } ◎ An end tag whose tag name is "template"
  1. `~head内$md`用の規則を用いて$現tokenを処理する
◎ Process the token using the rules for the "in head" insertion mode.
開始tag { `input^l } ◎ A start tag whose tag name is "input"
  1. ~IF[ 現token上に次を満たす属性はない ]…

    • 名前 ~EQ `type^l
    • 値 ~EQ`大小無視$sub `hidden^l

    …ならば ⇒ ~GOTO ~AnyElse

    ◎ If the token does not have an attribute with the name "type", or if it does, but that attribute's value is not an ASCII case-insensitive match for the string "hidden", then: act as described in the "anything else" entry below. ◎ Otherwise:
  2. `~perror$ ◎ Parse error.
  3. `要素を挿入する$( 現token ) ◎ Insert an HTML element for the token.
  4. `~open要素~stack$から~popする ◎ Pop that input element off the stack of open elements.
  5. ~IF[ 現tokenの`自己閉じ~flag$ ~EQ ~ON ] ⇒ `自己閉じ~flagを承認する$( 現token ) ◎ Acknowledge the token's self-closing flag, if it is set.
開始tag { `form^l } ◎ A start tag whose tag name is "form"
  1. `~perror$ ◎ Parse error.
  2. ~IF[ `~open要素~stack$内には `template$e 要素はある ]~OR[ `~form要素~pointer$ ~NEQ ~NULL ] ⇒ ~RET — 現tokenは無視する ◎ If there is a template element on the stack of open elements, or if the form element pointer is not null, ignore the token. ◎ Otherwise:
  3. %要素 ~LET `要素を挿入する$( 現token ) ◎ Insert an HTML element for the token, and\
  4. `~form要素~pointer$ ~SET %要素 ◎ set the form element pointer to point to the element created.
  5. `~open要素~stack$から~popする ◎ Pop that form element off the stack of open elements.
~eof~token ◎ An end-of-file token
  1. `~body内$md`用の規則を用いて$現tokenを処理する
◎ Process the token using the rules for the "in body" insertion mode.
~AnyElse
  1. `~perror$ ◎ Parse error.\
  2. `親を違える$のを可能化する ◎ Enable foster parenting,\
  3. `~body内$md`用の規則を用いて$現tokenを処理する ◎ process the token using the rules for the "in body" insertion mode, and then\
  4. `親を違える$のを不能化する ◎ disable foster parenting.

上の手続きが `~stackを~table文脈まで遡って~clearする@ 所では、次を走らせ~MUST ⇒ ~WHILE[ `現在の~node$は[ `table$e / `template$e / `html$e ]要素でない ] ⇒ `~open要素~stack$から~popする ◎ When the steps above require the UA to clear the stack back to a table context, it means that the UA must, while the current node is not a table, template, or html element, pop elements from the stack of open elements.

注記: これは、`~table視野$に挙げられた要素たちと同じである。 ◎ This is the same list of elements as used in the has an element in table scope steps.

注記: この処理-後に`現在の~node$が `html$e 要素になるのは、`素片~事例$に限られる。 ◎ The current node being an html element after this process is a fragment case.

12.2.6.4.10. `~table~text内^md

[ `挿入~mode$ ~EQ `~table~text内$md ]の下では、現tokenを以下に従って取扱わ~MUST: ◎ When the user agent is to apply the rules for the "in table text" insertion mode, the user agent must handle the token as follows:

文字~token { `0000^U } ◎ A character token that is U+0000 NULL
  1. `~perror$ — 現tokenは無視する
◎ Parse error. Ignore the token.
その他の文字~token ◎ Any other character token
  1. `処理待ち~table文字~token~list$V に現tokenを付加する
◎ Append the character token to the pending table character tokens list.
~AnyElse
  1. ~IF[ `処理待ち~table文字~token~list$V 内の ある文字~tokenの文字は`~ASCII空白$でない ]:

    1. `~perror$
    2. `処理待ち~table文字~token~list$V 内の ~EACH( 文字~token ) に対し ⇒ 文字~tokenを[ `~table内$md 挿入~modeにおける ~AnyElse ~entryに与える規則 ]を利用して再処理する
    ◎ If any of the tokens in the pending table character tokens list are character tokens that are not ASCII whitespace, then this is a parse error: reprocess the character tokens in the pending table character tokens list using the rules given in the "anything else" entry in the "in table" insertion mode.
  2. ~ELSE ⇒ `処理待ち~table文字~token~list$V 内の~EACH( ~token ) に対し ⇒ `文字を挿入する$( ~tokenの文字 ) ◎ Otherwise, insert the characters given by the pending table character tokens list.
  3. `挿入~mode$ ~SET `元の挿入~mode$V ◎ Switch the insertion mode to the original insertion mode and\
  4. 現tokenを再処理する ◎ reprocess the token.
12.2.6.4.11. `~caption内^md

[ `挿入~mode$ ~EQ `~caption内$md ]の下では、現tokenを以下に従って取扱わ~MUST: ◎ When the user agent is to apply the rules for the "in caption" insertion mode, the user agent must handle the token as follows:

終了tag { `caption^l } ◎ An end tag whose tag name is "caption"
  1. ~IF[ `視野~内$に無い( `~table視野$, `caption^e ) (`素片~事例$) ]:

    1. `~perror$
    2. ~RET — 現tokenは無視する
    ◎ If the stack of open elements does not have a caption element in table scope, this is a parse error; ignore the token. (fragment case) ◎ Otherwise:
  2. `暗黙の終了tagたちを生成する$() ◎ Generate implied end tags.
  3. ~IF[ `現在の~node$は `caption$e 要素でない ] ⇒ `~perror$ ◎ Now, if the current node is not a caption element, then this is a parse error.
  4. `caption$e 要素が`出るまで~open要素~stackから~popする$ ◎ Pop elements from this stack until a caption element has been popped from the stack.
  5. `作動中の整形~要素~listを最後の~markerまで~clearする$ ◎ Clear the list of active formatting elements up to the last marker.
  6. `挿入~mode$ ~SET `~table内$md ◎ Switch the insertion mode to "in table".
開始tag { `caption^l, `col^l, `colgroup^l, `tbody^l, `td^l, `tfoot^l, `th^l, `thead^l, `tr^l } ◎ A start tag whose tag name is one of: "caption", "col", "colgroup", "tbody", "td", "tfoot", "th", "thead", "tr"
終了tag { `table^l } ◎ An end tag whose tag name is "table"
  1. ~IF[ `視野~内$に無い( `~table視野$, `caption^e ) (`素片~事例$) ]:

    1. `~perror$
    2. ~RET — 現tokenは無視する
    ◎ If the stack of open elements does not have a caption element in table scope, this is a parse error; ignore the token. (fragment case) ◎ Otherwise:
  2. `暗黙の終了tagたちを生成する$() ◎ Generate implied end tags.
  3. ~IF[ `現在の~node$は `caption$e 要素でない ] ⇒ `~perror$ ◎ Now, if the current node is not a caption element, then this is a parse error.
  4. `caption$e 要素が`出るまで~open要素~stackから~popする$ ◎ Pop elements from this stack until a caption element has been popped from the stack.
  5. `作動中の整形~要素~listを最後の~markerまで~clearする$ ◎ Clear the list of active formatting elements up to the last marker.
  6. `挿入~mode$ ~SET `~table内$md ◎ Switch the insertion mode to "in table".
  7. 現tokenを再処理する ◎ Reprocess the token.
終了tag { `body^l, `col^l, `colgroup^l, `html^l, `tbody^l, `td^l, `tfoot^l, `th^l, `thead^l, `tr^l } ◎ An end tag whose tag name is one of: "body", "col", "colgroup", "html", "tbody", "td", "tfoot", "th", "thead", "tr"
  1. `~perror$ — 現tokenは無視する
◎ Parse error. Ignore the token.
~AnyElse
  1. `~body内$md`用の規則を用いて$現tokenを処理する
◎ Process the token using the rules for the "in body" insertion mode.
12.2.6.4.12. `~column-group内^md

[ `挿入~mode$ ~EQ `~column-group内$md ]の下では、現tokenを以下に従って取扱わ~MUST: ◎ When the user agent is to apply the rules for the "in column group" insertion mode, the user agent must handle the token as follows:

文字~token { `~ASCII空白$ } ◎ 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
  1. `文字を挿入する$( 現tokenの文字 )
◎ Insert the character.
~comment~token ◎ A comment token
  1. `~commentを挿入する$( 現token )
◎ Insert a comment.
~DOCTYPE~token ◎ A DOCTYPE token
  1. `~perror$ — 現tokenは無視する
◎ Parse error. Ignore the token.
開始tag { `html^l } ◎ A start tag whose tag name is "html"
  1. `~body内$md`用の規則を用いて$現tokenを処理する
◎ Process the token using the rules for the "in body" insertion mode.
開始tag { `col^l } ◎ A start tag whose tag name is "col"
  1. `要素を挿入する$( 現token ) ◎ Insert an HTML element for the token.\
  2. `~open要素~stack$から~popする ◎ Immediately pop the current node off the stack of open elements.
  3. ~IF[ 現tokenの`自己閉じ~flag$ ~EQ ~ON ] ⇒ `自己閉じ~flagを承認する$( 現token ) ◎ Acknowledge the token's self-closing flag, if it is set.
終了tag { `colgroup^l } ◎ An end tag whose tag name is "colgroup"
  1. ~IF[ `現在の~node$は `colgroup$e 要素でない ]:

    1. `~perror$
    2. ~RET — 現tokenは無視する
    ◎ If the current node is not a colgroup element, then this is a parse error; ignore the token.
  2. `~open要素~stack$から~popする ◎ Otherwise, pop the current node from the stack of open elements.\
  3. `挿入~mode$ ~SET `~table内$md ◎ Switch the insertion mode to "in table".
終了tag { `col^l } ◎ An end tag whose tag name is "col"
  1. `~perror$ — 現tokenは無視する
◎ Parse error. Ignore the token.
開始tag { `template^l } ◎ A start tag whose tag name is "template"
終了tag { `template^l } ◎ An end tag whose tag name is "template"
  1. `~head内$md`用の規則を用いて$現tokenを処理する
◎ Process the token using the rules for the "in head" insertion mode.
~eof~token ◎ An end-of-file token
  1. `~body内$md`用の規則を用いて$現tokenを処理する
◎ Process the token using the rules for the "in body" insertion mode.
~AnyElse
  1. ~IF[ `現在の~node$は `colgroup$e 要素でない ]:

    1. `~perror$
    2. ~RET — 現tokenは無視する
    ◎ If the current node is not a colgroup element, then this is a parse error; ignore the token.
  2. `~open要素~stack$から~popする ◎ Otherwise, pop the current node from the stack of open elements.
  3. `挿入~mode$ ~SET `~table内$md ◎ Switch the insertion mode to "in table".
  4. 現tokenを再処理する ◎ Reprocess the token.
12.2.6.4.13. `~table~body内^md

[ `挿入~mode$ ~EQ `~table~body内$md ]の下では、現tokenを以下に従って取扱わ~MUST: ◎ When the user agent is to apply the rules for the "in table body" insertion mode, the user agent must handle the token as follows:

開始tag { `tr^l } ◎ A start tag whose tag name is "tr"
  1. `~stackを~table~body文脈まで遡って~clearする$ ◎ Clear the stack back to a table body context. (See below.)
  2. `要素を挿入する$( 現token ) ◎ Insert an HTML element for the token, then\
  3. `挿入~mode$ ~SET `~row内$md ◎ switch the insertion mode to "in row".
開始tag { `th^l, `td^l } ◎ A start tag whose tag name is one of: "th", "td"
  1. `~perror$ ◎ Parse error.
  2. `~stackを~table~body文脈まで遡って~clearする$ ◎ Clear the stack back to a table body context. (See below.)
  3. `要素を挿入する$( 新たな開始tag~token( `tr^l ) ) ◎ Insert an HTML element for a "tr" start tag token with no attributes, then\
  4. `挿入~mode$ ~SET `~row内$md ◎ switch the insertion mode to "in row".
  5. 現tokenを再処理する ◎ Reprocess the current token.
終了tag { `tbody^l, `tfoot^l, `thead^l } ◎ An end tag whose tag name is one of: "tbody", "tfoot", "thead"
  1. ~IF[ `視野~内$に無い( `~table視野$, 現tokenと~tag名が同じ`~HTML要素$ ) ]:

    1. `~perror$
    2. ~RET — 現tokenは無視する
    ◎ If the stack of open elements does not have an element in table scope that is an HTML element with the same tag name as the token, this is a parse error; ignore the token. ◎ Otherwise:
  2. `~stackを~table~body文脈まで遡って~clearする$ ◎ Clear the stack back to a table body context. (See below.)
  3. `~open要素~stack$から~popする ◎ Pop the current node from the stack of open elements.\
  4. `挿入~mode$ ~SET `~table内$md ◎ Switch the insertion mode to "in table".
開始tag { `caption^l, `col^l, `colgroup^l, `tbody^l, `tfoot^l, `thead^l } ◎ A start tag whose tag name is one of: "caption", "col", "colgroup", "tbody", "tfoot", "thead"
終了tag { `table^l } ◎ An end tag whose tag name is "table"
  1. ~IF[ `視野~内$に無い( `~table視野$, { `tbody^e, `thead^e, `tfoot^e } ) ]:

    1. `~perror$
    2. ~RET — 現tokenは無視する
    ◎ If the stack of open elements does not have a tbody, thead, or tfoot element in table scope, this is a parse error; ignore the token. ◎ Otherwise:
  2. `~stackを~table~body文脈まで遡って~clearする$ ◎ Clear the stack back to a table body context. (See below.)
  3. `~open要素~stack$から~popする ◎ Pop the current node from the stack of open elements.\
  4. `挿入~mode$ ~SET `~table内$md ◎ Switch the insertion mode to "in table".
  5. 現tokenを再処理する ◎ Reprocess the token.
終了tag { `body^l, `caption^l, `col^l, `colgroup^l, `html^l, `td^l, `th^l, `tr^l } ◎ An end tag whose tag name is one of: "body", "caption", "col", "colgroup", "html", "td", "th", "tr"
  1. `~perror$ — 現tokenは無視する
◎ Parse error. Ignore the token.
~AnyElse
  1. `~table内$md`用の規則を用いて$現tokenを処理する
◎ Process the token using the rules for the "in table" insertion mode.

上の手続きが `~stackを~table~body文脈まで遡って~clearする@ 所では、次を走らせ~MUST ⇒ ~WHILE[ `現在の~node$は[ `tbody$e / `tfoot$e / `thead$e / `template$e / `html$e ] 要素でない ] ⇒ `~open要素~stack$から~popする ◎ When the steps above require the UA to clear the stack back to a table body context, it means that the UA must, while the current node is not a tbody, tfoot, thead, template, or html element, pop elements from the stack of open elements.

注記: この処理-後に`現在の~node$が `html$e 要素になるのは、`素片~事例$に限られる。 ◎ The current node being an html element after this process is a fragment case.

12.2.6.4.14. `~row内^md

[ `挿入~mode$ ~EQ `~row内$md ]の下では、現tokenを以下に従って取扱わ~MUST: ◎ When the user agent is to apply the rules for the "in row" insertion mode, the user agent must handle the token as follows:

開始tag { `th^l, `td^l } ◎ A start tag whose tag name is one of: "th", "td"
  1. `~stackを~table~row文脈まで遡って~clearする$ ◎ Clear the stack back to a table row context. (See below.)
  2. `要素を挿入する$( 現token ) ◎ Insert an HTML element for the token, then\
  3. `挿入~mode$ ~SET `~cell内$md ◎ switch the insertion mode to "in cell".
  4. `作動中の整形~要素~list$に`~marker$を付加する ◎ Insert a marker at the end of the list of active formatting elements.
終了tag { `tr^l } ◎ An end tag whose tag name is "tr"
  1. ~IF[ `視野~内$に無い( `~table視野$, `tr^e ) ]:

    1. `~perror$
    2. ~RET — 現tokenは無視する
    ◎ If the stack of open elements does not have a tr element in table scope, this is a parse error; ignore the token. ◎ Otherwise:
  2. `~stackを~table~row文脈まで遡って~clearする$ ◎ Clear the stack back to a table row context. (See below.)
  3. ~Assert: `現在の~node$は `tr$e 要素である ◎ ↓
  4. `~open要素~stack$から~popする ◎ Pop the current node (which will be a tr element) from the stack of open elements.\
  5. `挿入~mode$ ~SET `~table~body内$md ◎ Switch the insertion mode to "in table body".
開始tag { `caption^l, `col^l, `colgroup^l, `tbody^l, `tfoot^l, `thead^l, `tr^l } ◎ A start tag whose tag name is one of: "caption", "col", "colgroup", "tbody", "tfoot", "thead", "tr"
終了tag { `table^l } ◎ An end tag whose tag name is "table"
  1. ~IF[ `視野~内$に無い( `~table視野$, `tr^e ) ]:

    1. `~perror$
    2. ~RET — 現tokenは無視する
    ◎ If the stack of open elements does not have a tr element in table scope, this is a parse error; ignore the token. ◎ Otherwise:
  2. `~stackを~table~row文脈まで遡って~clearする$ ◎ Clear the stack back to a table row context. (See below.)
  3. ~Assert: `現在の~node$は `tr$e 要素である ◎ ↓
  4. `~open要素~stack$から~popする ◎ Pop the current node (which will be a tr element) from the stack of open elements.\
  5. `挿入~mode$ ~SET `~table~body内$md ◎ Switch the insertion mode to "in table body".
  6. 現tokenを再処理する ◎ Reprocess the token.
終了tag { `tbody^l, `tfoot^l, `thead^l } ◎ An end tag whose tag name is one of: "tbody", "tfoot", "thead"
  1. ~IF[ `視野~内$に無い( `~table視野$, 現tokenと~tag名が同じ`~HTML要素$ ) ]:

    1. `~perror$
    2. ~RET — 現tokenは無視する
    ◎ If the stack of open elements does not have an element in table scope that is an HTML element with the same tag name as the token, this is a parse error; ignore the token.
  2. ~IF[ `視野~内$に無い( `~table視野$, `tr^e ) ] ⇒ ~RET — 現tokenは無視する ◎ If the stack of open elements does not have a tr element in table scope, ignore the token. ◎ Otherwise:
  3. `~stackを~table~row文脈まで遡って~clearする$ ◎ Clear the stack back to a table row context. (See below.)
  4. ~Assert: `現在の~node$は `tr$e 要素である ◎ ↓
  5. `~open要素~stack$から~popする ◎ Pop the current node (which will be a tr element) from the stack of open elements.\
  6. `挿入~mode$ ~SET `~table~body内$md ◎ Switch the insertion mode to "in table body".
  7. 現tokenを再処理する ◎ Reprocess the token.
終了tag { `body^l, `caption^l, `col^l, `colgroup^l, `html^l, `td^l, `th^l } ◎ An end tag whose tag name is one of: "body", "caption", "col", "colgroup", "html", "td", "th"
  1. `~perror$ — 現tokenは無視する
◎ Parse error. Ignore the token.
~AnyElse
  1. `~table内$md`用の規則を用いて$現tokenを処理する
◎ Process the token using the rules for the "in table" insertion mode.

上の手続きが `~stackを~table~row文脈まで遡って~clearする@ 所では、次を走らせ~MUST ⇒ ~WHILE[ `現在の~node$は[ `tr$e / `template$e / `html$e ] 要素でない ] ⇒ `~open要素~stack$から~popする ◎ When the steps above require the UA to clear the stack back to a table row context, it means that the UA must, while the current node is not a tr, template, or html element, pop elements from the stack of open elements.

注記: この処理-後に`現在の~node$が `html$e 要素になるのは、`素片~事例$に限られる。 ◎ The current node being an html element after this process is a fragment case.

12.2.6.4.15. `~cell内^md

[ `挿入~mode$ ~EQ `~cell内$md ]の下では、現tokenを以下に従って取扱わ~MUST: ◎ When the user agent is to apply the rules for the "in cell" insertion mode, the user agent must handle the token as follows:

終了tag { `td^l, `th^l } ◎ An end tag whose tag name is one of: "td", "th"
  1. ~IF[ `視野~内$に無い( `~table視野$, 現tokenと~tag名が同じ`~HTML要素$ ) ]:

    1. `~perror$
    2. ~RET — 現tokenは無視する
    ◎ If the stack of open elements does not have an element in table scope that is an HTML element with the same tag name as that of the token, then this is a parse error; ignore the token. ◎ Otherwise:
  2. `暗黙の終了tagたちを生成する$() ◎ Generate implied end tags.
  3. ~IF[ `現在の~node$は[ 現tokenと~tag名が同じ`~HTML要素$ ]ではない ] ⇒ `~perror$ ◎ Now, if the current node is not an HTML element with the same tag name as the token, then this is a parse error.
  4. 現tokenと~tag名が同じ`~HTML要素$が`出るまで~open要素~stackから~popする$ ◎ Pop elements from the stack of open elements stack until an HTML element with the same tag name as the token has been popped from the stack.
  5. `作動中の整形~要素~listを最後の~markerまで~clearする$ ◎ Clear the list of active formatting elements up to the last marker.
  6. `挿入~mode$ ~SET `~row内$md ◎ Switch the insertion mode to "in row".
開始tag { `caption^l, `col^l, `colgroup^l, `tbody^l, `td^l, `tfoot^l, `th^l, `thead^l, `tr^l } ◎ A start tag whose tag name is one of: "caption", "col", "colgroup", "tbody", "td", "tfoot", "th", "thead", "tr"
  1. ~IF[ `視野~内$に無い( `~table視野$, { `td^e, `th^e } ) (`素片~事例$) ]:

    1. `~perror$
    2. ~RET — 現tokenは無視する
    ◎ If the stack of open elements does not have a td or th element in table scope, then this is a parse error; ignore the token. (fragment case)
  2. `~cellを閉じる$ ◎ Otherwise, close the cell (see below) and\
  3. 現tokenを再処理する ◎ reprocess the token.
終了tag { `body^l, `caption^l, `col^l, `colgroup^l, `html^l } ◎ An end tag whose tag name is one of: "body", "caption", "col", "colgroup", "html"
  1. `~perror$ — 現tokenは無視する
◎ Parse error. Ignore the token.
終了tag { `table^l, `tbody^l, `tfoot^l, `thead^l, `tr^l } ◎ An end tag whose tag name is one of: "table", "tbody", "tfoot", "thead", "tr"
  1. ~IF[ `視野~内$に無い( `~table視野$, 現tokenと~tag名が同じ`~HTML要素$ ) ]:

    1. `~perror$
    2. ~RET — 現tokenは無視する
    ◎ If the stack of open elements does not have an element in table scope that is an HTML element with the same tag name as that of the token, then this is a parse error; ignore the token.
  2. `~cellを閉じる$ ◎ Otherwise, close the cell (see below) and\
  3. 現tokenを再処理する ◎ reprocess the token.
~AnyElse
  1. `~body内$md`用の規則を用いて$現tokenを処理する
◎ Process the token using the rules for the "in body" insertion mode.

上の手続きにて `~cellを閉じる@ ときは、次を走らす: ◎ Where the steps above say to close the cell, they mean to run the following algorithm:

  1. `暗黙の終了tagたちを生成する$() ◎ Generate implied end tags.
  2. ~IF[ `現在の~node$は[ `td$e / `th$e ]要素でない ] ⇒ `~perror$ ◎ If the current node is not now a td element or a th element, then this is a parse error.
  3. { `td$e, `th$e } いずれかの要素が`出るまで~open要素~stackから~popする$ ◎ Pop elements from the stack of open elements stack until a td element or a th element has been popped from the stack.
  4. `作動中の整形~要素~listを最後の~markerまで~clearする$ ◎ Clear the list of active formatting elements up to the last marker.
  5. `挿入~mode$ ~SET `~row内$md ◎ Switch the insertion mode to "in row".

注記: `~cellを閉じる$~algoが呼出されるときは,常に、 `視野~内$に在る( `~table視野$, `td$e ), `視野~内$に在る( `~table視野$, `th$e ) ]のうち,片方だけが満たされる。 ◎ The stack of open elements cannot have both a td and a th element in table scope at the same time, nor can it have neither when the close the cell algorithm is invoked.

12.2.6.4.16. `~select内^md

[ `挿入~mode$ ~EQ `~select内$md ]の下では、現tokenを以下に従って取扱わ~MUST: ◎ When the user agent is to apply the rules for the "in select" insertion mode, the user agent must handle the token as follows:

文字~token { `0000^U } ◎ A character token that is U+0000 NULL
  1. `~perror$ — 現tokenは無視する
◎ Parse error. Ignore the token.
その他の文字~token ◎ Any other character token
  1. `文字を挿入する$( 現tokenの文字 )
◎ Insert the token's character.
~comment~token ◎ A comment token
  1. `~commentを挿入する$( 現token )
◎ Insert a comment.
~DOCTYPE~token ◎ A DOCTYPE token
  1. `~perror$ — 現tokenは無視する
◎ Parse error. Ignore the token.
開始tag { `html^l } ◎ A start tag whose tag name is "html"
  1. `~body内$md`用の規則を用いて$現tokenを処理する
◎ Process the token using the rules for the "in body" insertion mode.
開始tag { `option^l } ◎ A start tag whose tag name is "option"
  1. ~IF[ `現在の~node$は `option$e 要素である ] ⇒ `~open要素~stack$から~popその~node ◎ If the current node is an option element, pop that node from the stack of open elements.
  2. `要素を挿入する$( 現token ) ◎ Insert an HTML element for the token.
開始tag { `optgroup^l } ◎ A start tag whose tag name is "optgroup"
  1. ~IF[ `現在の~node$は `option$e 要素である ] ⇒ `~open要素~stack$から~popその~node ◎ If the current node is an option element, pop that node from the stack of open elements.
  2. ~IF[ `現在の~node$は `optgroup$e 要素である ] ⇒ `~open要素~stack$から~popその~node ◎ If the current node is an optgroup element, pop that node from the stack of open elements.
  3. `要素を挿入する$( 現token ) ◎ Insert an HTML element for the token.
終了tag { `optgroup^l } ◎ An end tag whose tag name is "optgroup"
  1. ~IF[ `現在の~node$は `option$e 要素である ]~AND[ `~open要素~stack$内で `現在の~node$の直前の~nodeは `optgroup$e 要素である ] ⇒ `~open要素~stack$から~popする ◎ First, if the current node is an option element, and the node immediately before it in the stack of open elements is an optgroup element, then pop the current node from the stack of open elements.
  2. ~IF[ `現在の~node$は `optgroup$e 要素である ] ⇒ `~open要素~stack$から~popその~node ◎ If the current node is an optgroup element, then pop that node from the stack of open elements.\
  3. ~ELSE ⇒ `~perror$ — 現tokenは無視する ◎ Otherwise, this is a parse error; ignore the token.
終了tag { `option^l } ◎ An end tag whose tag name is "option"
  1. ~IF[ `現在の~node$は `option$e 要素である ] ⇒ `~open要素~stack$から~popする ◎ If the current node is an option element, then pop that node from the stack of open elements.\
  2. ~ELSE ⇒ `~perror$ — 現tokenは無視する ◎ Otherwise, this is a parse error; ignore the token.
終了tag { `select^l } ◎ An end tag whose tag name is "select"
  1. ~IF[ `視野~内$に無い( `~select視野$, `select^e ) (`素片~事例$) ]:

    1. `~perror$
    2. ~RET — 現tokenは無視する
    ◎ If the stack of open elements does not have a select element in select scope, this is a parse error; ignore the token. (fragment case) ◎ Otherwise:
  2. `select$e 要素が`出るまで~open要素~stackから~popする$ ◎ Pop elements from the stack of open elements until a select element has been popped from the stack.
  3. `挿入~modeを適切に再設定する$ ◎ Reset the insertion mode appropriately.
開始tag { `select^l } ◎ A start tag whose tag name is "select"
  1. `~perror$ ◎ Parse error.
  2. ~IF[ `視野~内$に無い( `~select視野$, `select^e ) (`素片~事例$) ] ⇒ ~RET — 現tokenは無視する ◎ If the stack of open elements does not have a select element in select scope, ignore the token. (fragment case) ◎ Otherwise:
  3. `select$e 要素が`出るまで~open要素~stackから~popする$ ◎ Pop elements from the stack of open elements until a select element has been popped from the stack.
  4. `挿入~modeを適切に再設定する$ ◎ Reset the insertion mode appropriately.

    注記: これは単に、終了tagの様に扱われる。 ◎ It just gets treated like an end tag.

開始tag { `input^l, `keygen^l, `textarea^l } ◎ A start tag whose tag name is one of: "input", "keygen", "textarea"
  1. `~perror$ ◎ Parse error.
  2. ~IF[ `視野~内$に無い( `~select視野$, `select^e ) (`素片~事例$) ] ⇒ ~RET — 現tokenは無視する ◎ If the stack of open elements does not have a select element in select scope, ignore the token. (fragment case) ◎ Otherwise:
  3. `select$e 要素が`出るまで~open要素~stackから~popする$ ◎ Pop elements from the stack of open elements until a select element has been popped from the stack.
  4. `挿入~modeを適切に再設定する$ ◎ Reset the insertion mode appropriately.
  5. 現tokenを再処理する ◎ Reprocess the token.
開始tag { `script^l, `template^l } ◎ A start tag whose tag name is one of: "script", "template"
終了tag { `template^l } ◎ An end tag whose tag name is "template"
  1. `~head内$md`用の規則を用いて$現tokenを処理する
◎ Process the token using the rules for the "in head" insertion mode.
~eof~token ◎ An end-of-file token
  1. `~body内$md`用の規則を用いて$現tokenを処理する
◎ Process the token using the rules for the "in body" insertion mode.
~AnyElse
  1. `~perror$ — 現tokenは無視する
◎ Parse error. Ignore the token.
12.2.6.4.17. `~table内~select内^md

[ `挿入~mode$ ~EQ `~table内~select内$md ]の下では、現tokenを以下に従って取扱わ~MUST: ◎ When the user agent is to apply the rules for the "in select in table" insertion mode, the user agent must handle the token as follows:

開始tag { `caption^l, `table^l, `tbody^l, `tfoot^l, `thead^l, `tr^l, `td^l, `th^l } ◎ A start tag whose tag name is one of: "caption", "table", "tbody", "tfoot", "thead", "tr", "td", "th"
  1. `~perror$ ◎ Parse error.
  2. `select$e 要素が`出るまで~open要素~stackから~popする$ ◎ Pop elements from the stack of open elements until a select element has been popped from the stack.
  3. `挿入~modeを適切に再設定する$ ◎ Reset the insertion mode appropriately.
  4. 現tokenを再処理する ◎ Reprocess the token.
終了tag { `caption^l, `table^l, `tbody^l, `tfoot^l, `thead^l, `tr^l, `td^l, `th^l } ◎ An end tag whose tag name is one of: "caption", "table", "tbody", "tfoot", "thead", "tr", "td", "th"
  1. `~perror$ ◎ Parse error.
  2. ~IF[ `視野~内$に無い( `~table視野$, 現tokenと~tag名が同じ`~HTML要素$ ) ] ⇒ ~RET — 現tokenは無視する ◎ If the stack of open elements does not have an element in table scope that is an HTML element with the same tag name as that of the token, then ignore the token. ◎ Otherwise:
  3. `select$e 要素が`出るまで~open要素~stackから~popする$ ◎ Pop elements from the stack of open elements until a select element has been popped from the stack.
  4. `挿入~modeを適切に再設定する$ ◎ Reset the insertion mode appropriately.
  5. 現tokenを再処理する ◎ Reprocess the token.
~AnyElse
  1. `~select内$md`用の規則を用いて$現tokenを処理する
◎ Process the token using the rules for the "in select" insertion mode.
12.2.6.4.18. `~template内^md

[ `挿入~mode$ ~EQ `~template内$md ]の下では、現tokenを以下に従って取扱わ~MUST: ◎ When the user agent is to apply the rules for the "in template" insertion mode, the user agent must handle the token as follows:

文字~token ◎ A character token
~comment~token ◎ A comment token
~DOCTYPE~token ◎ A DOCTYPE token
  1. `~body内$md`用の規則を用いて$現tokenを処理する
◎ Process the token using the rules for the "in body" insertion mode.
開始tag { `base^l, `basefont^l, `bgsound^l, `link^l, `meta^l, `noframes^l, `script^l, `style^l, `template^l, `title^l } ◎ A start tag whose tag name is one of: "base", "basefont", "bgsound", "link", "meta", "noframes", "script", "style", "template", "title"
終了tag { `template^l } ◎ An end tag whose tag name is "template"
  1. `~head内$md`用の規則を用いて$現tokenを処理する
◎ Process the token using the rules for the "in head" insertion mode.
開始tag { `caption^l, `colgroup^l, `tbody^l, `tfoot^l, `thead^l } ◎ A start tag whose tag name is one of: "caption", "colgroup", "tbody", "tfoot", "thead"
  1. `~template挿入~mode~stack$から~popする ◎ Pop the current template insertion mode off the stack of template insertion modes.
  2. `~template挿入~mode~stack$に`~table内$mdを~pushする ◎ Push "in table" onto the stack of template insertion modes so that it is the new current template insertion mode.
  3. `挿入~mode$ ~SET `~table内$md ◎ Switch the insertion mode to "in table", and\
  4. 現tokenを再処理する ◎ reprocess the token.
開始tag { `col^l } ◎ A start tag whose tag name is "col"
  1. `~template挿入~mode~stack$から~popする ◎ Pop the current template insertion mode off the stack of template insertion modes.
  2. `~template挿入~mode~stack$に`~column-group内$mdを~pushする ◎ Push "in column group" onto the stack of template insertion modes so that it is the new current template insertion mode.
  3. `挿入~mode$ ~SET `~column-group内$md ◎ Switch the insertion mode to "in column group", and\
  4. 現tokenを再処理する ◎ reprocess the token.
開始tag { `tr^l } ◎ A start tag whose tag name is "tr"
  1. `~template挿入~mode~stack$から~popする ◎ Pop the current template insertion mode off the stack of template insertion modes.
  2. `~template挿入~mode~stack$に `~table~body内$mdを~pushする ◎ Push "in table body" onto the stack of template insertion modes so that it is the new current template insertion mode.
  3. `挿入~mode$ ~SET `~table~body内$md ◎ Switch the insertion mode to "in table body", and\
  4. 現tokenを再処理する ◎ reprocess the token.
開始tag { `td^l, `th^l } ◎ A start tag whose tag name is one of: "td", "th"
  1. `~template挿入~mode~stack$から~popする ◎ Pop the current template insertion mode off the stack of template insertion modes.
  2. `~template挿入~mode~stack$に`~row内$mdを~pushする ◎ Push "in row" onto the stack of template insertion modes so that it is the new current template insertion mode.
  3. `挿入~mode$ ~SET `~row内$md ◎ Switch the insertion mode to "in row", and\
  4. 現tokenを再処理する ◎ reprocess the token.
その他の開始tag ◎ Any other start tag
  1. `~template挿入~mode~stack$から~popする ◎ Pop the current template insertion mode off the stack of template insertion modes.
  2. `~template挿入~mode~stack$に`~body内$mdを~pushする ◎ Push "in body" onto the stack of template insertion modes so that it is the new current template insertion mode.
  3. `挿入~mode$ ~SET `~body内$md ◎ Switch the insertion mode to "in body", and\
  4. 現tokenを再処理する ◎ reprocess the token.
その他の終了tag ◎ Any other end tag
  1. `~perror$ — 現tokenは無視する
◎ Parse error. Ignore the token.
~eof~token ◎ An end-of-file token
  1. ~IF[ `~open要素~stack$内には `template$e 要素はない (`素片~事例$) ]:

    1. `構文解析を停止する$
    2. ~RET
    ◎ If there is no template element on the stack of open elements, then stop parsing. (fragment case)
  2. `~perror$ ◎ Otherwise, this is a parse error.
  3. `template$e 要素が`出るまで~open要素~stackから~popする$ ◎ Pop elements from the stack of open elements until a template element has been popped from the stack.
  4. `作動中の整形~要素~listを最後の~markerまで~clearする$ ◎ Clear the list of active formatting elements up to the last marker.
  5. `~template挿入~mode~stack$から~popする ◎ Pop the current template insertion mode off the stack of template insertion modes.
  6. `挿入~modeを適切に再設定する$ ◎ Reset the insertion mode appropriately.
  7. 現tokenを再処理する ◎ Reprocess the token.
12.2.6.4.19. `~bodyの後^md

[ `挿入~mode$ ~EQ `~bodyの後$md ]の下では、現tokenを以下に従って取扱わ~MUST: ◎ When the user agent is to apply the rules for the "after body" insertion mode, the user agent must handle the token as follows:

文字~token { `~ASCII空白$ } ◎ 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
  1. `~body内$md`用の規則を用いて$現tokenを処理する
◎ Process the token using the rules for the "in body" insertion mode.
~comment~token ◎ A comment token
  1. `~commentを挿入する$( 現token, `~open要素~stack$の先頭の要素( `html$e 要素)内の末尾 )
◎ Insert a comment as the last child of the first element in the stack of open elements (the html element).
~DOCTYPE~token ◎ A DOCTYPE token
  1. `~perror$ — 現tokenは無視する
◎ Parse error. Ignore the token.
開始tag { `html^l } ◎ A start tag whose tag name is "html"
  1. `~body内$md`用の規則を用いて$現tokenを処理する
◎ Process the token using the rules for the "in body" insertion mode.
終了tag { `html^l } ◎ An end tag whose tag name is "html"
  1. ~IF[ %構文解析器 は `~HTML素片~用$である (`素片~事例$) ]:

    1. `~perror$
    2. ~RET — 現tokenは無視する
    ◎ If the parser was originally created as part of the HTML fragment parsing algorithm, this is a parse error; ignore the token. (fragment case)
  2. ~ELSE ⇒ `挿入~mode$ ~SET `~bodyの後の後$md ◎ Otherwise, switch the insertion mode to "after after body".
~eof~token ◎ An end-of-file token
  1. `構文解析を停止する$
◎ Stop parsing.
~AnyElse
  1. `~perror$
  2. `挿入~mode$ ~SET `~body内$md
  3. 現tokenを再処理する
◎ Parse error. Switch the insertion mode to "in body" and reprocess the token.
12.2.6.4.20. `~frameset内^md

[ `挿入~mode$ ~EQ `~frameset内$md ]の下では、現tokenを以下に従って取扱わ~MUST: ◎ When the user agent is to apply the rules for the "in frameset" insertion mode, the user agent must handle the token as follows:

文字~token { `~ASCII空白$ } ◎ 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
  1. `文字を挿入する$( 現tokenの文字 )
◎ Insert the character.
~comment~token ◎ A comment token
  1. `~commentを挿入する$( 現token )
◎ Insert a comment.
~DOCTYPE~token ◎ A DOCTYPE token
  1. `~perror$ — 現tokenは無視する
◎ Parse error. Ignore the token.
開始tag { `html^l } ◎ A start tag whose tag name is "html"
  1. `~body内$md`用の規則を用いて$現tokenを処理する
◎ Process the token using the rules for the "in body" insertion mode.
開始tag { `frameset^l } ◎ A start tag whose tag name is "frameset"
  1. `要素を挿入する$( 現token )
◎ Insert an HTML element for the token.
終了tag { `frameset^l } ◎ An end tag whose tag name is "frameset"
  1. ~IF[ `現在の~node$は根 `html$e 要素である (`素片~事例$) ]:

    1. `~perror$
    2. ~RET — 現tokenは無視する
    ◎ If the current node is the root html element, then this is a parse error; ignore the token. (fragment case)
  2. `~open要素~stack$から~popする ◎ Otherwise, pop the current node from the stack of open elements.
  3. ~IF[ %構文解析器 は `~HTML素片~用$でない(`素片~事例$でない) ]~AND[ `現在の~node$は `frameset$e 要素でない ] ⇒ `挿入~mode$ ~SET `~framesetの後$md ◎ If the parser was not originally created as part of the HTML fragment parsing algorithm (fragment case), and the current node is no longer a frameset element, then switch the insertion mode to "after frameset".
開始tag { `frame^l } ◎ A start tag whose tag name is "frame"
  1. `要素を挿入する$( 現token ) ◎ Insert an HTML element for the token.\
  2. `~open要素~stack$から~popする ◎ Immediately pop the current node off the stack of open elements.
  3. ~IF[ 現tokenの`自己閉じ~flag$ ~EQ ~ON ] ⇒ `自己閉じ~flagを承認する$( 現token ) ◎ Acknowledge the token's self-closing flag, if it is set.
開始tag { `noframes^l } ◎ A start tag whose tag name is "noframes"
  1. `~head内$md`用の規則を用いて$現tokenを処理する
◎ Process the token using the rules for the "in head" insertion mode.
~eof~token ◎ An end-of-file token
  1. ~IF[ `現在の~node$は根 `html$e 要素でない ] ⇒ `~perror$ ◎ If the current node is not the root html element, then this is a parse error.

    注記: `素片~事例$においては、`現在の~node$は,常に根 `html$e 要素になる ◎ The current node can only be the root html element in the fragment case.

  2. `構文解析を停止する$ ◎ Stop parsing.
~AnyElse
  1. `~perror$ — 現tokenは無視する
◎ Parse error. Ignore the token.
12.2.6.4.21. `~framesetの後^md

[ `挿入~mode$ ~EQ `~framesetの後$md ]の下では、現tokenを以下に従って取扱わ~MUST: ◎ When the user agent is to apply the rules for the "after frameset" insertion mode, the user agent must handle the token as follows:

文字~token { `~ASCII空白$ } ◎ 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
  1. `文字を挿入する$( 現tokenの文字 )
◎ Insert the character.
~comment~token ◎ A comment token
  1. `~commentを挿入する$( 現token )
◎ Insert a comment.
~DOCTYPE~token ◎ A DOCTYPE token
  1. `~perror$ — 現tokenは無視する
◎ Parse error. Ignore the token.
開始tag { `html^l } ◎ A start tag whose tag name is "html"
  1. `~body内$md`用の規則を用いて$現tokenを処理する
◎ Process the token using the rules for the "in body" insertion mode.
終了tag { `html^l } ◎ An end tag whose tag name is "html"
  1. `挿入~mode$ ~SET `~framesetの後の後$md
◎ Switch the insertion mode to "after after frameset".
開始tag { `noframes^l } ◎ A start tag whose tag name is "noframes"
  1. `~head内$md`用の規則を用いて$現tokenを処理する
◎ Process the token using the rules for the "in head" insertion mode.
~eof~token ◎ An end-of-file token
  1. `構文解析を停止する$
◎ Stop parsing.
~AnyElse
  1. `~perror$ — 現tokenは無視する
◎ Parse error. Ignore the token.
12.2.6.4.22. `~bodyの後の後^md

[ `挿入~mode$ ~EQ `~bodyの後の後$md ]の下では、現tokenを以下に従って取扱わ~MUST: ◎ When the user agent is to apply the rules for the "after after body" insertion mode, the user agent must handle the token as follows:

~comment~token ◎ A comment token
  1. `~commentを挿入する$( 現token, `文書$内の末尾 )
◎ Insert a comment as the last child of the Document object.
~DOCTYPE~token ◎ A DOCTYPE token
文字~token { `~ASCII空白$ } ◎ 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
開始tag { `html^l } ◎ A start tag whose tag name is "html"
  1. `~body内$md`用の規則を用いて$現tokenを処理する
◎ Process the token using the rules for the "in body" insertion mode.
~eof~token ◎ An end-of-file token
  1. `構文解析を停止する$
◎ Stop parsing.
~AnyElse
  1. `~perror$
  2. `挿入~mode$ ~SET `~body内$md
  3. 現tokenを再処理する
◎ Parse error. Switch the insertion mode to "in body" and reprocess the token.
12.2.6.4.23. `~framesetの後の後^md

[ `挿入~mode$ ~EQ `~framesetの後の後$md ]の下では、現tokenを以下に従って取扱わ~MUST: ◎ When the user agent is to apply the rules for the "after after frameset" insertion mode, the user agent must handle the token as follows:

~comment~token ◎ A comment token
  1. `~commentを挿入する$( 現token, `文書$内の末尾 )
◎ Insert a comment as the last child of the Document object.
~DOCTYPE~token ◎ A DOCTYPE token
文字~token { `~ASCII空白$ } ◎ 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
開始tag { `html^l } ◎ A start tag whose tag name is "html"
  1. `~body内$md`用の規則を用いて$現tokenを処理する
◎ Process the token using the rules for the "in body" insertion mode.
~eof~token ◎ An end-of-file token
  1. `構文解析を停止する$
◎ Stop parsing.
開始tag { `noframes^l } ◎ A start tag whose tag name is "noframes"
  1. `~head内$md`用の規則を用いて$現tokenを処理する
◎ Process the token using the rules for the "in head" insertion mode.
~AnyElse
  1. `~perror$ — 現tokenは無視する
◎ Parse error. Ignore the token.

12.2.6.5. 外来~内容~内~token用の構文解析~規則

~UAは、外来~内容~内の~tokenを構文解析するための規則を適用するときは,現tokenを次に従って取扱わ~MUST: ◎ When the user agent is to apply the rules for parsing tokens in foreign content, the user agent must handle the token as follows:

文字~token { `0000^U } ◎ A character token that is U+0000 NULL
  1. `~perror$
  2. `文字を挿入する$( `FFFD^U )
◎ Parse error. Insert a U+FFFD REPLACEMENT CHARACTER character.
文字~token { `~ASCII空白$ } ◎ 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
  1. `文字を挿入する$( 現tokenの文字 )
◎ Insert the token's character.
その他の文字~token ◎ Any other character token
  1. `文字を挿入する$( 現tokenの文字 ) ◎ Insert the token's character.
  2. `~frameset-ok~flag$ ~SET `not-ok^i ◎ Set the frameset-ok flag to "not ok".
~comment~token ◎ A comment token
  1. `~commentを挿入する$( 現token )
◎ Insert a comment.
~DOCTYPE~token ◎ A DOCTYPE token
  1. `~perror$ — 現tokenは無視する
◎ Parse error. Ignore the token.
開始tag { `b^l, `big^l, `blockquote^l, `body^l, `br^l, `center^l, `code^l, `dd^l, `div^l, `dl^l, `dt^l, `em^l, `embed^l, `h1^l, `h2^l, `h3^l, `h4^l, `h5^l, `h6^l, `head^l, `hr^l, `i^l, `img^l, `li^l, `listing^l, `menu^l, `meta^l, `nobr^l, `ol^l, `p^l, `pre^l, `ruby^l, `s^l, `small^l, `span^l, `strong^l, `strike^l, `sub^l, `sup^l, `table^l, `tt^l, `u^l, `ul^l, `var^l, `font^l } ◎ A start tag whose tag name is one of: "b", "big", "blockquote", "body", "br", "center", "code", "dd", "div", "dl", "dt", "em", "embed", "h1", "h2", "h3", "h4", "h5", "h6", "head", "hr", "i", "img", "li", "listing", "menu", "meta", "nobr", "ol", "p", "pre", "ruby", "s", "small", "span", "strong", "strike", "sub", "sup", "table", "tt", "u", "ul", "var"
  1. ~IF[ 現tokenの~tag名 ~EQ `font^l ]~AND[ 現tokenは名前 [ `color^l / `face^l / `size^l ]の属性をいずれも有さない ] ⇒ ~GOTO その他の開始tag ◎ A start tag whose tag name is "font", if the token has any attributes named "color", "face", or "size"
  2. `~perror$ ◎ Parse error.
  3. ~IF[ %構文解析器 は `~HTML素片~用$である (`素片~事例$) ] ⇒ ~GOTO 下に述べる “その他の開始tag” ~entry ◎ If the parser was originally created for the HTML fragment parsing algorithm, then act as described in the "any other start tag" entry below. (fragment case) ◎ Otherwise:
  4. `~open要素~stack$から~popする ◎ Pop an element from the stack of open elements, and then\
  5. ~WHILE 無条件:

    1. `~open要素~stack$から~popする
    2. ~IF[ `現在の~node$は[ `~MathML~text統合~地点$ / `~HTML統合~地点$ / `~HTML名前空間$に属する要素 ]である ⇒ ~BREAK
    ◎ keep popping more elements from the stack of open elements until the current node is a MathML text integration point, an HTML integration point, or an element in the HTML namespace.
  6. 現tokenを再処理する ◎ Then, reprocess the token.
その他の開始tag ◎ Any other start tag
  1. ~IF[ `現在の調整-済み~node$は`~MathML名前空間$に属する要素である ] ⇒ `~MathML属性たちを調整する$( 現token ) (これは、~MathML属性に非~小文字が含まれている事例を修正する。) ◎ If the adjusted current node is an element in the MathML namespace, adjust MathML attributes for the token. (This fixes the case of MathML attributes that are not all lowercase.)
  2. ~IF[ `現在の調整-済み~node$は`~SVG名前空間$に属する要素である ]~AND[ 現tokenの~tag名 ~IN { 次の~tableの 1 列目に挙げる名前 } ] ⇒ 現tokenの~tag名 ~SET 名前が見出された行の 2 列目に与える名前 (これは、非~小文字を含む~SVG要素の事例を修正する。) ◎ If the adjusted current node is an element in the SVG namespace, and the token's tag name is one of the ones in the first column of the following table, change the tag name to the name given in the corresponding cell in the second column. (This fixes the case of SVG elements that are not all lowercase.)

    ~tag名◎ Tag name 要素~名◎ Element name
    `altglyph^c `altGlyph^e
    `altglyphdef^c `altGlyphDef^e
    `altglyphitem^c `altGlyphItem^e
    `animatecolor^c `animateColor^e
    `animatemotion^c `animateMotion^e
    `animatetransform^c `animateTransform^e
    `clippath^c `clipPath^e
    `feblend^c `feBlend^e
    `fecolormatrix^c `feColorMatrix^e
    `fecomponenttransfer^c `feComponentTransfer^e
    `fecomposite^c `feComposite^e
    `feconvolvematrix^c `feConvolveMatrix^e
    `fediffuselighting^c `feDiffuseLighting^e
    `fedisplacementmap^c `feDisplacementMap^e
    `fedistantlight^c `feDistantLight^e
    `fedropshadow^c `feDropShadow^e
    `feflood^c `feFlood^e
    `fefunca^c `feFuncA^e
    `fefuncb^c `feFuncB^e
    `fefuncg^c `feFuncG^e
    `fefuncr^c `feFuncR^e
    `fegaussianblur^c `feGaussianBlur^e
    `feimage^c `feImage^e
    `femerge^c `feMerge^e
    `femergenode^c `feMergeNode^e
    `femorphology^c `feMorphology^e
    `feoffset^c `feOffset^e
    `fepointlight^c `fePointLight^e
    `fespecularlighting^c `feSpecularLighting^e
    `fespotlight^c `feSpotLight^e
    `fetile^c `feTile^e
    `feturbulence^c `feTurbulence^e
    `foreignobject^c `foreignObject^e
    `glyphref^c `glyphRef^e
    `lineargradient^c `linearGradient^e
    `radialgradient^c `radialGradient^e
    `textpath^c `textPath^e
  3. ~IF[ `現在の調整-済み~node$は`~SVG名前空間$に属する要素である ] ⇒ `~SVG属性たちを調整する$( 現token ) (これは、非~小文字を含む~SVG属性の事例を修正する。) ◎ If the adjusted current node is an element in the SVG namespace, adjust SVG attributes for the token. (This fixes the case of SVG attributes that are not all lowercase.)
  4. `外来の属性たちを調整する$( 現token ) (これは、名前空間~付きの属性の利用 — 特に~SVGにおける~XLink — を修正する。) ◎ Adjust foreign attributes for the token. (This fixes the use of namespaced attributes, in particular XLink in SVG.)
  5. `要素を挿入する$( 現token, `現在の調整-済み~node$が属する名前空間 ) ◎ Insert a foreign element for the token, in the same namespace as the adjusted current node.
  6. ~IF[ 現tokenの`自己閉じ~flag$ ~EQ ~OFF ] ⇒ ~RET ◎ If the token has its self-closing flag set, then run the appropriate steps from the following list:
  7. `自己閉じ~flagを承認する$( 現token ) ◎ ↓
  8. ~IF[ 現tokenの~tag名 ~EQ `script^l ]~AND[ `現在の~node$は`~SVG名前空間$に属する ] ⇒ ~GOTO 終了tag { `script^l } ◎ If the token's tag name is "script", and the new current node is in the SVG namespace • Acknowledge the token's self-closing flag, and then act as described in the steps for a "script" end tag below.
  9. `~open要素~stack$から~popする ◎ Otherwise • Pop the current node off the stack of open elements and acknowledge the token's self-closing flag.
終了tag { `script^l } ◎ An end tag whose tag name is "script",\
  1. ~IF[ `現在の~node$は ~SVG `~SVGscript$e 要素でない ] ⇒ ~GOTO その他の終了tag ◎ if the current node is an SVG script element
  2. `~open要素~stack$から~popする ◎ Pop the current node off the stack of open elements.
  3. %旧~挿入~地点 ~LET現在の`挿入~地点$ ◎ Let the old insertion point have the same value as the current insertion point.\
  4. `挿入~地点$ ~LET `次n入力~文字$の直前 ◎ Let the insertion point be just before the next input character.
  5. %構文解析器 の`~script入子~level$ ~INCBY 1 ◎ Increment the parser's script nesting level by one.\
  6. %構文解析器 の`静止~flag$ ~SET ~T ◎ Set the parser pause flag to true.
  7. ~IF[ ~UAは~SVGを~supportする ] ⇒ ~SVG規則に則って,`~SVG~script要素を処理する$ `SVG$r ◎ Process the SVG script element according to the SVG rules, if the user agent supports SVG. [SVG]

    注記: これにより ~tokenizerの中に新たな文字たちが挿入される ことになる場合でも、 %構文解析器 の`静止~flag$ ~EQ ~T なので, %構文解析器 は再入的に実行されない。 ◎ Even if this causes new characters to be inserted into the tokenizer, the parser will not be executed reentrantly, since the parser pause flag is true.

  8. %構文解析器 の`~script入子~level$ ~DECBY 1 ◎ Decrement the parser's script nesting level by one.\
  9. ~IF[ %構文解析器 の`~script入子~level$ ~EQ 0 ] ⇒ %構文解析器 の`静止~flag$ ~SET ~F ◎ If the parser's script nesting level is zero, then set the parser pause flag to false.
  10. `挿入~地点$ ~SET %旧~挿入~地点 ◎ Let the insertion point have the value of the old insertion point. (In other words, restore the insertion point to its previous value. This value might be the "undefined" value.)
その他の終了tag ◎ Any other end tag ◎ Run these steps:
  1. %~node ~LET `現在の~node$ ◎ Initialize node to be the current node (the bottommost node of the stack).
  2. ~IF[ `~ASCII小文字~化する$( %~node の~tag名 ) ~NEQ 現tokenの~tag名 ] ⇒ `~perror$ ◎ If node's tag name, converted to ASCII lowercase, is not the same as the tag name of the token, then this is a parse error.
  3. ~WHILE 無条件: ◎ ↓

    1. ~IF[ %~node ~EQ `~open要素~stack$の先頭の要素 (`素片~事例$) ] ⇒ ~RET ◎ Loop: If node is the topmost element in the stack of open elements, then return. (fragment case)
    2. ~IF[ `~ASCII小文字~化する$( %~node の~tag名 ) ~EQ 現tokenの~tag名 ]:

      1. %~node が`出るまで~open要素~stackから~popする$
      2. ~RET
      ◎ If node's tag name, converted to ASCII lowercase, is the same as the tag name of the token, pop elements from the stack of open elements until node has been popped from the stack, and then return.
    3. %~node ~SET `~open要素~stack$内で %~node の直前の~entry ◎ Set node to the previous entry in the stack of open elements.
    4. ~IF[ %~node は`~HTML名前空間$に属する要素である ] ⇒ ~BREAK ◎ If node is not an element in the HTML namespace, return to the step labeled loop.
  4. ~HTML内容~内の~token 用の,現在の`挿入~mode$に対応する節 ]に与える規則に則って、現tokenを処理する ◎ Otherwise, process the token according to the rules given in the section corresponding to the current insertion mode in HTML content.

12.2.7. 終端

`文書$ %文書 の `構文解析を停止する@ ときは、次の手続きを走らせ~MUST: ◎ Once the user agent stops parsing the document, the user agent must run the following steps:

  1. %文書 の`現在の準備度$doc ~SET `interactive^l ◎ Set the current document readiness to "interactive" and\
  2. `挿入~地点$ ~SET ε ◎ the insertion point to undefined.
  3. `~open要素~stack$を空にする ◎ Pop all the nodes off the stack of open elements.
  4. %~script~list ~LET %構文解析器 の`文書を構文解析し終えたときに実行されることになる~scriptの~list$を指す参照 ◎ ↓
  5. ~WHILE[ %~script~list は空でない ]: ◎ If the list of scripts that will execute when the document has finished parsing is not empty, run these substeps:

    1. 次のいずれも満たされるまで`~event~loopを回す$:

      • %~script~list 内の 最初の `script$e の`解析器実行準備済み~flag$ ~EQ ~ON
      • %文書 内には`~scriptを阻んでいる~stylesheetは無い$
      ◎ Spin the event loop until the first script in the list of scripts that will execute when the document has finished parsing has its "ready to be parser-executed" flag set and the parser's Document has no style sheet that is blocking scripts.
    2. %~script ~LET %~script~list 内の 最初の `script$e ◎ ↓
    3. %~script の`~script~blockを実行する$ ◎ Execute the first script in the list of scripts that will execute when the document has finished parsing.
    4. %~script~list から %~script を除去する ◎ Remove the first script element from the list of scripts that will execute when the document has finished parsing (i.e. shift out the first entry in the list). ◎ If the list of scripts that will execute when the document has finished parsing is still not empty, repeat these substeps again from substep 1.
  6. 次を走らす`~taskを~queueする$: ◎ Queue a task to run the following substeps:

    1. %文書 に向けて,名前 `DOMContentLoaded$et の`~eventを発火する$ — 次のように初期化して ⇒ `bubbles$m 属性 ~SET ~T ◎ Fire an event named DOMContentLoaded at the Document object, with its bubbles attribute initialized to true.
    2. 次を満たす `ServiceWorkerContainer$I ~obj %C の`~client~message~queue$を可能化する ⇒ %C に結付けられている`~sw~client$ ~EQ %文書 に`関連する設定群~obj$ ◎ Enable the client message queue of the ServiceWorkerContainer object whose associated service worker client is the Document object's relevant settings object.
  7. 次がいずれも満たされるまで`~event~loopを回す$:

    • `可能な限りすぐに実行される~scriptの集合$は空である
    • `可能な限りすぐに順に実行される~scriptの~list$は空である
    ◎ Spin the event loop until the set of scripts that will execute as soon as possible and the list of scripts that will execute in order as soon as possible are empty.
  8. 次が満たされるまで`~event~loopを回す$ ⇒ %文書 内に `~load~eventを遅延する@ ものはない ◎ Spin the event loop until there is nothing that delays the load event in the Document.
  9. 次を走らす`~taskを~queueする$: ◎ Queue a task to run the following substeps:

    1. %文書 の`現在の準備度$doc ~SET `complete^l ◎ Set the current document readiness to "complete".
    2. ~IF[ %文書 が`属する閲覧文脈$ ~NEQ ε ] ⇒ %文書 を`結付けている~window$に向けて,名前 `load$et の`~eventを発火する$( `~targetを上書きする^i ) ◎ Load event: If the Document has a browsing context, then fire an event named load at the Document object's Window object, with legacy target override flag set.
  10. ~IF[ %文書 が`属する閲覧文脈$ ~NEQ ε ] ⇒ 次を走らす`~taskを~queueする$: ◎ If the Document has a browsing context, then queue a task to run the following substeps:

    1. ~IF[ %文書 の`頁~表示中$ ~flag ~EQ ~T ] ⇒ ~RET ◎ If the Document's page showing flag is true, then return (i.e. don't fire the event below).
    2. %文書 の`頁~表示中$ ~flag ~SET ~T ◎ Set the Document's page showing flag to true.
    3. %文書 を`結付けている~window$に向けて,名前 `pageshow$et の`~eventを発火する$( `~targetを上書きする^i ) — `PageTransitionEvent$I を利用し,次のように初期化して ⇒ `persisted$m 属性 ~SET ~F ◎ Fire an event named pageshow at the Document object's Window object, using PageTransitionEvent, with the persisted attribute initialized to false, and legacy target override flag set.

  11. ~app~cache関連の処理】 ◎ If the Document has any pending application cache download process tasks, then queue each such task in the order they were added to the list of pending application cache download process tasks, and then empty the list of pending application cache download process tasks. The task source for these tasks is the networking task source.
  12. ~IF[ %文書 が`読込まれたとき印刷する~flag$ ~EQ ~ON ] ⇒ `印刷-時の手続き$を走らす ◎ If the Document's print when loaded flag is set, then run the printing steps.
  13. この時点で、 %文書 は `~load後~task準備済み@ とする ◎ The Document is now ready for post-load tasks.
  14. 次を走らす`~taskを~queueする$ ⇒ この時点で、 %文書 は `完全に読込まれ@ たものとする ◎ Queue a task to mark the Document as completely loaded.

~UAは, `構文解析器を中止-@ するときは、次の手続きを走らせ~MUST: ◎ When the user agent is to abort a parser, it must run the following steps:

  1. `入力~stream$内の処理待ち内容は、未来に追加されることになるものも含め,破棄する ◎ Throw away any pending content in the input stream, and discard any future content that would have been added to it.
  2. %文書 の`現在の準備度$doc ~SET `interactive^l ◎ Set the current document readiness to "interactive".
  3. `~open要素~stack$を空にする ◎ Pop all the nodes off the stack of open elements.
  4. %文書 の`現在の準備度$doc ~SET `complete^l ◎ Set the current document readiness to "complete".

他が指定されない限り,この節に言及した`~task$用の`~task源$は、 `~DOM操作~task源$とする。 ◎ Except where otherwise specified, the task source for the tasks mentioned in this section is the DOM manipulation task source.

12.2.8. ~HTML~DOMから~XML~infosetへの落とし込み

~appが`~HTML構文解析器$を~XML~pipelineと併用するときに構築される~DOMは、ある種の微妙な仕方で~XML~toolchainと互換でない可能性もある。 例えば,~XML~toolchainは、名前 `xmlns^c の属性を表現できないかもしれない — それは `XMLNS$r の構文と競合するので。 `~HTML構文解析器$が生成する~dataには、~DOM自身には含まれないものもある。 この節は、これらの課題を取扱うための規則をいくつか指定する。 ◎ When an application uses an HTML parser in conjunction with an XML pipeline, it is possible that the constructed DOM is not compatible with the XML tool chain in certain subtle ways. For example, an XML toolchain might not be able to represent attributes with the name xmlns, since they conflict with the Namespaces in XML syntax. There is also some data that the HTML parser generates that isn't included in the DOM itself. This section specifies some rules for handling these issues.

利用-中の~XML~API — 以下,単に “~XML~API” — が~DOCTYPEを~supportしない場合、~toolは,~DOCTYPEをまるごと落として~MAY。 ◎ If the XML API being used doesn't support DOCTYPEs, the tool may drop DOCTYPEs altogether.

~XML~APIが[ 名前空間に属さない名前 `xmlns^l の属性 / `xmlns:^l で開始する名前の属性 / `~XMLNS名前空間$に属する属性 ]を~supportしない場合、~toolは,そのような属性を落として~MAY。 ◎ If the XML API doesn't support attributes in no namespace that are named "xmlns", attributes whose names start with "xmlns:", or attributes in the XMLNS namespace, then the tool may drop such attributes.

~toolは、適正に演算するために要求される名前空間~宣言があれば,出力を それで注釈して~MAY。 ◎ The tool may annotate the output with any namespace declarations required for proper operation.

~XML~APIが[ 要素/属性 ]の局所~名に許容-可能な文字を制約する場合、~toolは,[[ 要素/属性 ]の局所~名の中の文字のうち,当の~APIが~supportしないもの ]を,次の形による文字~並びに置換することにより、許容される名前の集合に対応付けて~MAY:

  1. `0055^U
  2. 文字の~cpを~hexadecimalで表すような 6 個の`~ASCII~hex数字(大文字)$
◎ If the XML API being used restricts the allowable characters in the local names of elements and attributes, then the tool may map all element and attribute local names that the API wouldn't support to a set of names that are allowed, by replacing any character that isn't supported with the uppercase letter U and the six digits of the character's code point when expressed in hexadecimal, using digits 0-9 and capital letters A-F as the symbols, in increasing numeric order.

例えば`~HTML構文解析器$は,合法な~HTML要素~名でも整形式の~XML要素~名でもない 要素~名 `foo<bar^c を出力し得るが、それは `fooU00003Cbar^c に変換され,整形式の ~XML要素~名になる(それでも、~HTMLにおいて合法になることはない)。 ◎ For example, the element name foo<bar, which can be output by the HTML parser, though it is neither a legal HTML element name nor a well-formed XML element name, would be converted into fooU00003Cbar, which is a well-formed XML element name (though it's still not legal in HTML by any means).

別の例として、属性 `xlink:href^c を考える。 ~MathML要素~上で利用された場合、それは 調整-後には ( 接頭辞 `xlink^l, 局所~名 `href^l ) を伴う属性になる。 しかしながら,~HTML要素~上で利用された場合、 ( 接頭辞なし, 局所~名 `xlink:href^l ) を伴う属性になり,妥当な `NCName^P でないため、~XML~APIには受容されないかもしれない。 したがって `xlinkU00003Ahref^l になるよう変換することもできる。 ◎ As another example, consider the attribute xlink:href. Used on a MathML element, it becomes, after being adjusted, an attribute with a prefix "xlink" and a local name "href". However, used on an HTML element, it becomes an attribute with no prefix and the local name "xlink:href", which is not a valid NCName, and thus might not be accepted by an XML API. It could thus get converted, becoming "xlinkU00003Ahref".

注記: この変換による結果の名前は、都合よく,`~HTML構文解析器$が生成するどの属性とも衝突し得ない — それらはどれも、小文字のみからなるか[ `外来の属性たちを調整する$~algoの表に挙げたもの ]に限られるので。 ◎ The resulting names from this conversion conveniently can't clash with any attribute generated by the HTML parser, since those are all either lowercase or those listed in the adjust foreign attributes algorithm's table.

~XML~APIが[ ~comment内の連続する 2 個の `002D^U ]を制約する場合、~toolは,そのような~~問題になる文字~並びの合間に 1 個の `0020^U を挿入して~MAY。 ◎ If the XML API restricts comments from having two consecutive U+002D HYPHEN-MINUS characters (--), the tool may insert a single U+0020 SPACE character between any such offending characters.

~XML~APIが[ ~comment内を `002D^U で終端する ]のを制約する場合、~toolは,そのような~commentの終端に 1 個の `0020^U を挿入して~MAY。 ◎ If the XML API restricts comments from ending in a U+002D HYPHEN-MINUS character (-), the tool may insert a single U+0020 SPACE character at the end of such comments.

~XML~APIが[ 文字~data/ 属性~値 /~comment ]内に許容される文字を制約する場合、~toolは, `000C^U は `0020^U に, その他の~literal【すなわち,文字~参照に~escapeされていない】非~XML文字は `FFFD^U に置換して~MAY。 ◎ If the XML API restricts allowed characters in character data, attribute values, or comments, the tool may replace any U+000C FORM FEED (FF) character with a U+0020 SPACE character, and any other literal non-XML character with a U+FFFD REPLACEMENT CHARACTER.

帯域外の情報を伝達する仕方がない~toolは、次の情報を落として~MAY: ◎ If the tool has no way to convey out-of-band information, then the tool may drop the following information:

  • 文書の`~mode$docは[ `no-quirks^l, `limited-quirks^l, `quirks^l ]のどれに設定されているか ◎ Whether the document is set to no-quirks mode, limited-quirks mode, or quirks mode
  • ~form-controlと,[ それに最も近い先祖 `form$e 要素ではない `form$e 要素 ]との結付け(構文解析器における`~form要素~pointer$の利用) ◎ The association between form controls and forms that aren't their nearest form element ancestor (use of the form element pointer in the parser)
  • `template$e 要素の`~template内容$ ◎ The template contents of any template elements.

注記: この節により許容される変異が適用されるのは、`~HTML構文解析器$の規則が適用されたになる。 例えば、開始tag `<a::>^l は,終了tag `</a::>^l で閉じられることになり、終了tag `</aU00003AU00003A>^l で閉じられることは,決してない — ~UAが,上を規則を利用していて,開始tagに対する名前 `aU00003AU00003A^l の要素を実際に~DOM内に生成する場合でも。 ◎ The mutations allowed by this section apply after the HTML parser's rules have been applied. For example, a <a::> start tag will be closed by a </a::> end tag, and never by a </aU00003AU00003A> end tag, even if the user agent is using the rules above to then generate an actual element in the DOM with the name aU00003AU00003A for that start tag.

12.2.9. 構文解析器における~errorの取扱いと変則的な事例の序論

~INFORMATIVE

この節では、~error含みの~markupをいくつか精査し,`~HTML構文解析器$がこれらの事例をどう取扱うかを論じる。 ◎ This section examines some erroneous markup and discusses how the HTML parser handles these cases.

12.2.9.1. 誤入子な~tag:`<b><i></b></i>^c

~INFORMATIVE

次のような~markupは、~error含みの例として,最もよく論じられる: ◎ The most-often discussed example of erroneous markup is as follows:

<p>1<b>2<i>3</b>4</i>5</p>

この~markupの構文解析は、 `3^l までは素直に進む。 この時点での~DOMは、次の様な見かけになる: ◎ The parsing of this markup is straightforward up to the "3". At this point, the DOM looks like this:

  • `html$e
    • `head$e
    • `body$e
      • `p$e
        • `#text$: 1
        • `b$e
          • `#text$: 2
          • `i$e
            • `#text$: 3

この時点で、`~open要素~stack$は 順に 5 個の要素 — `html$e, `body$e, `p$e, `b$e, `i$e — からなり,`作動中の整形~要素~list$は 2 個の要素 — `b$e, `i$e — からなり,`挿入~mode$は`~body内$mdになる。 ◎ Here, the stack of open elements has five elements on it: html, body, p, b, and i. The list of active formatting elements just has two: b and i. The insertion mode is "in body".

~tag名に `b^l を伴う終了tag~tokenを受取ったときには、`養子縁組~algo$が呼出される。 これは単純な事例であり、 %整形~要素 は `b$e 要素, %最遠の~block はない。 したがって`~open要素~stack$は 3 個の要素 — `html$e, `body$e, `p$e — からなる一方で,`作動中の整形~要素~list$は `i$e 要素 1 個だけからなる。 この時点では、~DOM木はまだ改変されない。 ◎ Upon receiving the end tag token with the tag name "b", the "adoption agency algorithm" is invoked. This is a simple case, in that the formatting element is the b element, and there is no furthest block. Thus, the stack of open elements ends up with just three elements: html, body, and p, while the list of active formatting elements has just one: i. The DOM tree is unmodified at this point.

次n~tokenは文字 `4^l であり、`作動中の整形~要素たちを再構築する$ — この事例では、 `i$e 要素だけ — を誘発する。 したがって, `Text$I ~node `4^l 用に新たな `i$e 要素が作成される。 `i^l に対する終了tag~tokenも受取った後には, `Text$I ~node `5^l も挿入され、~DOMは次の様になる: ◎ The next token is a character ("4"), triggers the reconstruction of the active formatting elements, in this case just the i element. A new i element is thus created for the "4" Text node. After the end tag token for the "i" is also received, and the "5" Text node is inserted, the DOM looks as follows:

  • `html$e
    • `head$e
    • `body$e
      • `p$e
        • `#text$: 1
        • `b$e
          • `#text$: 2
          • `i$e
            • `#text$: 3
        • `i$e
          • `#text$: 4
        • `#text$: 5

12.2.9.2. 誤入子な~tag: `<b><p></b></p>^c

~INFORMATIVE

前~節に類似する事例: ◎ A case similar to the previous one is the following:

<b>1<p>2</b>3</p>

ここでの構文解析は、 `2^l の所までは素直に進む: ◎ Up to the "2" the parsing here is straightforward:

  • `html$e
    • `head$e
    • `body$e
      • `b$e
        • `#text$: 1
        • `p$e
          • `#text$: 2

関心があるのは、~tag名に `b^l を伴う終了tag~tokenが構文解析されるときである。 ◎ The interesting part is when the end tag token with the tag name "b" is parsed.

その~tokenに出くわす前までは、`~open要素~stack$は 4 個の要素 — `html$e, `body$e, `b$e, `p$e — からなり,`作動中の整形~要素~list$は `b$e のみからなり,`挿入~mode$は`~body内$mdになる。 ◎ Before that token is seen, the stack of open elements has four elements on it: html, body, b, and p. The list of active formatting elements just has the one: b. The insertion mode is "in body".

~tag名に `b^l を伴う終了tag~tokenを受取るときには、前の例と同じく`養子縁組~algo$が呼出される。 しかしながら,今度の事例では %最遠の~block として `p$e 要素があるので、養子縁組~algoは飛ばされない。 ◎ Upon receiving the end tag token with the tag name "b", the "adoption agency algorithm" is invoked, as in the previous example. However, in this case, there is a furthest block, namely the p element. Thus, this time the adoption agency algorithm isn't skipped over.

%共通の先祖 は `body$e 要素。 概念的な “~bookmark” は`作動中の整形~要素~list$における `b$e の位置を~markするが、その~listを成す要素は 1 個だけなので、~bookmarkによる効果はたいしてない。 ◎ The common ancestor is the body element. A conceptual "bookmark" marks the position of the b in the list of active formatting elements, but since that list has only one element in it, the bookmark won't have much effect.

~algoが進捗するに伴い、 %~node は整形~要素 ( `b$e )に設定され, %最後の~node は %最遠の~block( `p$e )に設定される。 ◎ As the algorithm progresses, node ends up set to the formatting element (b), and last node ends up set to the furthest block (p).

%最後の~node は、~DOMが次の様な見かけになるよう, %共通の先祖 に付加されることになる(移動される): ◎ The last node gets appended (moved) to the common ancestor, so that the DOM looks like:

  • `html$e
    • `head$e
    • `body$e
      • `b$e
        • `#text$: 1
      • `p$e
        • `#text$: 2

新たな `b$e 要素が作成され, `p$e 要素の子たちはそこに移動される: ◎ A new b element is created, and the children of the p element are moved to it:

  • `html$e
    • `head$e
    • `body$e
      • `b$e
        • `#text$: 1
      • `p$e
  • `b$e
    • `#text$: 2

最終的に,新たな `b$e 要素は、~DOMが次の様な見かけになるよう, `p$e 要素に付加される: ◎ Finally, the new b element is appended to the p element, so that the DOM looks like:

  • `html$e
    • `head$e
    • `body$e
      • `b$e
        • `#text$: 1
      • `p$e
        • `b$e
          • `#text$: 2

`b$e 要素は、 `3^l が構文解析されるときに `p$e 要素に付加されるよう,[ `作動中の整形~要素~list$, `~open要素~stack$ ]から除去される: ◎ The b element is removed from the list of active formatting elements and the stack of open elements, so that when the "3" is parsed, it is appended to the p element:

  • `html$e
    • `head$e
    • `body$e
      • `b$e
        • `#text$: 1
      • `p$e
        • `b$e
          • `#text$: 2
        • `#text$: 3

12.2.9.3. ~table内の予期されない~markup

~INFORMATIVE

~tableにおける~errorの取扱いは、歴史的~理由から,とりわけ変則的である。 例えば、次の~markupを考える: ◎ Error handling in tables is, for historical reasons, especially strange. For example, consider the following markup:

<table><b><tr><td>aaa</td></tr>bbb</table>ccc

上の様な強調されている `b$e 要素の開始tagは,~tableの内側には直には許容されないので、構文解析器はこの事例に対しては,要素を~tableのに置くように取扱う(これは、`親を違える$と呼ばれる)。 これは、~DOM木を精査すれば見つかる — それは `table$e 要素の開始tagに出くわした直後に~~現れるので: ◎ The highlighted b element start tag is not allowed directly inside a table like that, and the parser handles this case by placing the element before the table. (This is called foster parenting.) This can be seen by examining the DOM tree as it stands just after the table element's start tag has been seen:

  • `html$e
    • `head$e
    • `body$e
      • `table$e

`b$e 要素の開始tagに出くわした直後には、次の様になる: ◎ ...and then immediately after the b element start tag has been seen:

  • `html$e
    • `head$e
    • `body$e
      • `b$e
      • `table$e

この時点では、`~open要素~stack$は[ `html$e, `body$e, `table$e, `b$e ]要素からなり(結果の~DOM木に関わらず,この順序になる),`作動中の整形~要素~list$は `b$e 要素のみからなり,`挿入~mode$は`~table内$mdになる。 ◎ At this point, the stack of open elements has on it the elements html, body, table, and b (in that order, despite the resulting DOM tree); the list of active formatting elements just has the b element in it; and the insertion mode is "in table".

`tr$e 開始tagは、 `b$e 要素を~stackから~popさせ, `tbody$e 開始tagが黙示されることになる — 次の `tbody$e と `tr$e 要素は素直に取扱われ,構文解析器が挿入~mode[ `~table~body内$md, `~row内$md ]を経るように導く。 結果の~DOMは、次の様になる: ◎ The tr start tag causes the b element to be popped off the stack and a tbody start tag to be implied; the tbody and tr elements are then handled in a rather straight-forward manner, taking the parser through the "in table body" and "in row" insertion modes, after which the DOM looks as follows:

  • `html$e
    • `head$e
    • `body$e
      • `b$e
      • `table$e
        • `tbody$e
          • `tr$e

ここでの`~open要素~stack$は[ `html$e, `body$e, `table$e, `tbody$e, `tr$e ]要素からなり,`作動中の整形~要素~list$は依然として `b$e 要素のみからなり,`挿入~mode$は`~row内$mdになる。 ◎ Here, the stack of open elements has on it the elements html, body, table, tbody, and tr; the list of active formatting elements still has the b element in it; and the insertion mode is "in row".

`td$e 要素を木に置いた後、その開始tag~tokenは,`作動中の整形~要素~list$に`~marker$を置く(それはまた,`~cell内$mdに切替える)。 ◎ The td element start tag token, after putting a td element on the tree, puts a marker on the list of active formatting elements (it also switches to the "in cell" insertion mode).

  • `html$e
    • `head$e
    • `body$e
      • `b$e
      • `table$e
        • `tbody$e
          • `tr$e
            • `td$e

この`~marker$は、[ 文字~token列 `aaa^l に出くわしたとき、[ それによる結果の `Text$I ~nodeを保持するために `b$e 要素を作成する ]ことはない ]ことを意味する: ◎ The marker means that when the "aaa" character tokens are seen, no b element is created to hold the resulting Text node:

  • `html$e
    • `head$e
    • `body$e
      • `b$e
      • `table$e
        • `tbody$e
          • `tr$e
            • `td$e
              • `#text$: aaa

終了tagたちは,素直に取扱われ、それらを取扱った後には,`~open要素~stack$は[ `html$e, `body$e, `table$e, `tbody$e ]要素からなり,`作動中の整形~要素~list$は 依然として `b$e 要素のみからなり(`~marker$は `td^l 終了tag~tokenによりすでに除去されている),`挿入~mode$は`~table~body内$mdになる。 ◎ The end tags are handled in a straight-forward manner; after handling them, the stack of open elements has on it the elements html, body, table, and tbody; the list of active formatting elements still has the b element in it (the marker having been removed by the "td" end tag token); and the insertion mode is "in table body".

したがって見出されるのは、文字~token列 `bbb^l になる。 これらは`~table~text内$mdの利用を誘発する( `元の挿入~mode$V を`~table~body内$mdに設定して)。 この文字~token列は収集され、次n~token( `table$e 要素の終了tag)に出くわしたときには,~groupとして処理される。 それらには~space以外も混じっているので、`~table内$mdにおける “~AnyElse” 規則に従って取扱われる — それは、`親を違える$下で,`~body内$mdに先送りする。 ◎ Thus it is that the "bbb" character tokens are found. These trigger the "in table text" insertion mode to be used (with the original insertion mode set to "in table body"). The character tokens are collected, and when the next token (the table element end tag) is seen, they are processed as a group. Since they are not all spaces, they are handled as per the "anything else" rules in the "in table" insertion mode, which defer to the "in body" insertion mode but with foster parenting.

`作動中の整形~要素たちを再構築する$ときには、`親を違える$ように `b$e 要素が作成され, `Text$I ~node `bbb^l はそれに付加される: ◎ When the active formatting elements are reconstructed, a b element is created and foster parented, and then the "bbb" Text node is appended to it:

  • `html$e
    • `head$e
    • `body$e
      • `b$e
      • `b$e
        • `#text$: bbb
      • `table$e
        • `tbody$e
          • `tr$e
            • `td$e
              • `#text$: aaa

`~open要素~stack$は[ `html$e, `body$e, `table$e, `tbody$e, 新たな `b$e ]要素からなり(ここでも,順序は結果の木には合致しないことに注意!), `作動中の整形~要素~list$は 新たな `b$e 要素からなり,`挿入~mode$は依然として `~table~body内$mdになる。 ◎ The stack of open elements has on it the elements html, body, table, tbody, and the new b (again, note that this doesn't match the resulting tree!); the list of active formatting elements has the new b element in it; and the insertion mode is still "in table body".

文字~token列が `bbb^l に代えて`~ASCII空白$のみからなっていた場合、単に `tbody$e 要素に付加されることになる。 ◎ Had the character tokens been only ASCII whitespace instead of "bbb", then that ASCII whitespace would just be appended to the tbody element.

最終的に `table$e は、終了tag `table^l により閉じられる。 これは,`~open要素~stack$から `table$e 要素までの~nodeすべてを~popさせるが,`作動中の整形~要素~list$には影響しないので、 `table^e の後にある文字~token列 `ccc^l は,今度は `table^e の後に もう一つ作成される `b$e 要素~内に置かれる: ◎ Finally, the table is closed by a "table" end tag. This pops all the nodes from the stack of open elements up to and including the table element, but it doesn't affect the list of active formatting elements, so the "ccc" character tokens after the table result in yet another b element being created, this time after the table:

  • `html$e
    • `head$e
    • `body$e
      • `b$e
      • `b$e
        • `#text$: bbb
      • `table$e
        • `tbody$e
          • `tr$e
            • `td$e
              • `#text$: aaa
      • `b$e
        • `#text$: ccc

12.2.9.4. 構文解析されている頁を改変する~script

~INFORMATIVE

次の~markupを考える。 この例においては、“内縁” 文書( `~URL$ `https://example.com/inner^l )は,別の “外縁” 文書( `~URL$ `https://example.com/outer^l )内で `iframe$e の内容として具現化されているとする: ◎ Consider the following markup, which for this example we will assume is the document with URL https://example.com/inner, being rendered as the content of an iframe in another document with the URL https://example.com/outer:

<div id=a>
 <script>
  var %div = document.getElementById('a');
  parent.document.body.appendChild(%div);
 </script>
 <script>
  alert(document.URL);
 </script>
</div>

<script>
 alert(document.URL);
</script>

1 個目の `script^l 終了tagまでの,~scriptが構文解析される前の結果は、比較的~素直に進む: ◎ Up to the first "script" end tag, before the script is parsed, the result is relatively straightforward:

  • `html$e
    • `head$e
    • `body$e
      • `div$e `id$a="`a^c"
        • `#text$:
        • `script$e
          • `#text$: var %div = document.getElementById('a'); ⏎ parent.document.body.appendChild(%div);

が、~scriptが構文解析された後では, `div$e 要素とその子 `script$e 要素は去る: ◎ After the script is parsed, though, the div element and its child script element are gone:

  • `html$e
    • `head$e
    • `body$e

去ったそれらは、この時点で,前述の 外縁`閲覧文脈$の`文書$内にある。 しかしながら,`~open要素~stack$は依然として `div$e 要素を包含する。 ◎ They are, at this point, in the Document of the aforementioned outer browsing context. However, the stack of open elements still contains the div element.

したがって, 2 個目の `script$e 要素が構文解析されるとき、それは 外縁 `文書$の中に挿入される。 ◎ Thus, when the second script element is parsed, it is inserted into the outer Document object.

構文解析器が作成したものとは異なる`文書$用に構文解析されるものは,実行されないので、 1 個目の~alertは示されない。 ◎ Those parsed into different Documents than the one the parser was created for do not execute, so the first alert does not show.

`div$e 要素の終了tagが構文解析されたなら、 `div$e 要素は~stackから~popされるので, 3 個目の `script$e 要素は内縁 `文書$内にある: ◎ Once the div element's end tag is parsed, the div element is popped off the stack, and so the next script element is in the inner Document:

  • `html$e
    • `head$e
    • `body$e
      • `script$e
        • `#text$: alert(document.URL);

この~scriptが実行される結果、 `https://example.com/inner^l を示す~alertが生じる。 ◎ This script does execute, resulting in an alert that says "https://example.com/inner".

12.2.9.5. 複数の文書にまたがって移動する~scriptの実行

~INFORMATIVE

前~節の例から更に詳しく、 2 個目の `script$e 要素は外部~scriptである(すなわち, `src$a 属性を有する)事例を考える。 要素は作成-時点では構文解析器の`文書$内にはなかったので、この外部~scriptは~downloadすらされない。 ◎ Elaborating on the example in the previous section, consider the case where the second script element is an external script (i.e. one with a src attribute). Since the element was not in the parser's Document when it was created, that external script is not even downloaded.

`src$a 属性を有する `script$e 要素が 通常のように 構文解析器の`文書$の中へ構文解析されつつ, その外部~scriptの~download中に 要素が別の文書へ移動された場合、~downloadは継続されるが,~scriptは実行されない。 ◎ In a case where a script element with a src attribute is parsed normally into its parser's Document, but while the external script is being downloaded, the element is moved to another document, the script continues to download, but does not execute.

注記: 一般に、 `script$e 要素を`文書$間で移動することは,不良な実施と見なされる。 ◎ In general, moving script elements between Documents is considered a bad practice.

12.2.9.6. 閉じられてない整形~要素

~INFORMATIVE

次の~markupに、入子にされた整形~要素( `b$e など)が — それを包含する要素が閉じられても — 収集され,適用され続けることになる様子を示す。 ただし、過度の重複は棄てられる。 ◎ The following markup shows how nested formatting elements (such as b) get collected and continue to be applied even as the elements they are contained in are closed, but that excessive duplicates are thrown away.

<!DOCTYPE html>
<p><b class=x><b class=x><b><b class=x><b class=x><b>X
<p>X
<p><b><b class=x><b>X
<p></b></b></b></b></b></b>X

結果の~DOM木は、次の様になる: ◎ The resulting DOM tree is as follows:

  • DOCTYPE: `html^c
  • `html$e
    • `head$e
    • `body$e
      • `p$e
        • `b$e `class$a="`x^c"
          • `b$e `class$a="`x^c"
            • `b$e
              • `b$e `class$a="`x^c"
                • `b$e `class$a="`x^c"
                  • `b$e
                    • `#text$: X⏎
      • `p$e
        • `b$e `class$a="`x^c"
          • `b$e
            • `b$e `class$a="`x^c"
              • `b$e `class$a="`x^c"
                • `b$e
                  • `#text$: X⏎
      • `p$e
        • `b$e `class$a="`x^c"
          • `b$e
            • `b$e `class$a="`x^c"
              • `b$e `class$a="`x^c"
                • `b$e
                  • `b$e
                    • `b$e `class$a="`x^c"
                      • `b$e
                        • `#text$: X⏎
      • `p$e
        • `#text$: X⏎

この~markup内の 2 個目の `p$e 要素は,明示的な `b$e 要素を持たないが、結果の~DOM内では,要素の `X^l の前にて 3 個までの各~種類の整形~要素(この事例では、 `class^a 属性を有する 3 個の `b$e 要素と, 有さない 2 個の `b$e 要素)が再構築されることになる様子に注意。 ◎ Note how the second p element in the markup has no explicit b elements, but in the resulting DOM, up to three of each kind of formatting element (in this case three b elements with the class attribute, and two unadorned b elements) get reconstructed before the element's "X".

この地点までに 9 個の `b$e 開始tagに出くわしたが、このことは,[ 最後の段落において、`作動中の整形~要素~list$内で完全に~clearする必要があるのは, 6 個の `b$e 終了tagに限られる ]ことを意味するのにも注意。 ◎ Also note how this means that in the final paragraph only six b end tags are needed to completely clear the list of active formatting elements, even though nine b start tags have been seen up to this point.

12.3. ~HTML素片の直列化-法

【 この節の内容は、別ページにて。 】

12.4. ~HTML素片の構文解析-法

`~HTML素片の構文解析~algo@ は,以下に述べる手続きで与えられる — この~algoは、次の 2 つを入力にとり, 0 個~以上の~nodeからなる~listを返す:

  • `文脈~要素@V と称される,構文解析器~用の文脈を与える `Element$I ~node
  • 構文解析する文字列 %入力

この~algoにより作成される構文解析器は、 `~HTML素片~用@ であるとされる。

◎ The following steps form the HTML fragment parsing algorithm. The algorithm takes as input an Element node, referred to as the context element, which gives the context for the parser, as well as input, a string to parse, and returns a list of zero or more nodes.

注記: 構文解析器~節における各種~algoにおいて `素片~事例@ と~markされた箇所は、構文解析器が この~algoの目的で作成されときに限り生じる。 そのような~markは、参考~目的に限って注釈されており,規範的な重みはない。 `素片~事例$として述べられた条件は、構文解析器が この~algoを取扱う目的で作成されたものでない場合でも,生じる可能性がある — それは,この仕様における 【~markの】 誤りである。 ◎ Parts marked fragment case in algorithms in the parser section are parts that only occur if the parser was created for the purposes of this algorithm. The algorithms have been annotated with such markings for informational purposes only; such markings have no normative weight. If it is possible for a condition described as a fragment case to occur even when the parser wasn't created for the purposes of handling this algorithm, then that is an error in the specification.

  1. %文書 ~LET 新たな`文書$ ◎ Create a new Document node, and\
  2. %文書 の`種別$doc ~SET `html^l ◎ mark it as being an HTML document.
  3. %文書 の`~mode$doc ~SET `文脈~要素$V の`~node文書$の`~mode$doc ◎ If the node document of the context element is in quirks mode, then let the Document be in quirks mode. Otherwise, the node document of the context element is in limited-quirks mode, then let the Document be in limited-quirks mode. Otherwise, leave the Document in no-quirks mode.
  4. %構文解析器 ~LET 新たな `~HTML構文解析器$ ◎ Create a new HTML parser, and\
  5. %構文解析器 を %文書 に結付ける ◎ associate it with the just created Document node.
  6. %構文解析器 の`~token化~段階$の状態 ~SET `文脈~要素$V に応じて,次で与えられる`状態$: ◎ Set the state of the HTML parser's tokenization stage as follows, switching on the context element:

    `title$e
    `textarea$e
    `~RCDATA$st ◎ Switch the tokenizer to the RCDATA state.
    `style$e
    `xmp$e
    `iframe$e
    `noembed$e
    `noframes$e
    `~RAWTEXT$st ◎ Switch the tokenizer to the RAWTEXT state.
    `script$e
    `~script~data$st ◎ Switch the tokenizer to the script data state.
    `noscript$e
    `~scripting~flag$に応じて ⇒# `可能化^i ならば `~RAWTEXT$st / `不能化^i ならば `~data$st ◎ If the scripting flag is enabled, switch the tokenizer to the RAWTEXT state. Otherwise, leave the tokenizer in the data state.
    `plaintext$e
    `~PLAINTEXT$st ◎ Switch the tokenizer to the PLAINTEXT state.
    その他 ◎ Any other element
    `~data$st ◎ Leave the tokenizer in the data state.

    注記: 実装は、処理能の理由から[ ~errorを報告しない, かつ この仕様に述べた実際の状態~機械を直に利用する ]ならば,上に挙げた[ `~RAWTEXT^st / `~script~data^st ]に代えて `~PLAINTEXT^st を利用することもできる。 それらは、~perrorに関する規則を除き等価である — `素片~事例$には`適切な終了tag~token$はないので , yet【?】 それらが孕む状態~遷移はずっと少ない。 ◎ For performance reasons, an implementation that does not report errors and that uses the actual state machine described in this specification directly could use the PLAINTEXT state instead of the RAWTEXT and script data states where those are mentioned in the list above. Except for rules regarding parse errors, they are equivalent, since there is no appropriate end tag token in the fragment case, yet they involve far fewer state transitions.

  7. %根 ~LET 属性を伴わない,新たな `html$e 要素 ◎ Let root be a new html element with no attributes.
  8. %文書 に %根 を付加する ◎ Append the element root to the Document node created above.
  9. %構文解析器 の`~open要素~stack$は %根 のみを包含するように設定しておく ◎ Set up the parser's stack of open elements so that it contains just the single element root.
  10. ~IF[ `文脈~要素$V は `template$e 要素である ] ⇒ `~template挿入~mode~stack$に`~template内$mdを~pushする ◎ If the context element is a template element, push "in template" onto the stack of template insertion modes so that it is the new current template insertion mode.
  11. %開始tag~token ~LET 新たな開始tag~token( `文脈~要素$V の局所~名 ) ◎ Create a start tag token whose name is the local name of context and\
  12. %開始tag~token の属性~list ~SET `文脈~要素$V の属性~list ◎ whose attributes are the attributes of context.
  13. %開始tag~token を[ `文脈~要素$V を作成させた開始tag~token ]とする

    注記: これは例えば、`~HTML統合~地点$であるかどうか決定するときに利用される。

    ◎ Let this start tag token be the start tag token of the context node, e.g. for the purposes of determining if it is an HTML integration point.
  14. %構文解析器 の`挿入~modeを適切に再設定する$ ◎ Reset the parser's insertion mode appropriately.

    注記: %構文解析器 は その~algoの一部として `文脈~要素$V を参照することになる。 ◎ The parser will reference the context element as part of that algorithm.

  15. %構文解析器 の`~form要素~pointer$ ~SET `文脈~要素$V または その先祖に `form$e 要素が[ 在れば それらのうち `文脈~要素$V に最も近いもの / 無ければ ~NULL ] ◎ Set the parser's form element pointer to the nearest node to the context element that is a form element (going straight up the ancestor chain, and including the element itself, if it is a form element), if any. (If there is no such form element, the form element pointer keeps its initial value, null.)
  16. [ 符号化法の`確度$ ~SET `無関係^i ]とする下で、 %構文解析器 の`入力~stream$の中へ %入力 を流す ◎ Place the input into the input stream for the HTML parser just created. The encoding confidence is irrelevant.
  17. 入力~streamをすべて消費するまで、 %構文解析器 を走らす ◎ Start the parser and let it run until it has consumed all the characters just inserted into the input stream.
  18. ~RET %根 の子~nodeたちからなる`木~順序$による~list ◎ Return the child nodes of root, in tree order.