| 1 |
|
| 2 |
#pattern
|
| 3 |
<span class=secno>* </span>Semantics and structure of HTML
|
| 4 |
documents
|
| 5 |
#ja
|
| 6 |
<span class=secno>$1 </span>HTML 文書の意味と構造
|
| 7 |
|
| 8 |
#pattern
|
| 9 |
<span class=secno>* </span>Documents
|
| 10 |
#ja
|
| 11 |
<span class=secno>$1 </span>文書 |
| 12 |
|
| 13 |
#en |
| 14 |
Every XML and HTML document in an HTML UA is represented by a
|
| 15 |
<code>Document</code> object. <a href="#refsDOM3CORE">[DOM3CORE]</a> |
| 16 |
#ja |
| 17 |
HTML 利用者エージェントにおけるすべての XML や HTML の文書は
|
| 18 |
<code>Document</code> オブジェクトにより表現されます。 <a href="#refsDOM3CORE">[DOM3CORE]</a> |
| 19 |
|
| 20 |
#pattern |
| 21 |
<span class=secno>* </span>Documents in the DOM |
| 22 |
#ja |
| 23 |
<span class=secno>$1 </span>DOM 中の文書 |
| 24 |
|
| 25 |
#en |
| 26 |
<code>Document</code> objects are assumed to be <dfn
|
| 27 |
id=xml-documents>XML documents</dfn> unless they are flagged as being <dfn
|
| 28 |
id=html->HTML documents</dfn> when they are created. Whether a document is
|
| 29 |
an <a href="#html-" title="HTML documents">HTML document</a> or an <a
|
| 30 |
href="#xml-documents" title="XML documents">XML document</a> affects the
|
| 31 |
behavior of certain APIs, as well as a few CSS rendering rules. <a
|
| 32 |
href="#refsCSS21">[CSS21]</a> |
| 33 |
#ja |
| 34 |
<code>Document</code> オブジェクトは、作成された時に
|
| 35 |
<dfn
|
| 36 |
id=html->HTML 文書</dfn>であると旗付けされていなければ、 <dfn
|
| 37 |
id=xml-documents>XML 文書</dfn>であると見なします。
|
| 38 |
文書が <a href="#html-" title="HTML documents">HTML 文書</a>であるか <a
|
| 39 |
href="#xml-documents" title="XML documents">XML 文書</a>であるかは、
|
| 40 |
いくつかの API の動作や CSS のレンダリング規則の一部に影響します。 <a
|
| 41 |
href="#refsCSS21">[CSS21]</a> |
| 42 |
|
| 43 |
#en |
| 44 |
A <code>Document</code> object created by the <code
|
| 45 |
title="">createDocument()</code> API on the <code>DOMImplementation</code>
|
| 46 |
object is initially an <a href="#xml-documents" title="XML documents">XML
|
| 47 |
document</a>, but can be made into an <a href="#html-" title="HTML
|
| 48 |
documents">HTML document</a> by calling <code title=dom-document-open><a
|
| 49 |
href="#open">document.open()</a></code> on it. |
| 50 |
#ja |
| 51 |
<code>DOMImplementation</code> 上の <code
|
| 52 |
title="">createDocument()</code> API により作成された <code>Document</code>
|
| 53 |
オブジェクトははじめ <a href="#xml-documents" title="XML documents">XML
|
| 54 |
文書</a>ですが、 <code title=dom-document-open><a
|
| 55 |
href="#open">document.open()</a></code>
|
| 56 |
を呼び出すことにより <a href="#html-" title="HTML
|
| 57 |
documents">HTML 文書</a>にすることができます。 |
| 58 |
|
| 59 |
#en |
| 60 |
All <code>Document</code> objects (in user agents implementing this
|
| 61 |
specification) must also implement the <code><a
|
| 62 |
href="#htmldocument">HTMLDocument</a></code> interface, available using
|
| 63 |
binding-specific methods. (This is the case whether or not the document in
|
| 64 |
question is an <a href="#html-" title="HTML documents">HTML document</a>
|
| 65 |
or indeed whether it contains any <a href="#html-elements">HTML
|
| 66 |
elements</a> at all.) <code>Document</code> objects must also implement
|
| 67 |
the document-level interface of any other namespaces found in the document
|
| 68 |
that the UA supports. For example, if an HTML implementation also supports
|
| 69 |
SVG, then the <code>Document</code> object must implement <code><a
|
| 70 |
href="#htmldocument">HTMLDocument</a></code> and <code>SVGDocument</code>. |
| 71 |
#ja |
| 72 |
(この仕様書を実装する利用書エージェントにおける) すべての
|
| 73 |
<code>Document</code>
|
| 74 |
オブジェクトは、 <code><a
|
| 75 |
href="#htmldocument">HTMLDocument</a></code> 界面をも実装し、
|
| 76 |
束縛規定の方式により利用可能としなければ[[MUST:なりません]]。
|
| 77 |
(これは当該文書が <a href="#html-" title="HTML documents">HTML 文書</a>であるか否かや、
|
| 78 |
そもそも <a href="#html-elements">HTML
|
| 79 |
要素</a>を含んでいるか否かによらずのことです。)
|
| 80 |
<code>Document</code> オブジェクトは、文書中に現れ、利用者エージェントが対応している、
|
| 81 |
他の名前空間の文書水準の界面をも実装しなければ[[MUST:なりません]]。
|
| 82 |
例えば、 HTML 実装が SVG にも対応している場合、 <code>Document</code>
|
| 83 |
オブジェクトは <code><a
|
| 84 |
href="#htmldocument">HTMLDocument</a></code> と
|
| 85 |
<code>SVGDocument</code> を実装しなければなりません<!-- 例示なので MUST でなく must -->。 |
| 86 |
|
| 87 |
#en |
| 88 |
Because the <code><a
|
| 89 |
href="#htmldocument">HTMLDocument</a></code> interface is now obtained
|
| 90 |
using binding-specific casting methods instead of simply being the primary
|
| 91 |
interface of the document object, it is no longer defined as inheriting
|
| 92 |
from <code>Document</code>. |
| 93 |
#ja |
| 94 |
<code><a
|
| 95 |
href="#htmldocument">HTMLDocument</a></code>
|
| 96 |
界面は現在では単純に文書オブジェクトの主たる界面であるとするのではなく、
|
| 97 |
束縛規定の型変換方式を使って得るものとしているので、
|
| 98 |
最早 <code>Document</code> から継承するとは定義していません。 |
| 99 |
|
| 100 |
#en |
| 101 |
Since the <code><a href="#htmldocument">HTMLDocument</a></code>
|
| 102 |
interface holds methods and attributes related to a number of disparate
|
| 103 |
features, the members of this interface are described in various different
|
| 104 |
sections. |
| 105 |
#ja |
| 106 |
<code><a href="#htmldocument">HTMLDocument</a></code>
|
| 107 |
界面は色々な機能に関係するメソッドや属性を持っていますので、
|
| 108 |
この界面の構成員はそれぞれの節で説明します。 |
| 109 |
|
| 110 |
#en |
| 111 |
User agents must raise a <a href="#security10">security exception</a>
|
| 112 |
whenever any of the members of an <code><a
|
| 113 |
href="#htmldocument">HTMLDocument</a></code> object are accessed by
|
| 114 |
scripts whose <a href="#effective3">effective script origin</a> is not the
|
| 115 |
<a href="#same-origin" title="same origin">same</a> as the
|
| 116 |
<code>Document</code>'s <a href="#effective3">effective script origin</a>. |
| 117 |
#ja |
| 118 |
利用者エージェントは、 <code><a
|
| 119 |
href="#htmldocument">HTMLDocument</a></code>
|
| 120 |
オブジェクトの構成員のいずれかが、
|
| 121 |
<a href="#effective3">実効スクリプト起源</a>が <code>Document</code>
|
| 122 |
の<a href="#effective3">実効スクリプト起源</a>と<a href="#same-origin" title="same origin">同じ</a>ではないスクリプトからアクセスされる場合に、
|
| 123 |
常に、
|
| 124 |
<a href="#security10">保安性例外</a>を発生させなければ[[MUST:なりません]]。 |
| 125 |
|
| 126 |
#pattern |
| 127 |
<span class=secno>* </span><dfn id=resource0>Resource
|
| 128 |
metadata management</dfn> |
| 129 |
#ja |
| 130 |
<span class=secno>$1 </span><dfn id=resource0>資源メタデータ管理</dfn> |
| 131 |
|
| 132 |
#en |
| 133 |
The <dfn id=url0 title=dom-document-URL><code>URL</code></dfn> attribute
|
| 134 |
must return <span>the document's address</span><!--
|
| 135 |
XXXDOCURL xref -->. |
| 136 |
#ja |
| 137 |
<dfn id=url0 title=dom-document-URL><code>URL</code></dfn>
|
| 138 |
属性は<span>文書の番地</span><!--
|
| 139 |
XXXDOCURL xref -->を返さなければ[[MUST:なりません]]。 |
| 140 |
|
| 141 |
#en |
| 142 |
The <dfn id=referrer
|
| 143 |
title=dom-document-referrer><code>referrer</code></dfn> attribute must
|
| 144 |
return either the <span title="the document's
|
| 145 |
address">address</span><!-- XXXDOXURL xref --> of the <a
|
| 146 |
href="#active">active document</a> of the <a href="#source0">source
|
| 147 |
browsing context</a> at the time the navigation was started (that is, the
|
| 148 |
page which <a href="#navigate" title=navigate>navigated</a> the <a
|
| 149 |
href="#browsing1">browsing context</a> to the current document), or the
|
| 150 |
empty string if there is no such originating page, or if the UA has been
|
| 151 |
configured not to report referrers in this case, or if the navigation was
|
| 152 |
initiated for a <a href="#hyperlinks">hyperlink</a> with a <code
|
| 153 |
title=rel-noreferrer><a href="#noreferrer">noreferrer</a></code> keyword. |
| 154 |
#ja |
| 155 |
<dfn id=referrer
|
| 156 |
title=dom-document-referrer><code>referrer</code></dfn>
|
| 157 |
属性は、操縦が開始された時点での<a href="#source0">原始閲覧文脈</a>の<a
|
| 158 |
href="#active">活性文書</a>
|
| 159 |
(<a
|
| 160 |
href="#browsing1">閲覧文脈</a>を現在の文書に<a href="#navigate" title=navigate>操縦</a>した頁)
|
| 161 |
の<span title="the document's
|
| 162 |
address">番地</span><!-- XXXDOXURL xref -->か、
|
| 163 |
または、そのような元々の頁がない場合、利用者エージェントがこの場合に参照子を報告しないように設定されている場合、
|
| 164 |
操縦が <code
|
| 165 |
title=rel-noreferrer><a href="#noreferrer">noreferrer</a></code>
|
| 166 |
キーワードのある<a href="#hyperlinks">ハイパーリンク</a>について初期化された場合には空文字列、
|
| 167 |
このいずれかを返さなければ[[MUST:なりません]]。
|
| 168 |
|
| 169 |
|
| 170 |
#en |
| 171 |
In the case of HTTP, the <code title=dom-document-referrer><a
|
| 172 |
href="#referrer">referrer</a></code> DOM attribute will match the <code
|
| 173 |
title="">Referer</code> (sic) header that was sent when <a href="#fetch"
|
| 174 |
title=fetch>fetching</a> the current page. |
| 175 |
#ja |
| 176 |
HTTP の場合、 <code title=dom-document-referrer><a
|
| 177 |
href="#referrer">referrer</a></code> DOM 属性は現在の頁を<a href="#fetch"
|
| 178 |
title=fetch>取ってくる</a>時に送られた <code
|
| 179 |
title="">Referer</code> (ママ) 頭部と一致します。 |
| 180 |
|
| 181 |
#en |
| 182 |
Typically user agents are configured to not report referrers
|
| 183 |
in the case where the referrer uses an encrypted protocol and the current
|
| 184 |
page does not (e.g. when navigating from an <code title="">https:</code>
|
| 185 |
page to an <code title="">http:</code> page). |
| 186 |
#ja |
| 187 |
通常、利用者エージェントは、参照子が暗号化プロトコルを使っており、
|
| 188 |
現在の頁がそうではない場合 (例えば <code title="">https:</code>
|
| 189 |
頁から <code title="">http:</code> 頁へと操縦した時)
|
| 190 |
には参照子を報告しないように設定されています。 |
| 191 |
|
| 192 |
#en |
| 193 |
The <dfn id=cookie0 title=dom-document-cookie><code>cookie</code></dfn>
|
| 194 |
attribute represents the cookies of the resource. |
| 195 |
#ja |
| 196 |
<dfn id=cookie0 title=dom-document-cookie><code>cookie</code></dfn>
|
| 197 |
属性は、資源のクッキーを表します。 |
| 198 |
|
| 199 |
#en |
| 200 |
On getting, if the <a href="#sandboxed2">sandboxed
|
| 201 |
origin browsing context flag</a> is set on the <a
|
| 202 |
href="#browsing1">browsing context</a> of the document, the user agent
|
| 203 |
must raise a <a href="#security10">security exception</a>. Otherwise, it
|
| 204 |
must return the same string as the value of the <code
|
| 205 |
title="">Cookie</code> HTTP header it would include if <a href="#fetch"
|
| 206 |
title=fetch>fetching</a> the resource indicated by <span>the document's
|
| 207 |
address</span><!-- XXXDOCURL --> over HTTP, as per RFC 2109 section 4.3.4
|
| 208 |
or later specifications. <a href="#refsRFC2109">[RFC2109]</a> <a
|
| 209 |
href="#refsRFC2965">[RFC2965]</a> |
| 210 |
#ja |
| 211 |
取得時、<a href="#sandboxed2">砂箱起源閲覧文脈旗</a>が文書の<a
|
| 212 |
href="#browsing1">閲覧文脈</a>に設定されている場合には、
|
| 213 |
利用者エージェントは<a href="#security10">保安性例外</a>を発生させなければ[[MUST:なりません]]。
|
| 214 |
そうでない場合、<span>文書の番地</span><!-- XXXDOCURL -->で示される資源を HTTP
|
| 215 |
によって<a href="#fetch"
|
| 216 |
title=fetch>取ってくる</a>場合に RFC 2109
|
| 217 |
4.3.4 節やより新しい仕様書に従って含まれるであろう <code
|
| 218 |
title="">Cookie</code> HTTP 頭部の値と同じ文字列を返さなければ[[MUST:なりません]]。 <a href="#refsRFC2109">[RFC2109]</a> <a
|
| 219 |
href="#refsRFC2965">[RFC2965]</a> |
| 220 |
|
| 221 |
#en |
| 222 |
On setting, if the <a href="#sandboxed2">sandboxed origin browsing
|
| 223 |
context flag</a> is set on the <a href="#browsing1">browsing context</a>
|
| 224 |
of the document, the user agent must raise a <a
|
| 225 |
href="#security10">security exception</a>. Otherwise, the user agent must
|
| 226 |
act as it would when processing cookies if it had just attempted to <a
|
| 227 |
href="#fetch">fetch</a> <span>the document's address</span><!-- XXXDOCURL
|
| 228 |
-->
|
| 229 |
over HTTP, and had received a response with a <code>Set-Cookie</code>
|
| 230 |
header whose value was the specified value, as per RFC 2109 sections
|
| 231 |
4.3.1, 4.3.2, and 4.3.3 or later specifications. <a
|
| 232 |
href="#refsRFC2109">[RFC2109]</a> <a href="#refsRFC2965">[RFC2965]</a> |
| 233 |
#ja |
| 234 |
設定時、<a href="#sandboxed2">砂箱起源閲覧文脈旗</a>が文書の<a
|
| 235 |
href="#browsing1">閲覧文脈</a>に設定されている場合には、
|
| 236 |
利用者エージェントは<a href="#security10">保安性例外</a>を発生させなければ[[MUST:なりません]]。
|
| 237 |
そうでない場合、利用者エージェントは、
|
| 238 |
<span>文書の番地</span><!-- XXXDOCURL -->で示される資源を HTTP
|
| 239 |
によって<a href="#fetch"
|
| 240 |
title=fetch>取ってこよう</a>とし、
|
| 241 |
値が指定された値である <code>Set-Cookie</code>
|
| 242 |
頭部がある応答を受信した場合にクッキーを処理する時と同じように、
|
| 243 |
RFC 2109 4.3.1 節、4.3.2 節、4.3.3. 節やより新しい仕様書に従い作用しなければ[[MUST:なりません]]。 <a href="#refsRFC2109">[RFC2109]</a> <a
|
| 244 |
href="#refsRFC2965">[RFC2965]</a> |
| 245 |
|
| 246 |
#en |
| 247 |
Since the <code title=dom-document-cookie><a
|
| 248 |
href="#cookie0">cookie</a></code> attribute is accessible across frames,
|
| 249 |
the path restrictions on cookies are only a tool to help manage which
|
| 250 |
cookies are sent to which parts of the site, and are not in any way a
|
| 251 |
security feature. |
| 252 |
#ja |
| 253 |
<code title=dom-document-cookie><a
|
| 254 |
href="#cookie0">cookie</a></code> 属性はフレームをまたいでアクセス可能ですので、
|
| 255 |
クッキーの経路制限はクッキーがサイト上のどの部分に送られるかを管理することを助けるための道具に過ぎず、
|
| 256 |
保安性のための機能では決してありません。 |
| 257 |
|
| 258 |
#en |
| 259 |
The <dfn id=lastmodified
|
| 260 |
title=dom-document-lastModified><code>lastModified</code></dfn> attribute,
|
| 261 |
on getting, must return the date and time of the <code>Document</code>'s
|
| 262 |
source file's last modification, in the user's local timezone, in the
|
| 263 |
following format: |
| 264 |
#ja |
| 265 |
<dfn id=lastmodified
|
| 266 |
title=dom-document-lastModified><code>lastModified</code></dfn>
|
| 267 |
属性は、取得時、 <code>Document</code> の原始ファイルの最終修正の日時を、
|
| 268 |
利用者の地方時において、次の書式で返さなければ[[MUST:なりません]]。 |