| 1 |
apache |
1.7 |
#pattern
|
| 2 |
|
|
<span class=secno>* </span>Parsing HTML documents
|
| 3 |
apache |
1.4 |
#ja
|
| 4 |
apache |
1.7 |
<span class=secno>$1 </span>HTML 文書の構文解析
|
| 5 |
apache |
1.4 |
|
| 6 |
|
|
#en
|
| 7 |
|
|
<em>This section only applies to user agents, data mining tools, and
|
| 8 |
|
|
conformance checkers.</em>
|
| 9 |
|
|
#ja
|
| 10 |
|
|
<em>この節は利用者エージェント、データ・マイニング・ツール、
|
| 11 |
|
|
適合性検査器のみに適用されます。</em>
|
| 12 |
|
|
|
| 13 |
|
|
#en
|
| 14 |
|
|
The rules for parsing <a href="#xml-documents">XML documents</a> (and
|
| 15 |
|
|
thus <a href="#xhtml5">XHTML</a> documents) into DOM trees are covered by
|
| 16 |
|
|
the XML and Namespaces in XML specifications, and are out of scope of this
|
| 17 |
|
|
specification. <a href="#refsXML">[XML]</a> <a
|
| 18 |
|
|
href="#refsXMLNS">[XMLNS]</a> <!-- XXX refs -->
|
| 19 |
|
|
#ja
|
| 20 |
|
|
<a href="#xml-documents">XML 文書</a> (や <a href="#xhtml5">XHTML</a> 文書)
|
| 21 |
|
|
を構文解析して DOM 木を得るための規則は XML や XML 名前空間の仕様書で扱われており、
|
| 22 |
|
|
この仕様書の適用範囲外です。 <a href="#refsXML">[XML]</a> <a
|
| 23 |
|
|
|
| 24 |
|
|
#en
|
| 25 |
|
|
For <a href="#html-">HTML documents</a>, user agents must use the
|
| 26 |
|
|
parsing rules described in this section to generate the DOM trees.
|
| 27 |
|
|
Together, these rules define what is referred to as the <dfn
|
| 28 |
|
|
id=html-0>HTML parser</dfn>.
|
| 29 |
|
|
#ja
|
| 30 |
|
|
<a href="#html-">HTML 文書</a>については、利用者エージェントは、 DOM
|
| 31 |
|
|
木を生成するためにこの節で説明する構文解析規則を使用しなければ[[MUST:なりません]]。
|
| 32 |
|
|
また、この規則は<dfn
|
| 33 |
|
|
id=html-0>HTML 構文解析器</dfn>と呼ばれるものを定義します。
|
| 34 |
|
|
|
| 35 |
|
|
#en
|
| 36 |
|
|
While the HTML form of HTML5 bears a close resemblance to SGML and XML,
|
| 37 |
|
|
it is a separate language with its own parsing rules.
|
| 38 |
|
|
#ja
|
| 39 |
|
|
HTML5 の HTML 形式は SGML や XML によく似ていますが、
|
| 40 |
|
|
独自の構文解析規則を持つ別の言語です。
|
| 41 |
|
|
|
| 42 |
|
|
#en
|
| 43 |
|
|
Some earlier versions of HTML (in particular from HTML2 to HTML4) were
|
| 44 |
|
|
based on SGML and used SGML parsing rules. However, few (if any) web
|
| 45 |
|
|
browsers ever implemented true SGML parsing for HTML documents; the only
|
| 46 |
|
|
user agents to strictly handle HTML as an SGML application have
|
| 47 |
|
|
historically been validators. The resulting confusion — with
|
| 48 |
|
|
validators claiming documents to have one representation while widely
|
| 49 |
|
|
deployed Web browsers interoperably implemented a different
|
| 50 |
|
|
representation — has wasted decades of productivity. This version
|
| 51 |
|
|
of HTML thus returns to a non-SGML basis.
|
| 52 |
|
|
#ja
|
| 53 |
|
|
以前のいくつかの版の HTML (特に HTML2 から HTML4 まで) は SGML
|
| 54 |
|
|
に基づき、 SGML の構文解析規則を用いていました。しかし、 HTML
|
| 55 |
|
|
文書用に真の SGML 構文解析を実装していたウェブ・ブラウザは (あったとしても)
|
| 56 |
|
|
皆無に近い数でした。 HTML を厳密に SGML 応用として扱う唯一の利用者エージェントは歴史的に妥当性検証器だけでした。
|
| 57 |
|
|
その結果、妥当性検査器は文書がある形式であることを要求し、
|
| 58 |
|
|
一方で広く実用されている Web ブラウザはそれとは異なる形式を相互運用可能な形で実装するという混乱が生じ、
|
| 59 |
|
|
生産性を大きく低下させています。
|
| 60 |
|
|
ですので、この版の HTML は非 SGML ベースに回帰します。
|
| 61 |
|
|
|
| 62 |
|
|
#en
|
| 63 |
|
|
Authors interested in using SGML tools in their authoring pipeline are
|
| 64 |
|
|
encouraged to use XML tools and the XML serialization of HTML5.
|
| 65 |
|
|
#ja
|
| 66 |
|
|
文書準備の過程で SGML ツールを使いたいと考える著者には、
|
| 67 |
|
|
XML ツールと HTML5 の XML 直列化を用いることをお勧めします。
|
| 68 |
|
|
|
| 69 |
|
|
#en
|
| 70 |
|
|
This specification defines the parsing rules for HTML documents, whether
|
| 71 |
|
|
they are syntactically correct or not. Certain points in the parsing
|
| 72 |
|
|
algorithm are said to be <dfn id=parse2 title="parse error">parse
|
| 73 |
|
|
errors</dfn>. The error handling for parse errors is well-defined: user
|
| 74 |
|
|
agents must either act as described below when encountering such problems,
|
| 75 |
|
|
or must abort processing at the first error that they encounter for which
|
| 76 |
|
|
they do not wish to apply the rules described below.
|
| 77 |
|
|
#ja
|
| 78 |
|
|
この仕様書は、構文的に正しいか否かに関わらず HTML
|
| 79 |
|
|
文書を構文解析する規則を定義します。構文解析算法中のいくつかの箇所は<dfn id=parse2 title="parse error">構文解析誤り</dfn>であるとしています。
|
| 80 |
|
|
構文解析誤りの処理は明確に定義します。利用者エージェントは、
|
| 81 |
|
|
そのような問題に遭遇したときに後述のように動作するか、または後述の規則を適用することを望まないような誤りにはじめて遭遇した箇所で処理を停止しなければ[[MUST:なりません]]。
|
| 82 |
|
|
|
| 83 |
|
|
#en
|
| 84 |
|
|
Conformance checkers must report at least one parse error condition to
|
| 85 |
|
|
the user if one or more parse error conditions exist in the document and
|
| 86 |
|
|
must not report parse error conditions if none exist in the document.
|
| 87 |
|
|
Conformance checkers may report more than one parse error condition if
|
| 88 |
|
|
more than one parse error conditions exist in the document. Conformance
|
| 89 |
|
|
checkers are not required to recover from parse errors.
|
| 90 |
|
|
#ja
|
| 91 |
|
|
適合性検査器は、文書中に1つ以上の構文解析誤り条件が存在する場合、利用者に最低1つの構文解析誤り条件を報告しなければ[[MUST:ならず]]、
|
| 92 |
|
|
文書に誤りが存在しない場合、構文解析誤り条件を報告しては[[MUST NOT:なりません]]。
|
| 93 |
|
|
適合性検査器は、文書中に複数の構文解析誤り条件が存在する場合、
|
| 94 |
|
|
複数の構文解析誤り条件を報告して[[MAY:構いません]]。
|
| 95 |
|
|
適合性検査器は構文解析誤りから回復することを[[REQUIRED:要求]]されません。
|
| 96 |
|
|
|
| 97 |
|
|
#en
|
| 98 |
|
|
Parse errors are only errors with the <em>syntax</em> of
|
| 99 |
|
|
HTML. In addition to checking for parse errors, conformance checkers will
|
| 100 |
|
|
also verify that the document obeys all the other conformance requirements
|
| 101 |
|
|
described in this specification.
|
| 102 |
|
|
#ja
|
| 103 |
|
|
構文解析誤りは、 HTML の<em>構文</em>の誤りに過ぎません。
|
| 104 |
|
|
適合性検査器は、構文解析誤りの検査に加え、
|
| 105 |
|
|
文書がこの仕様書で説明されている他の適合性要件に従っているかも検査することになります。
|
| 106 |
apache |
1.7 |
|
| 107 |
|
|
|
| 108 |
|
|
#pattern
|
| 109 |
|
|
<span class=secno>* </span>The scripting state
|
| 110 |
|
|
#ja
|
| 111 |
|
|
<span class=secno>$1 </span>スクリプティング状態
|
| 112 |
|
|
|
| 113 |
|
|
#en
|
| 114 |
|
|
The <dfn id=scripting2>scripting flag</dfn> is set to "enabled" if the
|
| 115 |
|
|
<code>Document</code> with which the parser is associated was <a
|
| 116 |
|
|
href="#with-script">with script</a> when the parser was created, and
|
| 117 |
|
|
"disabled" otherwise.
|
| 118 |
|
|
#ja
|
| 119 |
|
|
<dfn id=scripting2>スクリプティング旗</dfn>は、構文解析器が関連付けられている
|
| 120 |
|
|
<code>Document</code> が構文解析器の作成の時点で<a
|
| 121 |
|
|
href="#with-script">スクリプト付き</a>である場合には「有効」、
|
| 122 |
|
|
それ以外の場合には「無効」です。
|
| 123 |
|
|
|
| 124 |
|
|
#pattern
|
| 125 |
|
|
<span class=secno>* </span><dfn
|
| 126 |
|
|
id=tokenization0>Tokenization</dfn>
|
| 127 |
|
|
#ja
|
| 128 |
|
|
<span class=secno>$1 </span><dfn
|
| 129 |
|
|
id=tokenization0>字句化</dfn>
|
| 130 |
|
|
|
| 131 |
|
|
#en
|
| 132 |
|
|
Implementations must act as if they used the following state machine to
|
| 133 |
|
|
tokenise HTML. The state machine must start in the <a
|
| 134 |
|
|
href="#data-state">data state</a>. Most states consume a single character,
|
| 135 |
|
|
which may have various side-effects, and either switches the state machine
|
| 136 |
|
|
to a new state to <em>reconsume</em> the same character, or switches it to
|
| 137 |
|
|
a new state (to consume the next character), or repeats the same state (to
|
| 138 |
|
|
consume the next character). Some states have more complicated behavior
|
| 139 |
|
|
and can consume several characters before switching to another state.
|
| 140 |
|
|
#ja
|
| 141 |
|
|
実装は、次の状態機械を HTML の字句化に用いているかのように作用しなければ[[MUST:なりません]]。
|
| 142 |
apache |
1.8 |
状態機械は、<a
|
| 143 |
|
|
href="#data-state">データ状態</a>で開始しなければ[[MUST:なりません]]。
|
| 144 |
apache |
1.7 |
ほとんどの状態は1文字消費しますが、
|
| 145 |
|
|
この時様々な副作用を持っても[[MAY:構わない]]他、
|
| 146 |
|
|
状態機械が新しい状態に切り替えられて同じ文字を<em>再消費</em>するか、
|
| 147 |
|
|
(次の文字を消費するために) 新しい状態に切り替えられるか、
|
| 148 |
|
|
(次の文字を消費するために) 同じ状態を繰り返すかのいずれかとなります。
|
| 149 |
|
|
より複雑な動作を持っていて、他の状態に切り替える前に複数の文字を消費することがある状態もあります。
|
| 150 |
|
|
|
| 151 |
|
|
#en
|
| 152 |
|
|
The exact behavior of certain states depends on a <dfn
|
| 153 |
|
|
id=content3>content model flag</dfn> that is set after certain tokens are
|
| 154 |
|
|
emitted. The flag has several states: <em title="">PCDATA</em>, <em
|
| 155 |
|
|
title="">RCDATA</em>, <em title="">CDATA</em>, and <em
|
| 156 |
|
|
title="">PLAINTEXT</em>. Initially it must be in the PCDATA state. In the
|
| 157 |
|
|
RCDATA and CDATA states, a further <dfn id=escape>escape flag</dfn> is
|
| 158 |
|
|
used to control the behavior of the tokeniser. It is either true or false,
|
| 159 |
|
|
and initially must be set to the false state. The <span>insertion
|
| 160 |
|
|
mode</span> and the <a href="#stack">stack of open elements</a> also
|
| 161 |
|
|
affects tokenization.
|
| 162 |
|
|
#ja
|
| 163 |
|
|
特定の状態の正確な動作は、特定の字句が放出された後に設定される<dfn
|
| 164 |
|
|
id=content3>内容モデル旗</dfn>に依存します。
|
| 165 |
|
|
この旗は状態 <em title="">PCDATA</em>, <em
|
| 166 |
|
|
title="">RCDATA</em>, <em title="">CDATA</em>, <em
|
| 167 |
|
|
title="">PLAINTEXT</em> を持ちます。はじめは PCDATA
|
| 168 |
|
|
状態でなければ[[MUST:なりません]]。 RCDATA 状態と CDATA 状態では、
|
| 169 |
|
|
更に<dfn id=escape>逃避旗</dfn>が字句化器の動作を制御するために用いられます。
|
| 170 |
|
|
これは真か偽かのいずれかであり、はじめは偽の状態に設定されなければ[[MUST:なりません]]。
|
| 171 |
|
|
挿入モードと<a href="#stack">開いているようそのスタック</a>も字句化器に影響します。
|
| 172 |
|
|
|
| 173 |
|
|
#en
|
| 174 |
|
|
The output of the tokenization step is a series of zero or more of the
|
| 175 |
|
|
following tokens: DOCTYPE, start tag, end tag, comment, character,
|
| 176 |
|
|
end-of-file. DOCTYPE tokens have a name, a public identifier, a system
|
| 177 |
|
|
identifier, and a <i>force-quirks flag</i>. When a DOCTYPE token is
|
| 178 |
|
|
created, its name, public identifier, and system identifier must be marked
|
| 179 |
|
|
as missing (which is a distinct state from the empty string), and the
|
| 180 |
|
|
<i>force-quirks flag</i> must be set to <i>off</i> (its other state is
|
| 181 |
|
|
<i>on</i>). Start and end tag tokens have a tag name, a <i>self-closing
|
| 182 |
|
|
flag</i>, and a list of attributes, each of which has a name and a value.
|
| 183 |
|
|
When a start or end tag token is created, its <i>self-closing flag</i>
|
| 184 |
|
|
|
| 185 |
|
|
must be unset (its other state is that it be set), and its attributes list
|
| 186 |
|
|
must be empty. Comment and character tokens have data.
|
| 187 |
|
|
#ja
|
| 188 |
|
|
字句化期の出力は、 DOCTYPE、開始タグ、終了タグ、注釈、文字、ファイル末のいずれかの字句の零個以上の系列です。
|
| 189 |
|
|
DOCTYPE 字句は名前、公開識別子、システム識別子、<i>奇癖強制旗</i>を持ちます。
|
| 190 |
|
|
When a DOCTYPE token is
|
| 191 |
|
|
created, its name, public identifier, and system identifier must be marked
|
| 192 |
|
|
as missing (which is a distinct state from the empty string), and the
|
| 193 |
|
|
<i>force-quirks flag</i> must be set to <i>off</i> (its other state is
|
| 194 |
|
|
<i>on</i>). Start and end tag tokens have a tag name, a <i>self-closing
|
| 195 |
|
|
flag</i>, and a list of attributes, each of which has a name and a value.
|
| 196 |
|
|
When a start or end tag token is created, its <i>self-closing flag</i>
|
| 197 |
|
|
|
| 198 |
|
|
must be unset (its other state is that it be set), and its attributes list
|
| 199 |
|
|
must be empty. Comment and character tokens have data.
|
| 200 |
|
|
|
| 201 |
|
|
|
| 202 |
apache |
1.4 |
|
| 203 |
|
|
|
| 204 |
|
|
|
| 205 |
apache |
1.5 |
#pattern
|
| 206 |
|
|
<span class=secno>* </span>Parse state
|
| 207 |
|
|
#ja
|
| 208 |
|
|
<span class=secno>$1 </span>構文解析状態
|
| 209 |
|
|
|
| 210 |
|
|
#pattern
|
| 211 |
|
|
<span class=secno>* </span>The insertion mode
|
| 212 |
|
|
#ja
|
| 213 |
|
|
<span class=secno>$1 </span>挿入モード
|
| 214 |
|
|
|
| 215 |
|
|
#en
|
| 216 |
|
|
Initially the <span>insertion mode</span> is "<a href="#initial"
|
| 217 |
|
|
title="insertion mode: initial">initial</a>". It can change to "<a
|
| 218 |
|
|
href="#before4" title="insertion mode: before html">before html</a>", "<a
|
| 219 |
|
|
href="#before5" title="insertion mode: before head">before head</a>", "<a
|
| 220 |
|
|
href="#in-head" title="insertion mode: in head">in head</a>", "<a
|
| 221 |
|
|
href="#in-head0" title="insertion mode: in head noscript">in head
|
| 222 |
|
|
noscript</a>", "<a href="#after4" title="insertion mode: after head">after
|
| 223 |
|
|
head</a>", "<a href="#in-body" title="insertion mode: in body">in
|
| 224 |
|
|
body</a>", "<a href="#in-table" title="insertion mode: in table">in
|
| 225 |
|
|
table</a>", "<a href="#in-caption" title="insertion mode: in caption">in
|
| 226 |
|
|
caption</a>", "<a href="#in-column" title="insertion mode: in column
|
| 227 |
|
|
group">in column group</a>", "<a href="#in-table0" title="insertion mode:
|
| 228 |
|
|
in table body">in table body</a>", "<a href="#in-row" title="insertion
|
| 229 |
|
|
mode: in row">in row</a>", "<a href="#in-cell" title="insertion mode: in
|
| 230 |
|
|
cell">in cell</a>", "<a href="#in-select" title="insertion mode: in
|
| 231 |
|
|
select">in select</a>", "<a href="#in-select0" title="insertion mode: in
|
| 232 |
|
|
select in table">in select in table</a>", "<a href="#in-foreign"
|
| 233 |
|
|
title="insertion mode: in foreign content">in foreign content</a>", "<a
|
| 234 |
|
|
href="#after5" title="insertion mode: after body">after body</a>", "<a
|
| 235 |
|
|
href="#in-frameset" title="insertion mode: in frameset">in frameset</a>",
|
| 236 |
|
|
"<a href="#after6" title="insertion mode: after frameset">after
|
| 237 |
|
|
frameset</a>", "<a href="#after7" title="insertion mode: after after
|
| 238 |
|
|
body">after after body</a>", and "<a href="#after8" title="insertion mode:
|
| 239 |
|
|
after after frameset">after after frameset</a>" during the course of the
|
| 240 |
|
|
parsing, as described in the <a href="#tree-construction0">tree
|
| 241 |
|
|
construction</a> stage. The insertion mode affects how tokens are
|
| 242 |
|
|
processed and whether CDATA blocks are supported.
|
| 243 |
|
|
#ja
|
| 244 |
|
|
はじめ、<span>挿入モード</span>は "<a href="#initial"
|
| 245 |
|
|
title="insertion mode: initial">initial</a>" です。挿入モードは、
|
| 246 |
|
|
構文解析の過程で、<a href="#tree-construction0">木構築</a>期で説明するように、
|
| 247 |
|
|
"<a
|
| 248 |
|
|
href="#before4" title="insertion mode: before html">before html</a>", "<a
|
| 249 |
|
|
href="#before5" title="insertion mode: before head">before head</a>", "<a
|
| 250 |
|
|
href="#in-head" title="insertion mode: in head">in head</a>", "<a
|
| 251 |
|
|
href="#in-head0" title="insertion mode: in head noscript">in head
|
| 252 |
|
|
noscript</a>", "<a href="#after4" title="insertion mode: after head">after
|
| 253 |
|
|
head</a>", "<a href="#in-body" title="insertion mode: in body">in
|
| 254 |
|
|
body</a>", "<a href="#in-table" title="insertion mode: in table">in
|
| 255 |
|
|
table</a>", "<a href="#in-caption" title="insertion mode: in caption">in
|
| 256 |
|
|
caption</a>", "<a href="#in-column" title="insertion mode: in column
|
| 257 |
|
|
group">in column group</a>", "<a href="#in-table0" title="insertion mode:
|
| 258 |
|
|
in table body">in table body</a>", "<a href="#in-row" title="insertion
|
| 259 |
|
|
mode: in row">in row</a>", "<a href="#in-cell" title="insertion mode: in
|
| 260 |
|
|
cell">in cell</a>", "<a href="#in-select" title="insertion mode: in
|
| 261 |
|
|
select">in select</a>", "<a href="#in-select0" title="insertion mode: in
|
| 262 |
|
|
select in table">in select in table</a>", "<a href="#in-foreign"
|
| 263 |
|
|
title="insertion mode: in foreign content">in foreign content</a>", "<a
|
| 264 |
|
|
href="#after5" title="insertion mode: after body">after body</a>", "<a
|
| 265 |
|
|
href="#in-frameset" title="insertion mode: in frameset">in frameset</a>",
|
| 266 |
|
|
"<a href="#after6" title="insertion mode: after frameset">after
|
| 267 |
|
|
frameset</a>", "<a href="#after7" title="insertion mode: after after
|
| 268 |
|
|
body">after after body</a>", "<a href="#after8" title="insertion mode:
|
| 269 |
|
|
after after frameset">after after frameset</a>"
|
| 270 |
|
|
に変わることができます。挿入モードは、字句がどう処理されるか、 CDATA
|
| 271 |
|
|
ブロックに対応するかどうかに影響します。
|
| 272 |
|
|
|
| 273 |
|
|
#en
|
| 274 |
|
|
Seven of these modes, namely "<a href="#in-head" title="insertion mode:
|
| 275 |
|
|
in head">in head</a>", "<a href="#in-body" title="insertion mode: in
|
| 276 |
|
|
body">in body</a>", "<a href="#in-table" title="insertion mode: in
|
| 277 |
|
|
table">in table</a>", "<a href="#in-table0" title="insertion mode: in
|
| 278 |
|
|
table body">in table body</a>", "<a href="#in-row" title="insertion mode:
|
| 279 |
|
|
in row">in row</a>", "<a href="#in-cell" title="insertion mode: in
|
| 280 |
|
|
cell">in cell</a>", and "<a href="#in-select" title="insertion mode: in
|
| 281 |
|
|
select">in select</a>", are special, in that the other modes defer to them
|
| 282 |
|
|
at various times. When the algorithm below says that the user agent is to
|
| 283 |
|
|
do something "<dfn id=using8>using the rules for</dfn> the <var
|
| 284 |
|
|
title="">m</var> insertion mode", where <var title="">m</var> is one of
|
| 285 |
|
|
these modes, the user agent must use the rules described under that
|
| 286 |
|
|
<span>insertion mode</span>'s section, but must leave the <span>insertion
|
| 287 |
|
|
mode</span> unchanged (unless the rules in that section themselves switch
|
| 288 |
|
|
the <span>insertion mode</span>).
|
| 289 |
|
|
#ja
|
| 290 |
|
|
挿入モードのうちの7つ、"<a href="#in-head" title="insertion mode:
|
| 291 |
|
|
in head">in head</a>", "<a href="#in-body" title="insertion mode: in
|
| 292 |
|
|
body">in body</a>", "<a href="#in-table" title="insertion mode: in
|
| 293 |
|
|
table">in table</a>", "<a href="#in-table0" title="insertion mode: in
|
| 294 |
|
|
table body">in table body</a>", "<a href="#in-row" title="insertion mode:
|
| 295 |
|
|
in row">in row</a>", "<a href="#in-cell" title="insertion mode: in
|
| 296 |
|
|
cell">in cell</a>", "<a href="#in-select" title="insertion mode: in
|
| 297 |
|
|
select">in select</a>" は特別で、他のモードが数箇所でこれらのモードに委ねています。
|
| 298 |
|
|
後述の算法が利用者エージェントは何かを「<var
|
| 299 |
|
|
title="">m</var> 挿入モードの<dfn id=using8>規則を用いて</dfn>」
|
| 300 |
|
|
(<var title="">m</var> はこれらのモードのいずれか。) 行うと言っている時は、
|
| 301 |
|
|
利用者エージェントは、当該挿入モードの節で説明されている規則を用いなければ[[MUST:なりません]]が、
|
| 302 |
|
|
挿入モードは変更しないでおかなければ[[MUST:なりません]] (その節の規則自体が挿入モードを切り替える場合を除きます)。
|
| 303 |
|
|
|
| 304 |
|
|
#en
|
| 305 |
|
|
When the insertion mode is switched to "<a href="#in-foreign"
|
| 306 |
|
|
title="insertion mode: in foreign content">in foreign content</a>", the
|
| 307 |
|
|
<dfn id=secondary1>secondary insertion mode</dfn> is also set. This
|
| 308 |
|
|
secondary mode is used within the rules for the "<a href="#in-foreign"
|
| 309 |
|
|
title="insertion mode: in foreign content">in foreign content</a>" mode to
|
| 310 |
|
|
handle HTML (i.e. not foreign) content.
|
| 311 |
|
|
#ja
|
| 312 |
|
|
挿入モードが "<a href="#in-foreign"
|
| 313 |
|
|
title="insertion mode: in foreign content">in foreign content</a>"
|
| 314 |
|
|
に切り替えられる時には、<dfn id=secondary1>二次挿入モード</dfn>も設定されます。
|
| 315 |
|
|
この二次モードは、 "<a href="#in-foreign"
|
| 316 |
|
|
title="insertion mode: in foreign content">in foreign content</a>"
|
| 317 |
|
|
モードの規則の中で HTML (つまり、異言語でない) 内容を取り扱う際に使用します。
|
| 318 |
|
|
|
| 319 |
|
|
#en
|
| 320 |
|
|
When the steps below require the UA to <dfn id=reset>reset the insertion
|
| 321 |
|
|
mode appropriately</dfn>, it means the UA must follow these steps:
|
| 322 |
|
|
#ja
|
| 323 |
|
|
後述の段階が利用者エージェントに<dfn id=reset>挿入モードを適切に再設定する</dfn>ことを要求する場合、
|
| 324 |
|
|
利用者エージェントは次の段階に従わなければ[[MUST:ならない]]ことを意味しています。
|
| 325 |
|
|
|
| 326 |
|
|
#pattern
|
| 327 |
|
|
Let * be false.
|
| 328 |
|
|
#ja
|
| 329 |
|
|
$1 を偽とします。
|
| 330 |
|
|
|
| 331 |
|
|
#en
|
| 332 |
|
|
Let <var title="">node</var> be the last node in the <a
|
| 333 |
|
|
href="#stack">stack of open elements</a>.
|
| 334 |
|
|
#ja
|
| 335 |
|
|
<var title="">node</var> を<a
|
| 336 |
|
|
href="#stack">開いている要素のスタック</a>の最後の節点とします。
|
| 337 |
|
|
|
| 338 |
|
|
#en
|
| 339 |
|
|
If <var title="">node</var> is the first node in the stack of open
|
| 340 |
|
|
elements, then set <var title="">last</var> to true and set <var
|
| 341 |
|
|
title="">node</var> to the <var title="">context</var> element. (<a
|
| 342 |
|
|
href="#fragment">fragment case</a>)
|
| 343 |
|
|
#ja
|
| 344 |
|
|
<var title="">node</var> が開いている要素のスタックの最初の節点の場合、
|
| 345 |
|
|
<var title="">last</var> を真に設定し、 <var
|
| 346 |
|
|
title="">node</var> を <var title="">context</var> 要素に設定します。
|
| 347 |
|
|
(<a
|
| 348 |
|
|
href="#fragment">素片の場合</a>)
|
| 349 |
|
|
|
| 350 |
apache |
1.6 |
#pattern
|
| 351 |
|
|
If <var title="">node</var> is a * element, then
|
| 352 |
|
|
switch the <span>insertion mode</span> to "*" and abort these steps.
|
| 353 |
apache |
1.5 |
(<a href="#fragment">fragment case</a>)
|
| 354 |
|
|
#ja
|
| 355 |
apache |
1.6 |
<var title="">node</var> が $1 要素の場合、挿入モードを "$2" に切り替え、
|
| 356 |
apache |
1.5 |
これらの段階を停止します。
|
| 357 |
|
|
(<a
|
| 358 |
|
|
href="#fragment">素片の場合</a>)
|
| 359 |
|
|
|
| 360 |
|
|
#pattern
|
| 361 |
|
|
If <var title="">node</var> is a * element, then
|
| 362 |
|
|
switch the <span>insertion mode</span> to "*" and abort these steps.
|
| 363 |
|
|
#ja
|
| 364 |
|
|
<var title="">node</var> が $1
|
| 365 |
|
|
要素の場合、挿入モードを "$2" に切り替え、
|
| 366 |
|
|
これらの段階を停止します。
|
| 367 |
|
|
|
| 368 |
|
|
#en
|
| 369 |
apache |
1.6 |
If <var title="">node</var> is a <code><a href="#td">td</a></code> or
|
| 370 |
|
|
<code><a href="#th">th</a></code> element and <var title="">last</var> is
|
| 371 |
|
|
false, then switch the <span>insertion mode</span> to "<a href="#in-cell" title="insertion mode: in cell">in cell</a>" and abort these steps.
|
| 372 |
|
|
#ja
|
| 373 |
|
|
<var title="">node</var> が <code><a href="#td">td</a></code> 要素か
|
| 374 |
|
|
<code><a href="#th">th</a></code> 要素の場合で <var title="">last</var>
|
| 375 |
|
|
が偽の場合、挿入モードを "<a href="#in-cell" title="insertion mode: in cell">in cell</a>" に切り替え、これらの段階を停止します。
|
| 376 |
|
|
|
| 377 |
|
|
#en
|
| 378 |
apache |
1.5 |
If <var title="">node</var> is an element from the <a
|
| 379 |
|
|
href="#mathml0">MathML
|
| 380 |
|
|
namespace</a><!--XXXSVG or the <span>SVG namespace</span>-->, then switch
|
| 381 |
|
|
the <span>insertion mode</span> to "<a href="#in-foreign"
|
| 382 |
|
|
title="insertion mode: in foreign content">in foreign content</a>", let
|
| 383 |
|
|
the <a href="#secondary1">secondary insertion mode</a> be "<a
|
| 384 |
|
|
href="#in-body" title="insertion mode: in body">in body</a>", and abort
|
| 385 |
|
|
these steps.
|
| 386 |
|
|
#ja
|
| 387 |
|
|
<var title="">node</var> が <a
|
| 388 |
|
|
href="#mathml0">MathML
|
| 389 |
|
|
名前空間</a>の要素の場合、挿入モードを "<a href="#in-foreign"
|
| 390 |
|
|
title="insertion mode: in foreign content">in foreign content</a>"
|
| 391 |
|
|
に切り替え、<a href="#secondary1">二次挿入モード</a>を "<a
|
| 392 |
|
|
href="#in-body" title="insertion mode: in body">in body</a>"
|
| 393 |
|
|
とし、これらの段階を停止します。
|
| 394 |
|
|
|
| 395 |
|
|
#en
|
| 396 |
|
|
If <var title="">node</var> is a <code><a href="#head">head</a></code>
|
| 397 |
|
|
element, then switch the <span>insertion mode</span> to "<a
|
| 398 |
|
|
href="#in-body" title="insertion mode: in body">in body</a>" ("<a
|
| 399 |
|
|
href="#in-body" title="insertion mode: in body">in body</a>"! <em> not
|
| 400 |
|
|
"<a href="#in-head" title="insertion mode: in head">in head</a>"</em>!)
|
| 401 |
|
|
and abort these steps. (<a href="#fragment">fragment case</a>)
|
| 402 |
|
|
#ja
|
| 403 |
|
|
<var title="">node</var> が <code><a href="#head">head</a></code>
|
| 404 |
|
|
要素の場合、挿入モードを "<a
|
| 405 |
|
|
href="#in-body" title="insertion mode: in body">in body</a>" ("<a
|
| 406 |
|
|
href="#in-body" title="insertion mode: in body">in body</a>"! <em>"<a href="#in-head" title="insertion mode: in head">in head</a>"
|
| 407 |
|
|
ではなく</em>!) に切り替え、これらの段階を停止します。
|
| 408 |
|
|
(<a href="#fragment">素片の場合</a>)
|
| 409 |
|
|
|
| 410 |
|
|
#en
|
| 411 |
|
|
If <var title="">node</var> is an <code><a
|
| 412 |
|
|
href="#html">html</a></code> element, then: if the <a
|
| 413 |
|
|
href="#head-element"><code title="">head</code> element pointer</a> is
|
| 414 |
|
|
null, switch the <span>insertion mode</span> to "<a href="#before5"
|
| 415 |
|
|
title="insertion mode: before head">before head</a>", otherwise, switch
|
| 416 |
|
|
the <span>insertion mode</span> to "<a href="#after4" title="insertion
|
| 417 |
|
|
mode: after head">after head</a>". In either case, abort these steps. (<a
|
| 418 |
|
|
href="#fragment">fragment case</a>)
|
| 419 |
|
|
#ja
|
| 420 |
|
|
<var title="">node</var> が <code><a
|
| 421 |
|
|
href="#html">html</a></code> 要素の場合: <a
|
| 422 |
|
|
href="#head-element"><code title="">head</code> 要素指示子</a>が null
|
| 423 |
|
|
である場合には、挿入モードを "<a href="#before5"
|
| 424 |
|
|
title="insertion mode: before head">before head</a>"
|
| 425 |
|
|
に切り替えます。そうでない場合には、挿入モードを "<a href="#after4" title="insertion
|
| 426 |
|
|
mode: after head">after head</a>" に切り替えます。いずれの場合にも、
|
| 427 |
|
|
これらの段階を停止します。 (<a href="#fragment">素片の場合</a>)
|
| 428 |
|
|
|
| 429 |
|
|
#en
|
| 430 |
|
|
If <var title="">last</var> is true, then switch the <span>insertion
|
| 431 |
|
|
mode</span> to "<a href="#in-body" title="insertion mode: in body">in
|
| 432 |
|
|
body</a>" and abort these steps. (<a href="#fragment">fragment case</a>)
|
| 433 |
|
|
#ja
|
| 434 |
|
|
<var title="">last</var> が真であれば、挿入モードを
|
| 435 |
|
|
"<a href="#in-body" title="insertion mode: in body">in
|
| 436 |
|
|
body</a>" に切り替え、これらの段階を停止します。
|
| 437 |
|
|
(<a href="#fragment">素片の場合</a>)
|
| 438 |
|
|
|
| 439 |
|
|
#en
|
| 440 |
|
|
Let <var title="">node</var> now be the node before <var
|
| 441 |
|
|
title="">node</var> in the <a href="#stack">stack of open elements</a>.
|
| 442 |
apache |
1.6 |
#ja
|
| 443 |
apache |
1.5 |
新たな <var title="">node</var> を<a href="#stack">開いている要素のスタック</a>で <var
|
| 444 |
|
|
title="">node</var> の前にある節点とします。
|
| 445 |
|
|
|
| 446 |
|
|
|
| 447 |
|
|
|
| 448 |
|
|
|
| 449 |
|
|
|
| 450 |
apache |
1.4 |
|
| 451 |
|
|
#pattern
|
| 452 |
|
|
A sequence of bytes starting with: *
|
| 453 |
|
|
#ja
|
| 454 |
|
|
$1 で始まるバイト列
|
| 455 |
|
|
|
| 456 |
|
|
#en
|
| 457 |
|
|
Any other byte
|
| 458 |
|
|
#ja
|
| 459 |
|
|
その他のバイト
|
| 460 |
|
|
|
| 461 |
|
|
#en
|
| 462 |
|
|
Consume the <a href="#next-input">next input character</a>:
|
| 463 |
|
|
#ja
|
| 464 |
|
|
<a href="#next-input">次入力文字</a>を消費:
|
| 465 |
|
|
|
| 466 |
|
|
#en
|
| 467 |
|
|
A comment token
|
| 468 |
|
|
#ja
|
| 469 |
|
|
注釈字句
|
| 470 |
|
|
|
| 471 |
|
|
#en
|
| 472 |
|
|
A DOCTYPE token
|
| 473 |
|
|
#ja
|
| 474 |
|
|
DOCTYPE 字句
|
| 475 |
|
|
|
| 476 |
|
|
#pattern
|
| 477 |
|
|
A start tag whose tag name is "*"
|
| 478 |
|
|
#ja
|
| 479 |
|
|
タグ名が "$1" の開始タグ
|
| 480 |
|
|
|
| 481 |
|
|
#pattern
|
| 482 |
|
|
A start tag whose tag name is one of: *
|
| 483 |
|
|
#ja
|
| 484 |
|
|
タグ名が $1 のいずれかの開始タグ
|
| 485 |
|
|
|
| 486 |
|
|
#pattern
|
| 487 |
|
|
An end tag whose tag name is "*"
|
| 488 |
|
|
#ja
|
| 489 |
|
|
タグ名が "$1" の終了タグ
|
| 490 |
|
|
|
| 491 |
|
|
#pattern
|
| 492 |
|
|
An end tag whose tag name is one of: *
|
| 493 |
|
|
#ja
|
| 494 |
|
|
タグ名が $1 のいずれかの終了タグ
|
| 495 |
|
|
|
| 496 |
|
|
#en
|
| 497 |
|
|
Any other start tag
|
| 498 |
|
|
#ja
|
| 499 |
|
|
その他の開始タグ
|
| 500 |
|
|
|
| 501 |
|
|
#en
|
| 502 |
|
|
Any other end tag
|
| 503 |
|
|
#ja
|
| 504 |
|
|
その他の終了タグ
|
| 505 |
|
|
|
| 506 |
|
|
#en
|
| 507 |
|
|
Anything else
|
| 508 |
|
|
#ja
|
| 509 |
|
|
その他のもの
|
| 510 |
|
|
|
| 511 |
|
|
#en
|
| 512 |
|
|
Run the following algorithm:
|
| 513 |
|
|
#ja
|
| 514 |
|
|
次の算法を実行します:
|
| 515 |
|
|
|
| 516 |
|
|
#en
|
| 517 |
|
|
Otherwise:
|
| 518 |
|
|
#ja
|
| 519 |
|
|
それ以外の場合:
|
| 520 |
|
|
|
| 521 |
|
|
#pattern
|
| 522 |
|
|
Return to step *.
|
| 523 |
|
|
#ja
|
| 524 |
|
|
手順 $1 に戻ります。
|
| 525 |
|
|
|
| 526 |
|
|
#pattern
|
| 527 |
|
|
Act as if a start tag token with the tag name "*" had been seen,
|
| 528 |
|
|
then reprocess the current token.
|
| 529 |
|
|
#ja
|
| 530 |
|
|
タグ名が "$1" の開始タグ字句を見たかのように動作してから、
|
| 531 |
|
|
現在字句を再処理します。
|
| 532 |
|
|
|
| 533 |
|
|
#en
|
| 534 |
|
|
<a href="#parse1">Parse error</a>.
|
| 535 |
|
|
#ja
|
| 536 |
|
|
<a href="#parse1">構文解析誤り</a>。
|
| 537 |
|
|
|
| 538 |
|
|
#en
|
| 539 |
|
|
<a href="#parse1">Parse error</a>. Ignore the token.
|
| 540 |
|
|
#ja
|
| 541 |
|
|
<a href="#parse1">構文解析誤り</a>。字句を無視します。
|
| 542 |
apache |
1.9 |
|
| 543 |
|
|
#en
|
| 544 |
|
|
Take a deep breath, then act as described in the "any other end tag"
|
| 545 |
|
|
entry below.
|
| 546 |
|
|
#ja
|
| 547 |
|
|
深呼吸をして、後述の「その他の終了タグ」の項で説明されているように作用します。
|
| 548 |
|
|
|
| 549 |
|
|
#en
|
| 550 |
|
|
If the <a href="#list-of5">list of active formatting elements</a>
|
| 551 |
|
|
contains an element whose tag name is "a" between the end of the list
|
| 552 |
|
|
and the last marker on the list (or the start of the list if there is no
|
| 553 |
|
|
marker on the list), then this is a <a href="#parse2">parse error</a>;
|
| 554 |
|
|
act as if an end tag with the tag name "a" had been seen, then remove
|
| 555 |
|
|
that element from the <a href="#list-of5">list of active formatting
|
| 556 |
|
|
elements</a> and the <a href="#stack">stack of open elements</a> if the
|
| 557 |
|
|
end tag didn't already remove it (it might not have if the element is
|
| 558 |
|
|
not <a href="#have-an0" title="has an element in table scope">in table
|
| 559 |
|
|
scope</a>).
|
| 560 |
|
|
#ja
|
| 561 |
|
|
<a href="#list-of5">活性書式付け要素のリスト</a>がタグ名 "a"
|
| 562 |
|
|
の要素をリストの終わりとリスト中のリスト・マーカー (またはリスト中にマーカーがない場合はリストのはじめ)
|
| 563 |
|
|
の間に含まれている場合には、
|
| 564 |
|
|
これは<a href="#parse2">構文解析誤り</a>です。
|
| 565 |
|
|
タグ名 "a" の終了タグを見たかのように作用した後に、
|
| 566 |
|
|
その要素を<a href="#list-of5">活性書式付け要素のリスト</a>と<a href="#stack">開いている要素のスタック</a>
|
| 567 |
|
|
(終了タグにより除去されていない場合。要素が<a href="#have-an0" title="has an element in table scope">表範囲中</a>にない場合には除去されていないかもしれません。) から除去します。
|
| 568 |
|
|
|
| 569 |
|
|
#en
|
| 570 |
|
|
In the non-conforming stream
|
| 571 |
|
|
<code><a href="a">a<table><a href="b">b</table>x</code>,
|
| 572 |
|
|
the first <code><a href="#a">a</a></code> element would be closed upon
|
| 573 |
|
|
seeing the second one, and the "x" character would be inside a link to
|
| 574 |
|
|
"b", not to "a". This is despite the fact that the outer <code><a
|
| 575 |
|
|
href="#a">a</a></code> element is not in table scope (meaning that a
|
| 576 |
|
|
regular <code></a></code> end tag at the start of the table wouldn't
|
| 577 |
|
|
close the outer <code><a href="#a">a</a></code> element).
|
| 578 |
|
|
#ja
|
| 579 |
apache |
1.10 |
不適合ストリーム
|
| 580 |
|
|
<code><a href="a">a<table><a href="b">b</table>x</code>
|
| 581 |
|
|
において、最初の <code><a href="#a">a</a></code> 要素は2つ目のを見たときに閉じられ、
|
| 582 |
apache |
1.9 |
「x」文字は「a」へのリンクではなく、「b」へのリンクの内側に入ります。
|
| 583 |
|
|
これは、外側の <code><a
|
| 584 |
|
|
href="#a">a</a></code> 要素が表範囲中にないためです
|
| 585 |
|
|
(つまり、表の最初に普通の <code></a></code> 終了タグがあったとしても、
|
| 586 |
|
|
外側の <code><a href="#a">a</a></code> 要素を閉じないということになります)。
|
| 587 |
|
|
|
| 588 |
|
|
#en
|
| 589 |
|
|
<a href="#reconstruct">Reconstruct the active formatting elements</a>,
|
| 590 |
|
|
if any.
|
| 591 |
|
|
#ja
|
| 592 |
apache |
1.11 |
<a href="#reconstruct">活性書式付け要素を再構築</a>できれば、します。
|
| 593 |
apache |
1.9 |
|
| 594 |
|
|
#en
|
| 595 |
|
|
<a href="#insert0">Insert an HTML element</a> for the token. Add that
|
| 596 |
|
|
element to the <a href="#list-of5">list of active formatting
|
| 597 |
|
|
elements</a>.
|
| 598 |
|
|
#ja
|
| 599 |
apache |
1.12 |
当該字句について <a href="#insert0">HTML 要素を挿入</a>します。
|
| 600 |
apache |
1.9 |
その要素を<a href="#list-of5">活性書式付け要素のリスト</a>に追加します。
|
| 601 |
|
|
|
| 602 |
apache |
1.31 |
|
| 603 |
|
|
|
| 604 |
|
|
#en |
| 605 |
|
|
The behavior further depends on the character after the U+0023 NUMBER
|
| 606 |
|
|
SIGN: |
| 607 |
|
|
#ja |
| 608 |
|
|
動作は更に U+0023 NUMBER
|
| 609 |
|
|
SIGN の次の文字によって決まります。
|
| 610 |
apache |
1.32 |
|
| 611 |
|
|
|
| 612 |
|
|
#en |
| 613 |
|
|
Consume the U+0023 NUMBER SIGN. |
| 614 |
|
|
#ja |
| 615 |
apache |
1.33 |
U+0023 NUMBER SIGN を消費します。 |
| 616 |
|
|
|
| 617 |
|
|
#en |
| 618 |
|
|
Consume the X. |
| 619 |
|
|
#ja |
| 620 |
apache |
1.34 |
X を消費します。 |
| 621 |
|
|
|
| 622 |
|
|
#en |
| 623 |
|
|
Follow the steps below, but using the range of characters U+0030
|
| 624 |
|
|
DIGIT ZERO through to U+0039 DIGIT NINE, U+0061 LATIN SMALL LETTER A
|
| 625 |
|
|
through to U+0066 LATIN SMALL LETTER F, and U+0041 LATIN CAPITAL
|
| 626 |
|
|
LETTER A, through to U+0046 LATIN CAPITAL LETTER F (in other words,
|
| 627 |
|
|
0-9, A-F, a-f). |
| 628 |
|
|
#ja |
| 629 |
|
|
次の段階に従いますが、範囲 U+0030
|
| 630 |
|
|
DIGIT ZERO ~ U+0039 DIGIT NINE、U+0061 LATIN SMALL LETTER A
|
| 631 |
|
|
~ U+0066 LATIN SMALL LETTER F、 U+0041 LATIN CAPITAL
|
| 632 |
|
|
LETTER A ~ U+0046 LATIN CAPITAL LETTER F (つまり
|
| 633 |
|
|
0-9、A-F、a-f) の文字を使います。
|
| 634 |
apache |
1.35 |
|
| 635 |
|
|
|
| 636 |
|
|
#en |
| 637 |
|
|
Follow the steps below, but using the range of characters U+0030
|
| 638 |
|
|
DIGIT ZERO through to U+0039 DIGIT NINE, U+0061 LATIN SMALL LETTER A
|
| 639 |
|
|
through to U+0066 LATIN SMALL LETTER F, and U+0041 LATIN CAPITAL
|
| 640 |
|
|
LETTER A, through to U+0046 LATIN CAPITAL LETTER F (in other words,
|
| 641 |
|
|
0-9, A-F, a-f). |
| 642 |
|
|
#ja |
| 643 |
|
|
次の段階に従いますが、文字の範囲 U+0030
|
| 644 |
|
|
DIGIT ZERO ~ U+0039 DIGIT NINE、U+0061 LATIN SMALL LETTER A
|
| 645 |
|
|
~ U+0066 LATIN SMALL LETTER F、 U+0041 LATIN CAPITAL
|
| 646 |
|
|
LETTER A ~ U+0046 LATIN CAPITAL LETTER F (つまり
|
| 647 |
|
|
0-9、A-F、a-f) を使います。
|