HTML — 序論

1. 序論

1.1. この仕様は どこに収まるのか?

この仕様は、 ~web~platformを成す ある巨大な一部を,数多くの詳細とともに定義する。 各種~web~platform仕様の積み重ねにおける,この仕様の他の仕様に相対的な立ち~~位置は、 次の図に総括できる: ◎ This specification defines a big part of the web platform, in lots of detail. Its place in the web platform specification stack relative to other specifications can be best summed up as follows:

1.2. これは~HTML5なのか?

◎非規範的

短く言えば、 そのとおり。 ◎ In short: Yes.

もっと詳しく言えば ⇒ 用語 “~HTML5” は、 現代の~web技術を指す~buzzwordとして,広く利用されている — それを成す(すべてではないが)多くの部分は、 ~WHATWGにて開発される。 この文書は,その一つであり、 その他は `~WHATWG 標準 概観@https://spec.whatwg.org/$ にて可用である。 ◎ In more length: the term "HTML5" is widely used as a buzzword to refer to modern web technologies, many of which (though by no means all) are developed at the WHATWG. This document is one such; others are available from the WHATWG Standards overview.

1.3. 背景0

◎非規範的

~HTMLは、 ~Web( `World Wide Web^en )の中核を成す~markup言語である。 元々,~HTMLは、 首に,科学-文書を意味論的に述べるための言語として設計された。 しかしながら,その一般~設計は、 後年になって,他のいくつかの型の文書や~appさえも述べるよう順応することを可能化した。 ◎ HTML is the World Wide Web's core markup language. Originally, HTML was primarily designed as a language for semantically describing scientific documents. Its general design, however, has enabled it to be adapted, over the subsequent years, to describe a number of other types of documents and even applications.

1.4. 対象読者

◎非規範的

この仕様は、 次に該当する者向けに意図される ⇒# この仕様にて定義される特能を利用する文書や~scriptの作者/ この仕様にて定義される特能を利用する~pageに対し演算する~toolの実装者/ この仕様の要件に関して文書や実装の正しさを確立したいと望む各個人 ◎ This specification is intended for authors of documents and scripts that use the features defined in this specification, implementers of tools that operate on pages that use the features defined in this specification, and individuals wishing to establish the correctness of documents or implementations with respect to the requirements of this specification.

この文書は、 少なくとも~web技術にまだ馴染んでいない読者には,おそらく適さない — 各所で、 精度のために明快さを, 完全さのために簡潔さを犠牲にするので。 もっと取っ付き易い[ ~tutorial/著作~手引き ]は、 当の論題への優しい導入にて供され得る。 ◎ This document is probably not suited to readers who do not already have at least a passing familiarity with web technologies, as in places it sacrifices clarity for precision, and brevity for completeness. More approachable tutorials and authoring guides can provide a gentler introduction to the topic.

特に,~DOMの基本に馴染んでいることは、 この仕様を成す より技術的な各部を完全に理解するために必要yである。 次に挙げるものを理解することも各所で役立つが、 本質的ではない ⇒ ~Web~IDL, ~HTTP, ~XML, ~Unicode, 文字~符号化法, ~JS, ~CSS ◎ In particular, familiarity with the basics of DOM is necessary for a complete understanding of some of the more technical parts of this specification. An understanding of Web IDL, HTTP, XML, Unicode, character encodings, JavaScript, and CSS will also be helpful in places but is not essential.

1.5. 視野

◎非規範的

この仕様は、 静的な文書から動的な~appに至るまで, ~web上で~access可能な~pageを著作するために[ 意味論-~levelな~markup言語, それに結付けられる意味論-~levelな~script用の~API ]を供することに制限されている。 ◎ This specification is limited to providing a semantic-level markup language and associated semantic-level scripting APIs for authoring accessible pages on the web ranging from static documents to dynamic applications.

呈示~媒体に特有な~custom化用の仕組みを供することは、 この仕様の視野に含まれない (この仕様の末尾には,~web~browser用の既定の具現化~規則が含まれることに加え、 言語の一部として,~CSSの中へ~hookするための仕組みがいくつか供されるが)。 ◎ The scope of this specification does not include providing mechanisms for media-specific customization of presentation (although default rendering rules for web browsers are included at the end of this specification, and several mechanisms for hooking into CSS are provided as part of the language).

この仕様の視野は、 ~OS全体を述べることではない。 特に,[ ~hardware環境設定~software/ 画像~操作~tool/ 利用者が日常的に高性能な~workstationで利用するものと期待される~app ]は、 視野から外れる。 ~appの~~観点からは,この仕様が~targetにする~appは、 低性能な~CPUの下でも,利用者により[ 不定期に,あるいは定期的に様々な所在から ]利用されることが特定的に期待されるものになろう。 そのような~appの例として、 次が挙げられる ⇒# ~online購入ng~system/ 探索処理~system/ ~game(とりわけ多人数~online~game)/ 公な電話~帳や~address帳/ 通信~software(~email~client, ~instant-messaging~client, 協議~software)/ 文書~編集用~software/ 等々 ◎ The scope of this specification is not to describe an entire operating system. In particular, hardware configuration software, image manipulation tools, and applications that users would be expected to use with high-end workstations on a daily basis are out of scope. In terms of applications, this specification is targeted specifically at applications that would be expected to be used by users on an occasional basis, or regularly but from disparate locations, with low CPU requirements. Examples of such applications include online purchasing systems, searching systems, games (especially multiplayer online games), public telephone books or address books, communications software (email clients, instant messaging clients, discussion software), document editing software, etc.

1.6. 歴史

◎非規範的

~HTMLは、 その最初の 5年( 1990 〜 1995 )に,何回かの改訂を経て,いくつかの拡張を経験した — それは首に、 最初は~CERNにて,それから~IETFにて~hostされた。 ◎ For its first five years (1990-1995), HTML went through a number of revisions and experienced a number of extensions, primarily hosted first at CERN, and then at the IETF.

~W3Cの設立に伴い、 ~HTMLの開発は,再び~venueを変更した。 1995年の~HTMLを拡張する最初の試みは、 ~HTML 3.0 として知られ,実を結ばなかったが、 ~HTML 3.2 として知られる,より実利的な~approachへ道を譲った — それは、 1997年に完了した。 同じ年,矢継ぎ早に~HTML4が後続した。 ◎ With the creation of the W3C, HTML's development changed venue again. A first abortive attempt at extending HTML in 1995 known as HTML 3.0 then made way to a more pragmatic approach known as HTML 3.2, which was completed in 1997. HTML4 quickly followed later that same year.

~W3Cの会員は、 後年,~HTMLの発展ngを停止するものと裁定して、 代わりに,~XHTMLと呼ばれる~XMLに基づく等価なものに対する作業を始めた。 この労は、 ~HTML4を~XMLにおいて定式化し直すことから開始され, ~XHTML 1.0 として知られる — それが追加した新たな特能は,新たな直列化の他に無く、 2000年に完了した。 ~XHTML 1.0 の後,~W3Cは、 ~XHTML~module化の旗印の下で, 他の~WGが~XHTMLを もっと容易に拡張できるようにすることに~focusを転換した。 これに並行して,~W3Cは、 それまでの[ ~HTML/~XHTML ]言語とは互換でない新たな言語に対しても作業して, それを~XHTML2と呼んだ。 ◎ The following year, the W3C membership decided to stop evolving HTML and instead begin work on an XML-based equivalent, called XHTML. This effort started with a reformulation of HTML4 in XML, known as XHTML 1.0, which added no new features except the new serialization, and which was completed in 2000. After XHTML 1.0, the W3C's focus turned to making it easier for other working groups to extend XHTML, under the banner of XHTML Modularization. In parallel with this, the W3C also worked on a new language that was not compatible with the earlier HTML and XHTML languages, calling it XHTML2.

~HTMLの発展が停止した 1998年と同じ頃、 各~browser~vendorにより開発された~HTML用の~APIの各部が指定され, `DOM Level 1^cite (1998年), `DOM Level 2 Core^cite と `DOM Level 2 HTML^cite ( 2000年に開始され,2003年に頂点に至った)の名の下で公表された。 これらの労は、 2004年に公表された いくつかの `DOM Level 3^cite 仕様で下火になり、 それらの草案~群がすべて完了する前に,~WGは閉じられた。 ◎ Around the time that HTML's evolution was stopped in 1998, parts of the API for HTML developed by browser vendors were specified and published under the name DOM Level 1 (in 1998) and DOM Level 2 Core and DOM Level 2 HTML (starting in 2000 and culminating in 2003). These efforts then petered out, with some DOM Level 3 specifications published in 2004 but the working group being closed before all the Level 3 drafts were completed.

2003年に公表された `XForms^cite は、 次世代の~web~formとして~~位置付けられる技術であった。 それは、 ~HTML用の置換を見出すのではなく, ~HTML自身を発展する~~新たな関心を再び呼び起こした。 この関心は、 ~web技術としての~XMLの配備が — (~HTML様な)既存の配備-済みな技術~用の置換としてでなく — (~RSSや後の~Atomの様な)まったく新たな技術に制限されることへの気付きから生まれた。 ◎ In 2003, the publication of XForms, a technology which was positioned as the next generation of web forms, sparked a renewed interest in evolving HTML itself, rather than finding replacements for it. This interest was borne from the realization that XML's deployment as a web technology was limited to entirely new technologies (like RSS and later Atom), rather than as a replacement for existing deployed technologies (like HTML).

その概念の証左は、 ~HTML4の~formを[ 既存の~HTML~web~pageとは互換でない具現化~engineを実装するよう,~browserに要求する ]ことなく[ `XForms 1.0^cite が導入した多くの特能を供するよう,拡張する ]ことはアリであることから示され、 それが,この~~新たな関心の最初の結果であった。 その草案は、 早期段階から すでに公に可用であり, すでに すべての~sourceからの意見が請求されていたが、 当の仕様は,~Opera~Softwareの著作権の下に限られていた。 ◎ A proof of concept to show that it was possible to extend HTML4's forms to provide many of the features that XForms 1.0 introduced, without requiring browsers to implement rendering engines that were incompatible with existing HTML web pages, was the first result of this renewed interest. At this early stage, while the draft was already publicly available, and input was already being solicited from all sources, the specification was only under Opera Software's copyright.

~HTMLの発展は~~再開されるべきであるという案は、 2004年に~W3C~workshopにて~testされた — そこでは、 ~HTML5の作業の~~下層にある原則の一部(以下に述べる), および 上で言及した[ ~formに関係する特能だけを受持っていた早期の草案~提案 ]が,~Mozillaと~Operaの共同で~W3Cに提示された。 この提案は、[ それまで,~webの発展のために選ばれた方向 ]と競合したことを土壌に却下された — ~W3Cの~staffと会員は、 代わりに~XMLに基づく置換を開発し続ける方へ採決した。 ◎ The idea that HTML's evolution should be reopened was tested at a W3C workshop in 2004, where some of the principles that underlie the HTML5 work (described below), as well as the aforementioned early draft proposal covering just forms-related features, were presented to the W3C jointly by Mozilla and Opera. The proposal was rejected on the grounds that the proposal conflicted with the previously chosen direction for the web's evolution; the W3C staff and membership voted to continue developing XML-based replacements instead.

それからまもなく,[ ~Apple, ~Mozilla, ~Opera ]は、 ~WHATWGと呼ばれる新たな~venueの傘の下で,作業する労を継続する意図を共同で発表した。 公な~mailing~listが作成され,草案は~WHATWG~siteへ移動された。 後続に,著作権は、 これらの~vendorの共同で所有され,仕様の再利用を許容するよう改正された。 ◎ Shortly thereafter, Apple, Mozilla, and Opera jointly announced their intent to continue working on the effort under the umbrella of a new venue called the WHATWG. A public mailing list was created, and the draft was moved to the WHATWG site. The copyright was subsequently amended to be jointly owned by all three vendors, and to allow reuse of the specification.

~WHATWGは、 いくつかの中核~原則に基づいた — 特に、 技術は後方-互換になる必要があること, 仕様と実装は合致する必要があることに。 後者に関しては、 それが実装ではなく仕様を変更すること意味する場合でも,仕様は[ 各~実装が互いに~reverse-engineerすることなく,完全な相互運用能を達成できる ]ほどに十分な詳細を与える必要がある。 ◎ The WHATWG was based on several core principles, in particular that technologies need to be backwards compatible, that specifications and implementations need to match even if this means changing the specification rather than the implementations, and that specifications need to be detailed enough that implementations can achieve complete interoperability without reverse-engineering each other.

後者の要件は、 ~HTML5仕様の視野は[ 3 つの別々な文書 — ~HTML4, ~XHTML1, ~DOM2~HTML — において,それまで何が指定されていたか ]を含むことから,特に要求される。 それはまた、 この規範が[ それまで考慮されたものより有意に多くの詳細 ]を含むことを意味した。 ◎ The latter requirement in particular required that the scope of the HTML5 specification include what had previously been specified in three separate documents: HTML4, XHTML1, and DOM2 HTML. It also meant including significantly more detail than had previously been considered the norm.

結局~W3Cは、 2006年に~HTML5の開発に参加する関心を指示した。 2007年には、 ~HTML5仕様の開発に対し~WHATWGと作業するため,公認な~WGを形成した。 [ ~Apple, ~Mozilla, ~Opera ]は、 ~W3C著作権の下で仕様を公表することを~W3Cに許容した — ~WHATWG~siteでは、 より制約的でない~versionの許諾条項を保ちつつ。 ◎ In 2006, the W3C indicated an interest to participate in the development of HTML5 after all, and in 2007 formed a working group chartered to work with the WHATWG on the development of the HTML5 specification. Apple, Mozilla, and Opera allowed the W3C to publish the specification under the W3C copyright, while keeping a version with the less restrictive license on the WHATWG site.

両~groupは、 何年かにわたって一緒に作業した。 しかしながら, 2011年には、 両~groupは互いの目標が異なるとの結論に至った。 ~W3Cは, “~HTML5” の “完成した” ~versionを公表するよう求めた一方で、 ~WHATWGは,~HTML用の生きた標準( `Living Standard^en )の作業を継続するよう求めた — 仕様を既知な問題を残した状態で凍結するのでなく,継続的に保守して、 ~platformが発展する必要に応じて,新たな特能を追加するよう。 ◎ For a number of years, both groups then worked together. In 2011, however, the groups came to the conclusion that they had different goals: the W3C wanted to publish a "finished" version of "HTML5", while the WHATWG wanted to continue working on a Living Standard for HTML, continuously maintaining the specification rather than freezing it in a state with known problems, and adding new features as needed to evolve the platform.

2019年には、 ~WHATWGと~W3Cは,前方へ進む単独の~versionを成す~HTML — すなわち,この文書 — に対し協同するとする`合意に署名した@https://www.w3.org/blog/news/archives/7753$。 ◎ In 2019, the WHATWG and W3C signed an agreement to collaborate on a single version of HTML going forward: this document.

1.7. 設計~注記

◎非規範的

~HTMLを成す多くの側面は、 初見では,無分別で一貫でないように現れることを認めざるを得ない。 ◎ It must be admitted that many aspects of HTML appear at first glance to be nonsensical and inconsistent.

~HTMLが~supportしている~DOM~APIや技術の多くは、 優先度が異なる多種多様な人々 — 多くの事例では,お互いの存在を知らない者たち — により,何十年にもわたり開発されてきた。 ◎ HTML, its supporting DOM APIs, as well as many of its supporting technologies, have been developed over a period of several decades by a wide array of people with different priorities who, in many cases, did not know of each other's existence.

したがって,~HTMLの特能は、 多くの~sourceから発生しており,とりわけ一貫した仕方で設計されてはいないものもある。 さらには、 実装~bugが事実上の標準になり,今や法制上の標準になったものも多い — ~webには、 各 標準を修正できる前に[ 意図的でなく,それらに依拠する仕方で内容が書かれる ]ことが多いという,独特な特性があるので。 ◎ Features have thus arisen from many sources, and have not always been designed in especially consistent ways. Furthermore, because of the unique characteristics of the web, implementation bugs have often become de-facto, and now de-jure, standards, as content is often unintentionally written in ways that rely on them before they can be fixed.

にもかかわらず、 ある種の設計~目標を固守する労は為されている。 これらは、 以下の少数の下位節にて述べられる。 ◎ Despite all this, efforts have been made to adhere to certain design goals. These are described in the next few subsections.

1.7.1. ~script実行の直列化-能

◎非規範的

~multithreadingの複階性を~web作者に公開するのを避けるため、 ~HTMLと各種~DOM~APIは,どの~scriptも — `Worker$I であっても — 他の~scriptの同時的な実行を検出し得ない【したがって依存し得ない】ように設計されている。 その意図は、 実装の挙動を[ すべての大域~obj内のすべての~scriptの実行は、 完全に直列化される ]ものとして捉えれるようにすることにある。 ◎ To avoid exposing web authors to the complexities of multithreading, the HTML and DOM APIs are designed such that no script can ever detect the simultaneous execution of other scripts. Even with workers, the intent is that the behavior of implementations can be thought of as completely serializing the execution of all scripts in all globals.

この一般的な設計~原則の例外は、 ~JSの `SharedArrayBuffer$I ~classである。 事実、 `SharedArrayBuffer^I ~objを利用すれば, 他の`~agent$内の~scriptが同時的に実行しているのを観測できる。 さらには,~JS~memory~modelに因り、 それらの~scriptどうしでは,[ 直列化された`~script^emの実行を介することでは表現-不能のみならず,直列化された`~statement^emの実行を介することでも表現-不能 ]な状況がある。【何が表現-不能?】 ◎ The exception to this general design principle is the JavaScript SharedArrayBuffer class. Using SharedArrayBuffer objects, it can in fact be observed that scripts in other agents are executing simultaneously. Furthermore, due to the JavaScript memory model, there are situations which not only are un-representable via serialized script execution, but also un-representable via serialized statement execution among those scripts.

1.7.2. 他の仕様への準拠性

◎非規範的

【この節の内容は、 `INFRA$r `§ 他の仕様への準拠性@~INFRA#other-specs$ と同じなので省略する。】 ◎ This specification interacts with and relies on a wide variety of other specifications. In certain circumstances, unfortunately, conflicting needs have led to this specification violating the requirements of these other specifications. Whenever this has occurred, the transgressions have each been noted as a "willful violation", and the reason for the violation has been noted.

1.7.3. 拡張能

◎非規範的

~HTMLには、 安全な方式で意味論を追加するために利用できる,多種多様な拡張能の仕組みがある: ◎ HTML has a wide array of extensibility mechanisms that can be used for adding semantics in a safe manner:

  • 作者は、 `class$a 属性を利用して要素を拡張することにより, 実質的に自前の要素を作成できる — [ ~browserや他の~toolが、 その拡張を知らずとも,それをいくぶん きちんと~supportできる ]よう,最も適用-可能な既存の “本物の” ~HTML要素を利用する下で。 これは例えば、 ~microformatが利用する索を成す。 ◎ Authors can use the class attribute to extend elements, effectively creating their own elements, while using the most applicable existing "real" HTML element, so that browsers and other tools that don't know of the extension can still support it somewhat well. This is the tack used by microformats, for example.
  • 作者は、 `data-*$a 属性を利用して,`~script$【!inline client-side scripts or server-side site-wide scripts】が処理するための~dataを内包できる。 これらは、 ~browserからは決して触れられないことが保証され,[ ~scriptが後で探し出して処理できる~data ]を~HTML要素に内包することを~scriptに許容する。 ◎ Authors can include data for inline client-side scripts or server-side site-wide scripts to process using the data-*="" attributes. These are guaranteed to never be touched by browsers, and allow scripts to include data on HTML elements that scripts can then look for and process.
  • 作者は、 `meta$e 要素の[ `name^a 属性, `content^a 属性 ]の仕組みを利用して,~page全般~用の~metadataを内包できる。 ◎ Authors can use the <meta name="" content=""> mechanism to include page-wide metadata.
  • 作者は、 `rel$a 属性の仕組みを利用して[ `定義済みな~link型の集合に対する拡張$を登録する ]ことにより,~linkに特定の意味を注釈できる。 これは、 ~microformatでも利用される。 ◎ Authors can use the rel="" mechanism to annotate links with specific meanings by registering extensions to the predefined set of link types. This is also used by microformats.
  • 作者は、 ~customな型を伴う `script$e の仕組みを利用して, `~script$【!inline or server-side scripts】による更なる取扱い用に生の~dataを埋込める。 ◎ Authors can embed raw data using the <script type=""> mechanism with a custom type, for further handling by inline or server-side scripts.
  • 作者は、 ~JSによる~prototype法の仕組みを利用して, ~APIを拡張できる。 これは、 一例として,~script~libraryで広く利用されている。 ◎ Authors can extend APIs using the JavaScript prototyping mechanism. This is widely used by script libraries, for instance.
  • 作者は、 ~microdata特能( `itemscope$a 属性, `itemprop$a 属性)を利用して, 入子な[ 名前, 値 ]が成す~pairたちを[ 他の~appや~siteと共有される~data ]として埋込める。 ◎ Authors can use the microdata feature (the itemscope="" and itemprop="" attributes) to embed nested name-value pairs of data to be shared with other applications and sites.
  • 作者は、 `~custom要素$を[ 定義する/共有する/利用する ]ことで,~HTMLの語彙を拡張できる。 `妥当な~custom要素~名$を成すための要件は、 前方-互換性を確保する (将来に[ ~hyphenを包含している局所~名を伴う要素 ]が[ ~HTML / ~SVG / ~MathML ]に追加されることはないので)。 ◎ Authors can define, share, and use custom elements to extend the vocabulary of HTML. The requirements of valid custom element names ensure forward compatibility (since no elements will be added to HTML, SVG, or MathML with hyphen-containing local names in the future).

1.8. ~HTML構文と~XML構文

◎非規範的

この仕様は、 文書と~appを述べるための抽象-言語を定義する。 また、[ この言語を利用する資源の~memory内~表現 ]とヤリトリするための~APIをいくつか定義する。 ◎ This specification defines an abstract language for describing documents and applications, and some APIs for interacting with in-memory representations of resources that use this language.

~memory内~表現は、 “~DOM~HTML”, 略して “~DOM” ( `Document Object Model^en )として知られる。 ◎ The in-memory representation is known as "DOM HTML", or "the DOM" for short.

この抽象-言語を利用する資源を伝送するために利用できる具象-構文には,様々なものがあり、 この仕様は,それらのうち 2 種を定義する: ◎ There are various concrete syntaxes that can be used to transmit resources that use this abstract language, two of which are defined in this specification.

  • ~HTML構文 ⇒ これは、 ほとんどの作者~用に示唆される形式であり, ほとんどの旧来の~web~browserと互換である。 ある文書が `~MIME型$ `text/html$c を伴って伝送される場合、 それは,~web~browserにより~HTML文書として処理されることになる。 この仕様は、 単純に “~HTML” として知られる最新な~HTML構文を定義する。 ◎ The first such concrete syntax is the HTML syntax. This is the format suggested for most authors. It is compatible with most legacy web browsers. If a document is transmitted with the text/html MIME type, then it will be processed as an HTML document by web browsers. This specification defines the latest HTML syntax, known simply as "HTML".
  • ~XML構文 ⇒ ある文書が `application/xhtml+xml$c などの`~XML~MIME型$を伴って伝送される場合、 ~web~browserにより~XML文書として扱われ, ~XML処理器により構文解析されることになる。 作者は、 ~XML用の処理と~HTML用の処理は相違することに留意すること。 特に、[ ~XMLとして~labelされた文書は、 些細な構文~errorであっても全部的に具現化されなくなる ]一方で,[ ~HTML構文における そのような~errorは、 無視される ]ことになろう。 ◎ The second concrete syntax is XML. When a document is transmitted with an XML MIME type, such as application/xhtml+xml, then it is treated as an XML document by web browsers, to be parsed by an XML processor. Authors are reminded that the processing for XML and HTML differs; in particular, even minor syntax errors will prevent a document labeled as XML from being rendered fully, whereas they would be ignored in the HTML syntax.

~HTML用の~XML構文は,以前は "XHTML" と称されていたが、 この仕様は,その用語を利用しない (他にも理由はあるが、 そのような用語は,[ ~MathML/~SVG ]の~HTML構文~用には利用されないので)。 ◎ The XML syntax for HTML was formerly referred to as "XHTML", but this specification does not use that term (among other reasons, because no such term is used for the HTML syntaxes of MathML and SVG).

[ ~DOM, ~HTML構文, ~XML構文 ]は、 互いに他と同じ内容を表現できるとは限らない。 例えば,名前空間は、 ~HTML構文を利用しても表現できないが,[ ~DOM/~XML構文 ]においては~supportされる。 類似に, `noscript$e 特能を利用する文書は、 ~HTML構文を利用すれば表現できるが,[ ~DOM/~XML構文 ]においては表現できない。 文字列 `-->^l を包含する~commentを表現できるのは,~DOM内に限られ、[ ~HTML構文/~XML構文 ]においては表現できない。 ◎ The DOM, the HTML syntax, and the XML syntax cannot all represent the same content. For example, namespaces cannot be represented using the HTML syntax, but they are supported in the DOM and in the XML syntax. Similarly, documents that use the noscript feature can be represented using the HTML syntax, but cannot be represented with the DOM or in the XML syntax. Comments that contain the string "-->" can only be represented in the DOM, not in the HTML and XML syntaxes.

1.9. この仕様の構造

◎非規範的

この仕様は、 次に挙げる主要な節に分割0される: ◎ This specification is divided into the following major sections:

`§ 序論@#introduction$ ◎ Introduction
~HTML標準~用の文脈を供する規範的でない素材。 ◎ Non-normative materials providing a context for the HTML standard.
`§ 共通~基盤@~HTMLINFRA#infrastructure$ ◎ Common infrastructure
各種[ 適合性~class, ~algo, 定義 ], および仕様の他所~用の共通な土台。 ◎ The conformance classes, algorithms, definitions, and the common underpinnings of the rest of the specification.
`§ ~HTML文書の意味論, 構造, ~API@~HTMLdom#dom$ ◎ Semantics, structure, and APIs of HTML documents
文書は、 要素たちから築かれる。 これらの要素は、 ~DOMを利用して~treeを形成する。 この節は、 この~DOMの特能を定義することに加え,[ すべての要素に共通な特能, 要素を定義する際に利用される概念 ]を導入する。 ◎ Documents are built from elements. These elements form a tree using the DOM. This section defines the features of this DOM, as well as introducing the features common to all elements, and the concepts used in defining elements.
`§ ~HTMLの要素@~HEmetadata#semantics$ ◎ The elements of HTML
各~要素には、 定義済みな意味があり,この節にて説明される。 要素を利用する方法に対する作者~用の規則も, 各~要素を取扱う方法に対する~UA要件とともに与えられる。 これは、 次に挙げるものなど,~HTMLの大きな~~特徴を成す特能を含む ⇒# 動画の再生と字幕/ 各種~form~controlと~form提出/ ~HTML~canvasとして知られる~2D~graphics~API ◎ Each element has a predefined meaning, which is explained in this section. Rules for authors on how to use the element, along with user agent requirements for how to handle each element, are also given. This includes large signature features of HTML such as video playback and subtitles, form controls and form submission, and a 2D graphics API known as the HTML canvas.
`§ ~microdata@~HTMLLS/microdata.html#microdata$ ◎ Microdata
この仕様は、 文書に機械で読取n可能な注釈を追加するための仕組みを導入する — ~toolが文書から一連の[ 名前, 値 ]が成す~pairたちが成す~treeを抽出できるよう。 この節は、 この仕組みと[ ~HTML文書を他の形式に変換するために利用できる,いくつかの~algo ]を述べる。 この節はまた、[ `contact information@~HTMLLS/microdata.html#vcard$en, `calendar event@~HTMLLS/microdata.html#vevent$en, `licensing works@~HTMLLS/microdata.html#licensing-works$en ]用に,いくつか見本~microdata語彙を定義する。 ◎ This specification introduces a mechanism for adding machine-readable annotations to documents, so that tools can extract trees of name-value pairs from the document. This section describes this mechanism and some algorithms that can be used to convert HTML documents into other formats. This section also defines some sample Microdata vocabularies for contact information, calendar events, and licensing works.
`§ 利用者-ヤリトリ@~HTMLinteraction#editing$ ◎ User interaction
~HTML文書は、 利用者が[ 内容とヤリトリする/内容を改変する ]ための,いくつかの仕組み — ~focusや~drag-and-dropがどう働くかなど — を供せる。 それらは、 この節にて述べられる。 ◎ HTML documents can provide a number of mechanisms for users to interact with and modify content, which are described in this section, such as how focus works, and drag-and-drop.
`§ ~web~pageの読込ng@~ORIGIN#browsers$ ◎ Loading web pages
~HTML文書は、 互いに隔絶されるものではない。 この節は、 ~web~browserなど,複数の~pageを処する環境に影響する多くの特能を定義する。 ◎ HTML documents do not exist in a vacuum — this section defines many of the features that affect environments that deal with multiple pages, such as web browsers.
`§ ~web~app~API@~WAPI#webappapis$ ◎ Web application APIs
この節は、 ~HTMLの~appにおける~scripting用の基本的な特能を導入する。 ◎ This section introduces basic features for scripting of applications in HTML.
`§ ~web~worker@~WORKERS#workers$ ◎ Web workers
この節は、 ~JSにおける~background~thread用の~APIを定義する。 ◎ This section defines an API for background threads in JavaScript.
`§ ~worklet@~WORKLETS#worklets$ ◎ Worklets
この節は、 ~JSを~main~JS実行~環境とは別々に走らす必要がある~API用の基盤を定義する。 ◎ This section defines infrastructure for APIs that need to run JavaScript separately from the main JavaScript execution environment.
`§ 通信@~HTMLcomms#comms$ ◎ The communication APIs

この節は、 ~HTMLで書かれる~appが[ 同じ~client上で稼働している,異なる~domainに属する他の~app ]と通信するために利用できる,ある種の仕組みを述べる。 また、 次も導入する:

  • ~serverから~pushされる~event~streamの仕組み — `Server Sent Events^en(~serverから送信される~event), あるいは `EventSource$I としても知られる。
  • ~script用の双路かつ全二重な~socket~protocol — `Web Sockets^en としても知られる。 【これは今や、`別々な仕様@~WEBSOCKET$にされた。】
◎ This section describes some mechanisms that applications written in HTML can use to communicate with other applications from different domains running on the same client. It also introduces a server-push event stream mechanism known as Server Sent Events or EventSource, and a two-way full-duplex socket protocol for scripts known as Web Sockets.
`§ ~web~storage@~WEBSTORAGE#webstorage$ ◎ Web storage
この節は、[ 名前, 値 ]が成す~pairたちに基づく,~client側~storageの仕組みを定義する。 ◎ This section defines a client-side storage mechanism based on name-value pairs.
`§ ~HTML構文@~HTMLwriting#syntax$ ◎ The HTML syntax
`§ ~XML構文@~HTMLxml#xhtml$ ◎ The XML syntax
以上の特能は、 それらを直列化した形で表現して他者へ送信できなかったなら,すべて無為になる。 なので,これらの節は、[ ~HTML/~XML ]の構文とともに, それらの構文を利用して内容を構文解析するための規則を定義する。 ◎ All of these features would be for naught if they couldn't be represented in a serialized form and sent to other people, and so these sections define the syntaxes of HTML and XML, along with rules for how to parse content using those syntaxes.
`§ 具現化@~HTMLrendering#rendering$ ◎ Rendering
この節は、 ~web~browser用の既定の具現化~規則を定義する。 ◎ This section defines the default rendering rules for web browsers.

いくつか付録もある ⇒# `§ 廃用にされた特能@~HTMLobs#obsolete$, `§ ~IANA考慮点@~HTMLiana#iana$, いくつかの索引 ◎ There are also some appendices, listing obsolete features and IANA considerations, and several indices.

1.9.1. この仕様を読む方法

この仕様は、 他のすべての仕様と同じ様に読むべきである。 まずは、 全編を通して複数回 読むべきである。 次に、 少なくとも 1 回は後ろから読むべきである。 それから、 目次から~randomに節を選び取って,すべての相互-参照を追いながら読むべきである。 ◎ This specification should be read like all other specifications. First, it should be read cover-to-cover, multiple times. Then, it should be read backwards at least once. Then it should be read by picking random sections from the contents list and following all the cross-references.

`§ 適合性の要件@~HTMLINFRA#conformance-classes$ に述べられるとおり,この仕様は、 各種 適合性~class用に適合性の判定基準を述べる。 特に,適合性~要件には、 `生産器^em(例:作者, 作者が作成する文書)に適用されるもの, `消費器^em(例:~web~browser)に適用されるものがある。 これらの要件は、 それが何を要求しているかにより判別できる — 生産器に対する要件は,何が許容されるかを言明する一方で、 消費器に対する要件は,~softwareがどう動作するかを言明する。 ◎ As described in the conformance requirements section below, this specification describes conformance criteria for a variety of conformance classes. In particular, there are conformance requirements that apply to producers, for example authors and the documents they create, and there are conformance requirements that apply to consumers, for example web browsers. They can be distinguished by what they are requiring: a requirement on a producer states what is allowed, while a requirement on a consumer states how software is to act.

例えば,次は、 許容される値を~~規定するので,生産器に対する要件になる ⇒ “`foo^a 属性の値は、 `妥当な整数$でなければナラナイ” ◎ For example, "the foo attribute's value must be a valid integer" is a requirement on producers, as it lays out the allowed values;\

対照的に,次は、 内容を処理する方法を述べるので,消費器に対する要件になる ⇒ “`foo^c 属性の値は、 `整数として構文解析する$~algoを利用して構文解析するモノトスル” ◎ in contrast, the requirement "the foo attribute's value must be parsed using the rules for parsing integers" is a requirement on consumers, as it describes how to process the content.

【 和訳においては、 判別し易くなるよう,少数の例外を除き[ 生産器には “…ナラナイ” / 消費器には “…モノトスル” ]が利用される。 】【 [ 生産器, 消費器 ]以外 (多くの場合,この仕様に依拠する各~仕様の策定者) に課される要件もある — 他よりは少ないが (それらにも “…ナラナイ” が利用される)。 】

生産器に対する要件は、 消費器に対する要件とは何ら~~関係ない。 ◎ Requirements on producers have no bearing whatsoever on consumers.

上の例を引き継いで、 特定0の属性に対し,その値は`妥当な整数$に拘束されるものと明確に言明された要件は、 消費器に対する要件については,何も`含意しない^em。 消費器は,[ 当の属性の値を不透明な文字列として扱うよう要求される ]かもしれず、[ 値が当の要件に適合するかどうか ]には,まったく影響されない。 消費器は、 (上の例のように)[ 妥当でない値(この事例では、整数を表さない文字列)をどう処理するかを定義する特有な規則 ]を利用して,値を構文解析するよう要求されることもある。 ◎ Continuing the above example, a requirement stating that a particular attribute's value is constrained to being a valid integer emphatically does not imply anything about the requirements on consumers. It might be that the consumers are in fact required to treat the attribute as an opaque string, completely unaffected by whether the value conforms to the requirements or not. It might be (as in the previous example) that the consumers are required to parse the value using specific rules that define how invalid (non-numeric in this case) values are to be processed.

1.9.2. ~~表記上の規約

【 以下に呈示される~styleには、 (~markupは同じでも)原文から違えているものもある (より細かい~~分類に応じて,異なる色を利用するなど)。 】

これは、[ 定義/要件/説明 ]。 【特定の~styleは伴わない。】 ◎ This is a definition, requirement, or explanation.

これは、 注記。 ◎ This is a note.

これは、 例。 ◎ This is an example.

これは、 ~openな課題。 ◎ This is an open issue.

これは、 警告。 ◎ This is a warning.

[Exposed=Window]
interface Example {
  /* 
これは~IDL定義。
◎
this is an IDL definition
 */
};
%variable = %object.method([ %optionalArgument ])
これは、 ある~interfaceの用法を述べている,作者~向けの注記。 ◎ This is a note to authors describing the usage of an interface.
/* 
これは~CSS~code片。
◎
this is a CSS fragment
 */

ある用語の~instanceを定義するときは、 この様に ~mark-upされる。 その用語の利用は、[ `この様に@#_this-0$/ `この様に@#_this-0$i ]~mark-upされる。 ◎ The defining instance of a term is marked up like this. Uses of that term are marked up like this or like this.

[ 要素/属性/~API ]を定義している~instanceは、 それが "this" と命名されるなら,[ `this@#_this-1@e / `this@#_this-2@a / `this@#_this-3@m ]の様に~mark-upされる。 その[ 要素/属性/~API ]への参照は、[ `this@#_this-1$e / `this@#_this-2$a / `this@#_this-3$m ]の様に~mark-upされる。 ◎ The defining instance of an element, attribute, or API is marked up like this. References to that element, attribute, or API are marked up like this.

他の~code片は、 `example code^c の様に~mark-upされる。 ◎ Other code fragments are marked up like this.

変数は、 %この様に ~mark-upされる。 ◎ Variables are marked up like this.

ある~algo内の`同期区間$を成す各~段には、 ⌛ が付与される。 ◎ In an algorithm, steps in synchronous sections are marked with ⌛.

一部の事例では、 要件は,何個かの[ 条件(たち), それに対応する要件 ]からなる~listによる形で与えられる。 そのような事例で適用される要件は、 最初に該当する条件に対応する要件になる。 そのような事例は、 次のように呈示される: ◎ In some cases, requirements are given in the form of lists with conditions and corresponding requirements. In such cases, the requirements that apply to a condition are always the first set of requirements that follow the condition, even in the case of there being multiple sets of conditions for those requirements. Such cases are presented as follows:

これは、 ある条件 ◎ This is a condition
これは、 別の条件 ◎ This is another condition
これは、 上の条件に適用される要件。 ◎ This is the requirement that applies to the conditions above.
これは、 第三の条件 ◎ This is a third condition
これは、 第三の条件に適用される要件。 ◎ This is the requirement that applies to the third condition.

【 これは,[ ~IF, ~ELIF, ..., ~ELSE ]からなる一連の段で記しても論理的に同じなので、 和訳では,そのように記すこともある。 】

1.10. ~HTMLへの簡易な導入

◎非規範的

基本的な~HTML文書は、 次の様な見かけになる: ◎ A basic HTML document looks like this:

`intor-1^xCode

~HTML文書は、[ 要素, ~text ]たちが成す~treeからなる。 各~要素は、 ~source内では[ `<body>^l などの`開始~tag$, `</body>^l などの`終了~tag$ ]により表記される。 (ある種の[ 開始~tag/終了~tag ]は、 ある種の事例では[ `省略できる@~HTMLwriting#syntax-tag-omission$/ 他の~tagにより黙示される ](順不同))。 ◎ HTML documents consist of a tree of elements and text. Each element is denoted in the source by a start tag, such as "<body>", and an end tag, such as "</body>". (Certain start tags and end tags can in certain cases be omitted and are implied by other tags.)

すべての要素は、 その~tagを[ 一方が他方を完全に入子にする ]よう記す必要がある【!不要:without overlapping】: ◎ Tags have to be nested such that elements are all completely within each other, without overlapping:

`intor-2^xCode `intor-3^xCode

この仕様は、 ~HTML内で利用できる要素の集合を — 要素たちを入子にできる仕方についての規則と伴に — 定義する。 ◎ This specification defines a set of elements that can be used in HTML, along with rules about the ways in which the elements can be nested.

各~要素は、 いくつかの属性を有し得る — それらは、 要素がどう働くかを制御する。 次の例には、 `a$e 要素と その `href$a 属性を利用して形成される`~hyperlink$がある: ◎ Elements can have attributes, which control how the elements work. In the example below, there is a hyperlink, formed using the a element and its href attribute:

`intor-4^xCode

各`属性$は、 開始~tagの内側に配置され,文字 `=^l で分離された[ `属性~名$, `属性~値$ ]からなる。 属性~値は、[ `~ASCII空白$ / `"^l / `'^l / "`" / `=^l / `<^l / `>^l ]を包含しないならば, `引用符~無しで@~HTMLwriting#unquoted$あり続けれる。 他の場合,引用符( `"^c / `'^c )で括る必要がある。 値は、 空~文字列の場合には省略できる — その場合,文字 `=^l も込みで省略する。 ◎ Attributes are placed inside the start tag, and consist of a name and a value, separated by an "=" character. The attribute value can remain unquoted if it doesn't contain ASCII whitespace or any of " ' ` = < or >. Otherwise, it has to be quoted using either single or double quotes. The value, along with the "=" character, can be omitted altogether if the value is the empty string.

  • 空な属性: ◎ <!-- empty attributes -->

    `intor-5^xCode
  • 値を伴う属性: ◎ <!-- attributes with a value -->

    `intor-6^xCode

~HTML~UA(例:~web~browser)は、 この~markupを構文解析して,それを~DOM【!Document Object Model】~treeに転換する。 ~DOM~treeは、 ある文書の~memory内~表現である。 ◎ HTML user agents (e.g., web browsers) then parse this markup, turning it into a DOM (Document Object Model) tree. A DOM tree is an in-memory representation of a document.

~DOM~treeは、 何~種類かの — 特に,次に挙げる型の — ~nodeを包含する ⇒# `DocumentType$I, `Element$I, `Text$I, `Comment$I, 一部の事例では `ProcessingInstruction$I も。 ◎ DOM trees contain several kinds of nodes, in particular a DocumentType node, Element nodes, Text nodes, Comment nodes, and in some cases ProcessingInstruction nodes.

`この節の冒頭に与えた~markup片@#intro-early-example$は、 次の~DOM~treeに転換されることになろう: ◎ The markup snippet at the top of this section would be turned into the following DOM tree:

  • DOCTYPE: `html^c
  • `html$e `lang$a=`en^l
    • `head$e
      • `Text^I: `⏎␣␣^txt
      • `title$e
        • `Text^I: `~~見本ページ^txt
      • `Text^I: `⏎␣^txt
    • `Text^I: `⏎␣^txt
    • `body$e
      • `Text^I: `⏎␣␣^txt
      • `h6$e
        • `Text^I: `~~見本ページ^txt
      • `Text^I: `⏎␣␣^txt
      • `p$e
        • `Text^I: `これは^txt
        • `a$e `href$a=`demo.html^l
          • `Text^I: `~~単純^txt
        • `Text^I: `な~~見本。^txt
      • `Text^I: `⏎␣␣^txt
      • `Comment^I: `␣これはコメント␣^txt【!原文抜け:先頭/末尾の ␣ 】
      • `Text^I: `⏎␣⏎^txt

この~treeの`文書~要素$は `html$e 要素であり、 ~HTML文書においては,常にその位置に見出される要素である。 それは、 2 個の要素 `head$e, `body$e, および それらの合間にある `Text$I ~nodeを包含する。 ◎ The document element of this tree is the html element, which is the element always found in that position in HTML documents. It contains two elements, head and body, as well as a Text node between them.

~DOM~tree内には、 ~~見かけ以上に多数の `Text$I ~nodeがある — ~sourceは,何個かの[ ~space/改行 ](上では[ "␣" / "⏎" ]で表現される)を包含しており、 そのすべては,~DOM内では `Text$I ~nodeを成すことになるので。 しかしながら,歴史的な理由から、 元の~markup内の[ ~space/改行 ]には,~DOM内に現れないものもある。 特に、 空白のうち[ `head$e の開始~tagの前にあるものは,すべて黙って落とされる/ `body$e 終了~tagの後にあるものは,すべて `body$e 内の末尾に配置される ]結果になる。 ◎ There are many more Text nodes in the DOM tree than one would initially expect, because the source contains a number of spaces (represented here by "␣") and line breaks ("⏎") that all end up as Text nodes in the DOM. However, for historical reasons not all of the spaces and line breaks in the original markup appear in the DOM. In particular, all the whitespace before head start tag ends up being dropped silently, and all the whitespace after the body end tag ends up placed at the end of the body.

`head$e 要素は, `title$e 要素を包含する。 `title^e 要素は,[ ~text `~~見本ページ^l を伴う `Text$I ~node ]を包含する。 類似に、 `body$e 要素は,[ `h6$e 要素, `p$e 要素, ~comment ]を包含する。 ◎ The head element contains a title element, which itself contains a Text node with the text "Sample page". Similarly, the body element contains an h1 element, a p element, and a comment.


この~DOM~treeは、 ~page内の~scriptから操作できる。 ~script(概して~JS)は、[ `script$e 要素/`~event~handler内容~属性$ ]利用して埋込める小さな~programである。 例えば,次の~code内の~form( `form$e )は、 ~scriptを伴う — この~scriptは、 ~formの `output$e 要素の値を `Hello World^l に設定する: ◎ This DOM tree can be manipulated from scripts in the page. Scripts (typically in JavaScript) are small programs that can be embedded using the script element or using event handler content attributes. For example, here is a form with a script that sets the value of the form's output element to say "Hello World":

<`form$e `~name0$a="main">
 Result: <`output$e `name$a="result"></output>
 <`script$e>
  `document$m.`forms$m.main.`elements$m.result.`value$m = 'Hello World';
 </script>
</form>

~DOM~tree内の各~要素は、 ある~objで表現される。 これらの各~objは、 それが表現する要素を操作できる~APIを備える。 一例として,~link(例: 上の~tree内の `a$e 要素)は、 その `href$a 属性を,いくつかの仕方で変更できる: ◎ Each element in the DOM tree is represented by an object, and these objects have APIs so that they can be manipulated. For instance, a link (e.g. the a element in the tree above) can have its "href" attribute changed in several ways:

var %a = `document$m.`links$m[0]; /* 
文書~内の最初の~linkを得する
◎
obtain the first link in the document
 */
%a.`href$m = 'sample.html'; /* 
~linkの行先~URLを変更する
◎
change the destination URL of the link
 */
%a.`protocol$m = 'https'; /* 
~URLの~scheme~~成分だけ変更する
◎
change just the scheme part of the URL
 */
%a.setAttribute('href', 'https://example.com/'); /* 
内容~属性を直に変更する
◎
change the content attribute directly
 */

~DOM~treeは,[ ~HTML文書が実装(とりわけ~web~browserの様な対話的な実装)により処理され, 呈示されるときに,それを表現する仕方として利用される ]ので、 この仕様は、 ほとんどにおいて,上で述べた~markupに代えて~DOM~treeの用語で句される。 ◎ Since DOM trees are used as the way to represent HTML documents when they are processed and presented by implementations (especially interactive implementations like web browsers), this specification is mostly phrased in terms of DOM trees, instead of the markup described above.


~HTML文書は、 対話的な内容の[ 媒体に依存しない記述 ]を表現する。 ~HTML文書は、 ~screenのみならず,発話~合成器を通して, あるいは点字~displayに具現化されることもある。 作者は、 ~CSSなどの~style付け言語を利用して, そのような具現化が正確にどう その場を占めるかに波及できる。 ◎ HTML documents represent a media-independent description of interactive content. HTML documents might be rendered to a screen, or through a speech synthesizer, or on a braille display. To influence exactly how such rendering takes place, authors can use a styling language such as CSS.

次の例では、 ~pageは,~CSSを利用して[ 背景色は `navy^v, 前景色は `yellow^v ]になるようにしている。 ◎ In the following example, the page has been made yellow-on-blue using CSS.

`intor-7^xCode

作者には、 ~HTMLを利用する より詳細な方法については, ~tutorialや手引きに諮ることが奨励される。 この仕様に含めた一部の例も用を成すかもしれないが、 新参の作者は,この仕様が[ 必要に迫られ、 最初は理解するのが困難かもしれない~levelの詳細を伴って,言語を定義する ]ことに用心されたし。 ◎ For more details on how to use HTML, authors are encouraged to consult tutorials and guides. Some of the examples included in this specification might also be of use, but the novice author is cautioned that this specification, by necessity, defines the language with a level of detail that might be difficult to understand at first.

1.10.1. ~HTMLによる~secureな~appの書き方

◎非規範的

~HTMLを利用して対話的な~siteを作成するときは、 脆弱性 — 攻撃者が それを通して[ ~site自体や~siteの利用者 ]【の~data】の完全性を弱体化し得るような脆弱性 — を導入するのを避けるよう~careする必要がある。 ◎ When HTML is used to create interactive sites, care needs to be taken to avoid introducing vulnerabilities through which attackers can compromise the integrity of the site itself or of the site's users.

この問題mについての包括的な研究は,この文書の視野を超えるが、 作者には,当の問題mの詳細を もっと研究することが強く奨励される。 しかしながら,この節では、 ~HTMLの~app開発において共通的な陥穽のうち一部について,簡易な導入を供するよう試みる。 ◎ A comprehensive study of this matter is beyond the scope of this document, and authors are strongly encouraged to study the matter in more detail. However, this section attempts to provide a quick introduction to some common pitfalls in HTML application development.

~webの~security~modelは、 “生成元( `origins^en )” の概念に基づく。 それに対応して、 ~web上にあり得る攻撃の多くは,非同一-生成元による動作を孕む。 `ORIGIN$r ◎ The security model of the web is based on the concept of "origins", and correspondingly many of the potential attacks on the web involve cross-origin actions. [ORIGIN]

利用者-入力を検証しないとき ◎ Not validating user input
~XSS( `cross-site scripting^en ) ◎ Cross-site scripting (XSS)
~SQL注入 ◎ SQL injection

信用できない入力 — 例: 利用者が生成した内容 ~text~comment, ~URL~parameter内の値, 第三者-主体~siteからの~message, 等々 — を受容するときは、 それらの~dataを[ 利用する前に検証すること,および 適正に~escapeした上で表示する ]ことが絶対要件である。 これを行うのに失敗した場合、 各種~攻撃を遂行することを敵対的な利用者に許容し得る — それは、 善意的にもなり得るものから, デタラメな利用者~情報(例:負な年齢)を供するもの, 深刻なもの(例:利用者が その情報を内包する~pageを見るたびに毎回~scriptを走らすような), 果ては壊滅的になるもの(例:当の~process内の攻撃が伝播して,~server内のすべての~dataを削除するなど)までに至り得る。 ◎ When accepting untrusted input, e.g. user-generated content such as text comments, values in URL parameters, messages from third-party sites, etc, it is imperative that the data be validated before use, and properly escaped when displayed. Failing to do this can allow a hostile user to perform a variety of attacks, ranging from the potentially benign, such as providing bogus user information like a negative age, to the serious, such as running scripts every time a user looks at a page that includes the information, potentially propagating the attack in the process, to the catastrophic, such as deleting all data in the server.

利用者-入力を検証する~filterを書くときは、 常に安全~listに基づくこと — 安全なことが既知な構成子は許容する一方で、 他の入力は,すべて許容しないようにすること — が絶対要件である。 阻止-~listに基づく~filter — 不良なことが既知な入力は許容しない一方で、 他は,すべて許容するような~filter — は、 ~secureでない — 不良なものには、 まだ既知でないものがあるので (例えば,未来に考案されるかもしれない)。 ◎ When writing filters to validate user input, it is imperative that filters always be safelist-based, allowing known-safe constructs and disallowing all other input. Blocklist-based filters that disallow known-bad inputs and allow everything else are not secure, as not everything that is bad is yet known (for example, because it might be invented in the future).

例えば,ある~site【 `https://example.com^c 】のある~pageは、 ~URLの~query文字列を調べて何を表示するか決定してから, ある~messageを表示する~pageへ利用者を~redirectするとする — 次のように: ◎ For example, suppose a page looked at its URL's query string to determine what to display, and the site then redirected the user to that page to display a message, as in:

`writing-secure-1^xCode

~messageが~escapeされずに利用者に表示される場合、 敵対的な攻撃者は,~script要素を包含するよう~URLを細工することもできる: ◎ If the message was just displayed to the user without escaping, a hostile attacker could then craft a URL that contained a script element:

`https://example.com/message.cgi?say=%3Cscript%3Ealert%28%27Oh%20no%21%27%29%3C/script%3E^

攻撃者が次に,被害者になる利用者を この~pageを訪問するよう仕向けた場合、 攻撃者が選んだ~scriptを~page上で走らすことになる。 そのような~scriptは、 敵対的な動作を — 当の~siteが提供するものに制限される下で 【言い換えれば、[利用者が当の~siteに有する権限]を代理する下で】 — 何回でも行える。 一例として,当の~siteが電子商取引店舗であった場合、 そのような~scriptは,利用者が知らないうちに求まれない購入nを何回でも為せる。 ◎ If the attacker then convinced a victim user to visit this page, a script of the attacker's choosing would run on the page. Such a script could do any number of hostile actions, limited only by what the site offers: if the site is an e-commerce shop, for instance, such a script could cause the user to unknowingly make arbitrarily many unwanted purchases.

これは、 ~XSS( `cross-site scripting^en )攻撃と呼ばれる。 ◎ This is called a cross-site scripting attack.

構成子には、[ ある~codeを実行するよう,~siteを騙そうと試行する ]ためにも利用され得るものが,数多くある。 ここに,作者が安全~listに基づく~filterを書くとき考慮するよう奨励されるものをいくつか与える: ◎ There are many constructs that can be used to try to trick a site into executing code. Here are some that authors are encouraged to consider when writing safelist filters:

  • `img$e の様な無害に見える要素を許容するときでも、 その各~属性は,安全~listに基づいて供することが重要になる。 すべての属性を許容した場合、 攻撃者は,一例として `onload$m 属性を利用して任意な~scriptを走らすこともできる。 ◎ When allowing harmless-seeming elements like img, it is important to safelist any provided attributes as well. If one allowed all attributes then an attacker could, for instance, use the onload attribute to run arbitrary script.
  • ~URLを供することを許容するときは(例:~link用に)、 各~URLの~schemeも明示的に安全~listに基づく必要がある — 濫用され得る~schemeは、 いくつもあるので。 真っ先に挙がる例は `javascript:@~HTMLnav#the-javascript:-url-special-case$sc であるが、 ~UAは,それ以外も実装し得る (~~実際,歴史的に実装されていた)。 ◎ When allowing URLs to be provided (e.g. for links), the scheme of each URL also needs to be explicitly safelisted, as there are many schemes that can be abused. The most prominent example is "javascript:", but user agents can implement (and indeed, have historically implemented) others.
  • `base$e 要素を挿入することを許容することは、 ~page内の[ `script$e 要素/~form提出 ]のうち相対-~linkを伴うものは,どれも[ 乗取られ得る/敵対的な~siteへ~redirectされ得る ]ことを意味する。 ◎ Allowing a base element to be inserted means any script elements in the page with relative links can be hijacked, and similarly that any form submissions can get redirected to a hostile site.
~CSRF( `cross-site request forgery^en ) ◎ Cross-site request forgery (CSRF)

ある~siteが[ 利用者に特有な副作用を伴う~form提出を為す ]ことを利用者に許容する場合 — 例えば[ ある~forumに利用者の名の下で~messageを投稿する/ 購入nを為す/ ある入場許可証を適用する ]ためなど — 当の要請は、[ 別の~siteが利用者が知らないうちに為すよう騙したものではなく, 利用者が意図的に為したものである ]ことを検証yすることが重要になる。 ◎ If a site allows a user to make form submissions with user-specific side-effects, for example posting messages on a forum under the user's name, making purchases, or applying for a passport, it is important to verify that the request was made by the user intentionally, rather than by another site tricking the user into making the request unknowingly.

この問題が存在するのは、 ~HTML~formは,他の生成元へも提出し得ることによる。 ◎ This problem exists because HTML forms can be submitted to other origins.

~siteは、 そのような攻撃を次のいずれかにより防止できる ⇒# 利用者に特有な秘密な~tokenで~formを拡充する/ すべての要請に対し `Origin$h ~headerを検査する ◎ Sites can prevent such attacks by populating forms with user-specific hidden tokens, or by checking `Origin` headers on all requests.

~click乗取り ◎ Clickjacking

~pageは、[ 利用者が遂行したいと望まないかもしれない動作を遂行する~interface ]を利用者に供する場合には,[ 当の~interfaceを作動化するよう利用者が騙されるアリ性 ]を避けるよう設計する必要がある。 ◎ A page that provides users with an interface to perform actions that the user might not wish to perform needs to be designed so as to avoid the possibility that users can be tricked into activating the interface.

利用者が そう騙され得る仕方として、 ある敵対的~siteが小さな `iframe$e 内に被害者~siteを配置してから, 利用者が それを~clickするよう — 一例として,利用者が遊びたくなる~gameにより — 仕向ける場合が挙げられる。 敵対的な~siteは、 利用者が~gameを遊び始めたとき, 利用者が~clickしようとした~mouse~cursorの直下に当の `iframe^e を素早く位置でき、 被害者~siteの~interfaceを~clickするよう利用者を騙すことになる。 ◎ One way that a user could be so tricked is if a hostile site places the victim site in a small iframe and then convinces the user to click, for instance by having the user play a reaction game. Once the user is playing the game, the hostile site can quickly position the iframe under the mouse cursor just as the user is about to click, thus tricking the user into clicking the victim site's interface.

~siteは,これを避けるため、 ~frame内での利用を期待しない場合には,[ そうでないことを検出した場合に限り,自身の~interfaceを可能化する ]ことが奨励される (例: `window$m ~objと `top$m 属性の値を比較することにより)。 ◎ To avoid this, sites that do not expect to be used in frames are encouraged to only enable their interface if they detect that they are not in a frame (e.g. by comparing the window object to the value of the top attribute).

1.10.2. ~script用の~APIを利用するときに避けるべき共通的な陥穽

◎非規範的

~HTMLにおける~scriptには、 “完了まで走る( `run-to-completion^en )” 意味論がある。 それは、 一般に,次を意味する ⇒ ~browserは、 当の~scriptを,他の何かを行う (更に~eventを発火する/文書を構文解析し続ける,など) 前に中断することなく走らすことになる。 ◎ Scripts in HTML have "run-to-completion" semantics, meaning that the browser will generally run the script uninterrupted before doing anything else, such as firing further events or continuing to parse the document.

他方,~HTML~fileの構文解析は、 増分的に起こる — すなわち,構文解析器は、 どの地点でも静止して,~scriptを走らせ得る。 これは,一般には良いものになるが、[ ~event~handlerを~hookする【登録する】のが、 場合によっては,~eventが発火された後になる ]ことを避けるよう,作者は気を付ける必要があることを意味する。 ◎ On the other hand, parsing of HTML files happens incrementally, meaning that the parser can pause at any point to let scripts run. This is generally a good thing, but it does mean that authors need to be careful to avoid hooking event handlers after the events could have possibly fired.

これを依拠-可能に行うための技法には、 次の 2 つがある ⇒# `~event~handler内容~属性$を利用する/ 要素を作成するときに,同じ~script内で~event~handlerも追加する ◎終 後者が安全になるのは、 先に言及したとおり,[ 当の~scriptは、 更に~eventが発火され得る前に,完了まで走る ]からである。 ◎ There are two techniques for doing this reliably: use event handler content attributes, or create the element and add the event handlers in the same script. The latter is safe because, as mentioned earlier, scripts are run to completion before further events can fire.

次の例は、 これを `img$e 要素と `load$et ~eventで具体化する仕方を与える。 ~eventは、 要素が構文解析され次第,発火され得る — とりわけ,画像がすでに~cacheされていた(共通的にある)場合に。 ◎ One way this could manifest itself is with img elements and the load event. The event could fire as soon as the element has been parsed, especially if the image has already been cached (which is common).

次の~codeは、 作者が `img$e 要素の `onload$m ~handlerを利用して, `load$et ~eventを捕える: ◎ Here, the author uses the onload handler on an img element to catch the load event:

`common-pitfalls-1^xCode

当の要素が~scriptにより追加されている場合でも、 同じ~script内で~event~handlerが追加される限り,~eventを見逃すことはない: ◎ If the element is being added by script, then so long as the event handlers are added in the same script, the event will still not be missed:

<script>
 var %img = new Image();
 %img.src = 'games.png';
 %img.alt = 'Games';
 %img.onload = gamesLogoHasLoaded;
 // %img.addEventListener('load', gamesLogoHasLoaded, false); /* 
これも働く
◎
would work also
 */
</script>

しかしながら、 作者が最初に `img$e 要素を作成してから, 別々な~script内で~event~listenerを追加した場合、 その合間に `load$et ~eventが発火された場合に, ~eventを見逃すことになる: ◎ However, if the author first created the img element and then in a separate script added the event listeners, there's a chance that the load event would be fired in between, leading it to be missed:

<!-- 
この~styleは、
競争~条件があるので,利用しないこと。
◎
Do not use this style, it has a race condition!
 -->
 <img id="games" src="games.png" alt="Games">
 <!-- 
`load^et ~eventは、
構文解析器が休んでいる間に,ここで発火されるかもしれない
— その事例では、
~eventを見逃すことになる。
◎
the 'load' event might fire here while the parser is taking a break, in which case you will not see it!
 -->
 <script>
  var %img = document.getElementById('games');
  %img.onload = gamesLogoHasLoaded; /* 
決して発火されないかもしれない。
◎
might never fire!
 */
 </script>

1.10.3. ~HTMLを書くときに過ちを捕える方法: 検証器と適合性~検査器

◎非規範的

作者には、 適合性~検査器( “検証器” としても知られる)を用立てて, 共通的な過ちを捕えることが奨励される。 ~WHATWGは、 そのような~toolたちが成す~listを `https://whatwg.org/validator/@https://whatwg.org/validator/$ にて保守する。 ◎ Authors are encouraged to make use of conformance checkers (also known as validators) to catch common mistakes. The WHATWG maintains a list of such tools at: https://whatwg.org/validator/

1.11. 作者~向けの適合性~要件

◎非規範的

~HTML仕様の以前の~versionと違って、 この仕様は — 妥当な文書に加え — 妥当でない文書を処理するために要求される詳細も,いくつか定義する。 ◎ Unlike previous versions of the HTML specification, this specification defines in some detail the required processing for invalid documents as well as valid documents.

しかしながら,妥当でない内容の処理が ほとんどの事例できちんと定義されていても、 文書に対する適合性~要件は依然として重要になる — 文書に対する適合性~要件の目標は、 実施においては,相互運用能 (すべての実装が,特定0の内容を依拠-可能かつ, 一致するか等価な仕方で処理するような状況) に限られない。 この節では、 適合~文書と~errorを伴う文書を判別するための, もっと共通的な理由の一部を詳細に与える。 ◎ However, even though the processing of invalid content is in most cases well-defined, conformance requirements for documents are still important: in practice, interoperability (the situation in which all implementations process particular content in a reliable and identical or equivalent way) is not the only goal of document conformance requirements. This section details some of the more common reasons for still distinguishing between a conforming document and one with errors.

1.11.1. 呈示~用の~markup

◎非規範的

~HTMLの以前の~versionに由来する呈示~用の特能のうち大多数は、 もはや許容されない。 一般に,呈示~用の~markupには、 いくつかの問題があることが見出されている: ◎ The majority of presentational features from previous versions of HTML are no longer allowed. Presentational markup in general has been found to have a number of problems:

呈示~用の要素を利用すると、 ~accessibilityは拙くなる。 ◎ The use of presentational elements leads to poorer accessibility
呈示~用の~markupを[ 支援~技術の利用者に受容-可能な体験を供する仕方 ]で利用することは,アリではあるが(例:~ARIAを利用して)、 そうすることは,意味論的に適切な~markupを利用するときより有意に困難である。 さらには,そのような技法を利用しても、 非~支援~技術かつ非~graphicな~UA(~text~mode~browserなど)の利用者にとって~pageを~access可能にする助けにならない。 ◎ While it is possible to use presentational markup in a way that provides users of assistive technologies (ATs) with an acceptable experience (e.g. using ARIA), doing so is significantly more difficult than doing so when using semantically-appropriate markup. Furthermore, even using such techniques doesn't help make pages accessible for non-AT non-graphical users, such as users of text-mode browsers.
他方,媒体に依存しない~markupを利用することは、 利用者(例:~text~browserの利用者)用にもっと働く仕方で文書を著作するための, 容易な仕方を供する。 ◎ Using media-independent markup, on the other hand, provides an easy way for documents to be authored in such a way that they work for more users (e.g. users of text browsers).
保守の~costが高まる ◎ Higher cost of maintenance
~markupが~styleに依存しない仕方で書かれた~siteを保守する方が、 有意に容易になる。 例えば,ある~siteが `<font color="">^c を利用している場合、 その色を全体を通して変更することは,~site全体にわたる変更を要求する。 一方で,色を~CSSに基づくようにしてあれば、 類似な変更は,単独の~fileを変更することで行える。 ◎ It is significantly easier to maintain a site written in such a way that the markup is style-independent. For example, changing the color of a site that uses <font color=""> throughout requires changes across the entire site, whereas a similar change to a site based on CSS can be done by changing a single file.
文書の~sizeが増える ◎ Larger document sizes
呈示~用の~markupは、 ずっと冗長になる傾向にあり,文書の~sizeは増えることになる。 ◎ Presentational markup tends to be much more redundant, and thus results in larger document sizes.

これらの理由から、 呈示~用の~markupは,この~versionにおける~HTMLからは除去された。 この変更は、 驚くほどのものではないはずである — ~HTML4は、 何年も前に呈示~用の~markupを非推奨にした上で, 作者が呈示~用の~markupから脱却し易くする~mode( `HTML4 Transitional^cite )を供した — 後に,~XHTML 1.1 は、 更に先へ進んで,それらの特能を まとめて廃用にした。 ◎ For those reasons, presentational markup has been removed from HTML in this version. This change should not come as a surprise; HTML4 deprecated presentational markup many years ago and provided a mode (HTML4 Transitional) to help authors move away from presentational markup; later, XHTML 1.1 went further and obsoleted those features altogether.

~HTMLにおいて唯一残された呈示~用の~markup特能は、 `style$a 属性と `style$e 要素である。 `style$a 属性の利用は、 本番~環境においては いくぶん忌避されるが,[ 迅速な試作~用 (当の~style規則は、 後で別々な~stylesheetの中に直に移動できる)/ 別々な~stylesheetでは不便になるような通例的でない事例において, ~pageに特有な~styleを供するため ]には有用になり得る。 類似に, `style$e 要素は[ `syndication^en において† / ~pageに特有な~style用に ]有用になり得るが、 一般に,~styleを複数の~pageに適用するときは外部~stylesheetの方が簡便になる見込みが高い。 【†不特定多数の~site向けに配信される~stylesheetを利用するため? あるいは動的に生成される~stylesheetを埋込むため?】 ◎ The only remaining presentational markup features in HTML are the style attribute and the style element. Use of the style attribute is somewhat discouraged in production environments, but it can be useful for rapid prototyping (where its rules can be directly moved into a separate style sheet later) and for providing specific styles in unusual cases where a separate style sheet would be inconvenient. Similarly, the style element can be useful in syndication or for page-specific styles, but in general an external style sheet is likely to be more convenient when the styles apply to multiple pages.

また、 次に挙げる,以前は呈示~用であった要素は、 この仕様により媒体に依存しないものに定義し直された ⇒ `b$e, `i$e, `hr$e, `s$e, `small$e, `u$e ◎ It is also worth noting that some elements that were previously presentational have been redefined in this specification to be media-independent: b, i, hr, s, small, and u.

1.11.2. 構文~error

◎非規範的

~HTMLの構文は、 多種多様な問題を避けるよう拘束される。 ◎ The syntax of HTML is constrained to avoid a wide variety of problems.

~errorを取扱う挙動が直感に反するもの ◎ Unintuitive error-handling behavior
ある種の妥当でない構文~構成子は、 構文解析した結果が ひどく直感に反する~DOM~treeになる。 ◎ Certain invalid syntax constructs, when parsed, result in DOM trees that are highly unintuitive.

例えば,次の~markup片による結果の~DOMには、 `hr$e 要素があるが,それは対応する `table$e 要素に`~~先行する^em同胞になる: ◎ For example, the following markup fragment results in a DOM with an hr element that is an earlier sibling of the corresponding table element:

`syntax-errors-1^xCode
任意選択で~error回復を伴う~error ◎ Errors with optional error recovery
制御された環境において利用される~UAが[ より奇妙で込み入った~error取扱い規則 ]を実装しなくとも済むよう、 ~UAには,[ `構文解析-~error$に遭遇したときには,失敗する ]ことも許可される。 ◎ To allow user agents to be used in controlled environments without having to implement the more bizarre and convoluted error handling rules, user agents are permitted to fail whenever encountering a parse error.
~errorを取扱う挙動が~streamしている~UAと互換でない~error ◎ Errors where the error-handling behavior is not compatible with streaming user agents
~errorを取扱う挙動のうち一部は — 上に言及した例 `<table><hr>...^c の挙動など — ~streamしている~UA (~HTML~fileを,状態を格納せずに 1 周回で処理する~UA) と互換でない。 そのような~UAとの相互運用能の問題を避けるため、 結果がそのような挙動になる構文は, どれも妥当でないものと見なされる。 ◎ Some error-handling behavior, such as the behavior for the <table><hr>... example mentioned above, are incompatible with streaming user agents (user agents that process HTML files in one pass, without storing state). To avoid interoperability problems with such user agents, any syntax resulting in such behavior is considered invalid.
~XML~infosetに型強制し得る結果になる~error ◎ Errors that can result in infoset coercion
~XMLに基づく~UAが~HTML構文解析器に接続されるとき,~XMLが施行するある種の不変則 — 要素や属性の名前は複数個の~colonを決して包含しないなど — は、 ~HTML~fileにおいては違反されることもある。 これを取扱うためには、 構文解析器が~HTML~DOMを~XMLに互換な~infosetに型強制することが要求され得る。 そのような取扱いを要求する構文~構成子のほとんどは、 妥当でないものと見なされる。 (【例えば】[ 連続する 2 個の~hyphenを包含している/~hyphenで終端している ]~commentは、 ~HTML構文において許容される例外である。) ◎ When a user agent based on XML is connected to an HTML parser, it is possible that certain invariants that XML enforces, such as element or attribute names never contain multiple colons, will be violated by an HTML file. Handling this can require that the parser coerce the HTML DOM into an XML-compatible infoset. Most syntax constructs that require such handling are considered invalid. (Comments containing two consecutive hyphens, or ending with a hyphen, are exceptions that are allowed in the HTML syntax.)
処理能をひどく劣化させる~error ◎ Errors that result in disproportionately poor performance
ある種の構文~構成子は、 処理能をひどく劣化させる。 そのような構成子は、 その利用を忌避するよう,概して不適合にされる。 ◎ Certain syntax constructs can result in disproportionately poor performance. To discourage the use of such constructs, they are typically made non-conforming.

例えば,次の~markupは、 処理能を劣化させる — 閉じられていない `i$e 要素は,各~段落~内で構築し直す必要があり、 その結果,各~段落( `p$e 要素)内に生じる要素は次第に増えていくので: ◎ For example, the following markup results in poor performance, since all the unclosed i elements have to be reconstructed in each paragraph, resulting in progressively more elements in each paragraph:

`syntax-errors-2^xCode

この~code片による結果の~DOMは、 次のようになろう: ◎ The resulting DOM for this fragment would be:

  • `p^e
    • `i^e
      • `Text$I: `She dreamt.^txt
  • `p^e
    • `i^e
      • `i^e
        • `Text^I: `She dreamt that she ate breakfast.^txt
  • `p^e
    • `i^e
      • `i^e
        • `i^e
          • `Text^I: `Then lunch.^txt
  • `p^e
    • `i^e
      • `i^e
        • `i^e
          • `i^e
            • `Text^I: `And finally dinner.^txt
崩れ易い構文~構成子を孕んでいる~error ◎ Errors involving fragile syntax constructs
歴史的な理由から,他に比して崩れ易い構文~構成子がある。 そのような問題に偶発的に はまる利用者を減らすため、 それらは不適合にされる。 ◎ There are syntax constructs that, for historical reasons, are relatively fragile. To help reduce the number of users who accidentally run into such problems, they are made non-conforming.

例えば,属性~内のある種の`有名~文字~参照$の構文解析は、 それを閉じる~semicolonが省略されても起こる。 有名~文字~参照を形成しない英字~列は, ~ampersandに後続するよう内包しても安全であるが、 当の英字~列が有名~文字~参照を`形成する^em文字列に変更された場合, それが指している文字として解釈されることになる。 ◎ For example, the parsing of certain named character references in attributes happens even with the closing semicolon being omitted. It is safe to include an ampersand followed by letters that do not form a named character reference, but if the letters are changed to a string that does form a named character reference, they will be interpreted as that character instead.

次の~code片においては、 属性の値は `?bill&ted^l になる: ◎ In this fragment, the attribute's value is "?bill&ted":

`syntax-errors-3^xCode

しかしながら,次の~code片における属性の値は、 実際に意図された `?art&copy^l `ではなく^em, `?art©^l になる — `&copy^l には末尾に~semicolonが無いが、 それでも `&copy;^l と同じに取扱われ, その結果 `©^l として解釈されるので: ◎ In the following fragment, however, the attribute's value is actually "?art©", not the intended "?art&copy", because even without the final semicolon, "&copy" is handled the same as "&copy;" and thus gets interpreted as "©":

`syntax-errors-4^xCode

この問題を避けるため、 すべての`有名~文字~参照$は,~semicolonで終端することが要求される — ~semicolonを伴わない有名~文字~参照の利用は、 ~errorとして~flagされる【記録され, 報告される】。 ◎ To avoid this problem, all named character references are required to end with a semicolon, and uses of named character references without a semicolon are flagged as errors.

したがって,上の事例を表出する正しい仕方は: ◎ Thus, the correct way to express the above cases is as follows:

  • `syntax-errors-5^xCode

    この `&ted^c は、 有名~文字~参照を成さないので差し支えない。 ◎ <!-- &ted is ok, since it's not a named character reference -->

  • `syntax-errors-6^xCode

    この場合の `&^c は~escapeする必要がある — `&copy^c が有名~文字~参照を`成す^emので。 ◎ <!-- the & has to be escaped, since &copy is a named character reference -->

旧来の~UAにおいて既知な相互運用能の問題を孕んでいる~error ◎ Errors involving known interoperability problems in legacy user agents
ある種の構文~構成子は、 旧来の~UAにおいて,とりわけ[ 微妙/深刻 ]な問題をもたらすことが既知であり、 作者が それを避ける助けになるよう,不適合とされる。 ◎ Certain syntax constructs are known to cause especially subtle or serious problems in legacy user agents, and are therefore marked as non-conforming to help authors avoid them.
例えば,引用符~無しの属性において文字 `0060^U `GRAVE ACCENT^cn (`) が許容されないのは、 これが~~理由にある。 ある種の旧来の~UAにおいては、 それは,ときには引用符として扱われる。 ◎ For example, this is why the U+0060 GRAVE ACCENT character (`) is not allowed in unquoted attributes. In certain legacy user agents, it is sometimes treated as a quote character.
別の例は,`~DOCTYPE$であり、 `過去互換なし~mode$を誘発するために要求される — `過去互換~mode$における旧来の~UAの挙動は、 ほとんど文書化されていないことが多いので。 ◎ Another example of this is the DOCTYPE, which is required to trigger no-quirks mode, because the behavior of legacy user agents in quirks mode is often largely undocumented.
作者を~security攻撃に晒す~riskがある~error ◎ Errors that risk exposing authors to security attacks
純粋に,既知な~security問題を避けるため、 ある種の制約が存在する。 ◎ Certain restrictions exist purely to avoid known security problems.
例えば,~UTF-7は利用しないものとする制約は、 純粋に,作者が~UTF-7を利用して既知な~XSS攻撃の餌食になるのを避けるために存在する。 `UTF7$r ◎ For example, the restriction on using UTF-7 exists purely to avoid authors falling prey to a known cross-site-scripting attack using UTF-7. [UTF7]
作者の意図が不明瞭な事例 ◎ Cases where the author's intent is unclear
作者の意図が不明瞭な~markupは、 不適合にされることが多い。 これらの~errorを早期に正すことは、 後からの保守を楽にする。 ◎ Markup where the author's intent is very unclear is often made non-conforming. Correcting these errors early makes later maintenance easier.

例えば,次は、 作者が[ `h1$e, `h2$e ]どちらの見出しを意図したのか不明瞭である: ◎ For example, it is unclear whether the author intended the following to be an h1 heading or an h2 heading:

`syntax-errors-7^xCode
誤記である見込みが高い事例 ◎ Cases that are likely to be typos
利用者が単純な誤記を為したとき、 ~errorを早期に捕えれたなら役立つ — 作者が~debugする時間をかなり節約できるので。 したがって,この仕様は、 この仕様に定義される名前に合致しない[ 要素~名, 属性~名, 等々 ]の利用を通例的に~errorと見なす。 ◎ When a user makes a simple typo, it is helpful if the error can be caught early, as this can save the author a lot of debugging time. This specification therefore usually considers it an error to use element names, attribute names, and so forth, that do not match the names defined in this specification.
例えば,作者が `<caption>^c の代わりに `<capton>^c と打込んだ場合、 ~errorとして~flagされることになり, 作者は その誤記を即時に正せるようにもなる。 ◎ For example, if the author typed <capton> instead of <caption>, this would be flagged as an error and the author could correct the typo immediately.
将来に新たな構文に干渉し得る~error ◎ Errors that could interfere with new syntax in the future
この言語の構文を将来に拡張することを許容するため、 ある種の特能は,他では無害であっても許容されない。 ◎ In order to allow the language syntax to be extended in the future, certain otherwise harmless features are disallowed.
例えば,終了~tag内の “属性” は、 現時点では無視されるが、 この言語が将来に[ そのような構文~特能を — すでに配備-済みな(かつ妥当な)内容と競合することなく — 用立てる ]よう変更されたときには,妥当でなくなる。 ◎ For example, "attributes" in end tags are ignored currently, but they are invalid, in case a future change to the language makes use of that syntax feature without conflicting with already-deployed (and valid!) content.

一部の作者は、[ どの属性も常に引用符で括って,省略可能な どの~tagも常に内包する ]ような実施が役立つと見出す — ~HTML構文の~~寛容さを用立てることで短く記せるようになる小さな便益より,そのような~customな実施から導出される一貫性を選好して。 そのような作者を援助するため、 適合性~検査器は,そのような規約を施行する運用~modeを供せる。 ◎ Some authors find it helpful to be in the practice of always quoting all attributes and always including all optional tags, preferring the consistency derived from such custom over the minor benefits of terseness afforded by making use of the flexibility of the HTML syntax. To aid such authors, conformance checkers can provide modes of operation wherein such conventions are enforced.

1.11.3. 内容~modelと属性~値に対する制約

◎非規範的

この仕様は、 ~HTML言語の構文の他にも,[ 要素/属性 ]をどう指定し得るかに対しても制約を課す。 これらの制約が在る理由は、 類似する: ◎ Beyond the syntax of the language, this specification also places restrictions on how elements and attributes can be specified. These restrictions are present for similar reasons:

意味論が疑な内容を孕んでいる~error ◎ Errors involving content with dubious semantics
定義された意味を伴う要素の誤った利用を避けるため、 内容~modelは,[ 要素どうしを どう入子にできるか ]を[ その結果が疑なものにならないよう制約する ]ように定義される。 ◎ To avoid misuse of elements with defined meanings, content models are defined that restrict how elements can be nested when such nestings would be of dubious value.
例えば,この仕様は、 `kbd$e 要素の内側に `section$e 要素を入子にするのを許容しない — 作者が[ ~section全体を~UIkeyで~~入力するべきである ]よう指示することは,まず見込まれないので。 ◎ For example, this specification disallows nesting a section element inside a kbd element, since it is highly unlikely for an author to indicate that an entire section should be keyed in.
表出される意味論における競合を孕む~error ◎ Errors that involve a conflict in expressed semantics
類似に,要素の利用における過ちに作者の注目を引くため、 表出された意味論における明瞭な矛盾もまた,適合性~errorと見なされる。 ◎ Similarly, to draw the author's attention to mistakes in the use of elements, clear contradictions in the semantics expressed are also considered conformance errors.

例えば,次の両~code片における意味論は、 どちらもイミを成さない — 分離子は同時的に~cellにはなり得ないし、 ~radio~buttonは同時的に進捗~barにはなり得ないので。 ◎ In the fragments below, for example, the semantics are nonsensical: a separator cannot simultaneously be a cell, nor can a radio button be a progress bar.

`restrictions-1^xCode `restrictions-2^xCode
別の例は、 `ul$e 要素の内容~modelに対する制約であり,その子として許容するのは `li$e 要素に限られる。 定義により,~listは 0 個以上の~list~itemのみからなるので、 `ul$e 要素が `li$e 要素~以外の何かを包含する場合,何を意味したのか明瞭でなくなる。 ◎ Another example is the restrictions on the content models of the ul element, which only allows li element children. Lists by definition consist just of zero or more list items, so if a ul element contains something other than an li element, it's not clear what was meant.
既定の~styleが混乱を招く見込みが高い事例 ◎ Cases where the default styles are likely to lead to confusion
ある種の要素たちの既定の[ ~style/挙動 ]が成す ある種の組合nには、 混乱を招く見込みが高いものがある。 そのような組合nは、 この問題を伴わない等価な代替がある所では,許容されない。 ◎ Certain elements have default styles or behaviors that make certain combinations likely to lead to confusion. Where these have equivalent alternatives without this problem, the confusing combinations are disallowed.
例えば,[ `div$e / `span$e ]要素の内側に[ `div^e / `span^e ]要素(順不同)を入子にすることは,どれも同じ目的を~serveするが、 それらのうち[ `span^e 内に `div^e を入子にする組合n ]は許容されない — [ `div^e 要素は`塊~box$/ `span^e 要素は`行内~box$ ]として具現化され、 `行内~box$内に`塊~box$を置くことは,不必要に惑わすものになるので。 ◎ For example, div elements are rendered as block boxes, and span elements as inline boxes. Putting a block box in an inline box is unnecessarily confusing; since either nesting just div elements, or nesting just span elements, or nesting span elements inside div elements all serve the same purpose as nesting a div element in a span element, but only the latter involves a block box in an inline box, the latter combination is disallowed.
別の例として、 `対話的~内容$は入子にできない。 例えば, `button$e 要素は `textarea$e 要素を包含し得ない — そのように入子にすると、 その既定の挙動は,利用者を ひどく惑わすものになるので。 これらの要素は、 入子にしないで並べて配置しても用を成す。 ◎ Another example would be the way interactive content cannot be nested. For example, a button element cannot contain a textarea element. This is because the default behavior of such nesting interactive elements would be highly confusing to users. Instead of nesting these elements, they can be placed side by side.
仕様を誤解している見込みが高いことを指示する~error ◎ Errors that indicate a likely misunderstanding of the specification
ときには、 許容すると作者を惑わす見込みが高まるので,許容されないものもある。 ◎ Sometimes, something is disallowed because allowing it would likely cause author confusion.
例えば、 `disabled$a 属性を値 `false^l に設定するのは許容されない — それは、 外見上は要素は可能化されること(非 `disable^en )を意味しそうだが、 ~~実際には,要素は`不能化される^emことを意味する (実装にとって問題mになるのは、 属性の値ではなく,その有無なので)。 ◎ For example, setting the disabled attribute to the value "false" is disallowed, because despite the appearance of meaning that the element is enabled, it in fact means that the element is disabled (what matters for implementations is the presence of the attribute, not its value).
単に この言語を単純~化するために課される制限sを孕んでいる~error ◎ Errors involving limits that have been imposed merely to simplify the language
一部の適合性~errorは、 この言語を単純~化する — 作者は、 そのことを学習する必要がある。 ◎ Some conformance errors simplify the language that authors need to learn.
例えば, `area$e 要素の `shape$a 属性は、 実施においては[ `circ$v, `circle$v ]両~値を同義語として受容するにもかかわらず — ~tutorialその他の学習~援助を単純~化するため — `circ^v 値の利用は許容しない。 どちらも許容することに便益は無い上、 この言語を教えるときに余計な混乱をもたらすことになろう。 ◎ For example, the area element's shape attribute, despite accepting both circ and circle values in practice as synonyms, disallows the use of the circ value, so as to simplify tutorials and other learning aids. There would be no benefit to allowing both, but it would cause extra confusion when teaching the language.
構文解析器の癖を孕む~error ◎ Errors that involve peculiarities of the parser
ある種の要素は、 (概して,歴史的な理由から)いくぶん風変わりな仕方で構文解析される — それらの内容~modelに対する制約は、 これらの課題を作者に晒すのを避けることが意図される。 ◎ Certain elements are parsed in somewhat eccentric ways (typically for historical reasons), and their content model restrictions are intended to avoid exposing the author to these issues.

例えば `form$e 要素は、 `句ng内容$の内側では許容されない — `form^e 要素の開始~tagは、 ~HTMLとして構文解析されるとき `p$e 要素の終了~tagを含意することになるので。 したがって,次の~markupによる結果は、 1 個ではなく 2 個の`段落$になる: ◎ For example, a form element isn't allowed inside phrasing content, because when parsed as HTML, a form element's start tag will imply a p element's end tag. Thus, the following markup results in two paragraphs, not one:

`restrictions-3^xCode

それは、 正確に次の様に構文解析される: ◎ It is parsed exactly like the following:

`restrictions-4^xCode
~scriptが~debugし難くなる方へ陥れる見込みが高い~error ◎ Errors that would likely result in scripts failing in hard-to-debug ways
一部の~errorは、 ~scriptが~debugし難くなる問題を防止する助けになることが意図される。 ◎ Some errors are intended to help prevent script problems that would be hard to debug.
一例として、 同じ値をとる `id$a 属性を有する要素が複数ある場合,不適合になる。 重複した~IDは、 間違った要素が選定されることへ導く — ときには、 その原因を決定するのが難しい悲惨な効果になる。 ◎ This is why, for instance, it is non-conforming to have two id attributes with the same value. Duplicate IDs lead to the wrong element being selected, with sometimes disastrous effects whose cause is hard to determine.
著作~時間を浪費する~error ◎ Errors that waste authoring time
一部の構成子は、 許容されない — 歴史的に,多くの著作~時間を浪費させた原因を成していたので。 それらを避けるよう奨励することにより、 作者が将来の労において時間を節約できるようにする。 ◎ Some constructs are disallowed because historically they have been the cause of a lot of wasted authoring time, and by encouraging authors to avoid making them, authors can save time in future efforts.
例えば, `script$e 要素の `src$a 属性は、 要素の内容を無視させる。 しかしながら,これは明白ではない — とりわけ,当の要素の内容が実行-可能な~scriptのように現れる場合、 作者が~inline~scriptを — 実行されていないのに気付かずに — ~debugしようと試行するのに何時間も費やすよう導き得る。 この問題を抑制するため,この仕様は、 `src$a 属性を有する `script$e 要素~内に実行-可能な~scriptがある場合, それを不適合にする。 これは、 自身の文書を検証している作者が, この種類の過ちで時間を浪費する見込みを抑えることを意味する。 ◎ For example, a script element's src attribute causes the element's contents to be ignored. However, this isn't obvious, especially if the element's contents appear to be executable script — which can lead to authors spending a lot of time trying to debug the inline script without realizing that it is not executing. To reduce this problem, this specification makes it non-conforming to have executable script in a script element when the src attribute is present. This means that authors who are validating their documents are less likely to waste time with this kind of mistake.
作者が~HTML構文と~XML構文の間で移行するときに影響する何かを孕む~error ◎ Errors that involve areas that affect authors migrating between the HTML and XML syntaxes
一部の作者は、[ ~XML, ~HTMLどちらにも解釈でき,類似な結果を得る ]ような~fileを書くことを好む。 この実施は, 無数の微妙な複雑化が孕まれることに因り,一般には忌避されるが (とりわけ[ ~scripting/~style付け/何らかの種類の自動化された直列化 ]を孕むとき)、 この仕様には,[ 少なくとも困難さをいくぶん軽減する ]ことが意図される少数の制約がある。 これは、作者が[ ~HTML構文と~XML構文の間で移行するためのつなぎ ]として利用し易くするためにある。 ◎ Some authors like to write files that can be interpreted as both XML and HTML with similar results. Though this practice is discouraged in general due to the myriad of subtle complications involved (especially when involving scripting, styling, or any kind of automated serialization), this specification has a few restrictions intended to at least somewhat mitigate the difficulties. This makes it easier for authors to use this as a transitionary step when migrating between the HTML and XML syntaxes.
例えば, `lang$a 属性と `xml:lang@~TR/xml/#sec-lang-tag$a 属性には、 この 2 つの値を同期し続けることが意図される,いくぶん複雑な規則がある。 ◎ For example, there are somewhat complicated rules surrounding the lang and xml:lang attributes intended to keep the two synchronized.
別の例として,[ ~HTML直列化における `xmlns^a 属性の値に対する制約 ]は、[ 適合~文書~内の要素が~HTML, ~XMLどちらで処理されても, 同じ名前空間に属するようになる ]ことを確保することが意図される。 ◎ Another example would be the restrictions on the values of xmlns attributes in the HTML serialization, which are intended to ensure that elements in conforming documents end up in the same namespaces whether processed as HTML or XML.
~HTML語彙を将来に拡げるために予約される区画を孕む~error ◎ Errors that involve areas reserved for future expansion
構文に対する制約のうち[ この言語の将来の改訂において,新たな構文を許容することが意図されるもの ]と同じく,[ 要素の内容~model, 属性の値 ]に対する制約のうち一部は、 ~HTML語彙を将来に拡げることを許容することが意図される。 ◎ As with the restrictions on the syntax intended to allow for new syntax in future revisions of the language, some restrictions on the content models of elements and values of attributes are intended to allow for future expansion of the HTML vocabulary.
例えば, `target$a 属性の値を[ 特定の定義済みな値に限り,文字 `005F^U `LOW LINE^cn (_) から開始する ]よう制限するのは、 将来のある時点に[ 作者が定義した値と競合することなく,新たな定義済みな値を導入する ]ことを許容するためである。 ◎ For example, limiting the values of the target attribute that start with an U+005F LOW LINE character (_) to only specific predefined values allows new predefined values to be introduced at a future time without conflicting with author-defined values.
他の仕様の誤った利用を指示する~error ◎ Errors that indicate a mis-use of other specifications
ある種の制約は、 他の仕様により為された制約を~supportするために意図される。 ◎ Certain restrictions are intended to support the restrictions made by other specifications.
例えば,[ 媒体~query~listをとる属性は、 `妥当な媒体~query~list$に限り利用する ]よう要求することは、 その仕様の適合性~規則に従うことの重要度を強化する。 ◎ For example, requiring that attributes that take media query lists use only valid media query lists reinforces the importance of following the conformance rules of that specification.

1.12. 示唆される読み物

◎非規範的

この仕様の読者には、 次に挙げる文書にも関心があるかもしれない。 ◎ The following documents might be of interest to readers of this specification.

`Character Model for the World Wide Web 1.0: Fundamentals^cite (~Webのための文字~model:根本原則) `CHARMOD$r ◎ Character Model for the World Wide Web 1.0: Fundamentals [CHARMOD]

この~architecture上の仕様は、[ 仕様の作者/~software開発者/内容~開発者 ]向けに、 ~Web上の[ 相互運用可能な~text操作 ]用の共通な基準を供する — それは、[ ~Unicode標準( `Unicode Standard^en )と `ISO/IEC-10646^r ]の共同により定義された普遍的な文字~集合( `Universal Character Set^en )の上に築かれる。 この文書は、 次の論題について取組む ⇒# 用語[ 文字, 符号化法, 文字列 ]の~~用法, 基準~処理~model, 文字~符号化法の~~選択と識別, 文字~escape法, 文字列の付番 ◎ This Architectural Specification provides authors of specifications, software developers, and content developers with a common reference for interoperable text manipulation on the World Wide Web, building on the Universal Character Set, defined jointly by the Unicode Standard and ISO/IEC 10646. Topics addressed include use of the terms 'character', 'encoding' and 'string', a reference processing model, choice and identification of character encodings, character escaping, and string indexing.

`Unicode Security Considerations^cite `UTR36$r (~Unicodeにおける~securityの考慮点) ◎ Unicode Security Considerations [UTR36]

~Unicodeは,数えきれない文字を包含して,世界の様々な書記体系を組入れるので、 不正な用法は,~programや~systemを【!possible】~security攻撃に晒し得る。 これは、 製品が国際-化されればされるほど,とりわけ重要になる。 この文書は、[ ~programmer/ ~system~analyst/ 標準~開発者/ 利用者 ]が織り込むべき~security考慮点のうち一部を述べるとともに,問題の~riskを抑制するための特有な推奨を供する。 ◎ Because Unicode contains such a large number of characters and incorporates the varied writing systems of the world, incorrect usage can expose programs or systems to possible security attacks. This is especially important as more and more products are internationalized. This document describes some of the security considerations that programmers, system analysts, standards developers, and users should take into account, and provides specific recommendations to reduce the risk of problems.

`Web Content Accessibility Guidelines (WCAG)^cite `WCAG$r (~web内容における~accessibilityの指針) ◎ Web Content Accessibility Guidelines (WCAG) [WCAG]

~WCAGは、 ~web内容をもっと~access可能にするための広~範囲な推奨を受持つ。 これらの指針に従うことは:

  • 障害を伴う広-範囲な人々から内容を~access可能にする — 次に挙げる障害, それらの組合nを含め ⇒ 低視力, 難聴, 学習~障害, 認知~制限, 制限された身体動作, 発話~障害, 光感受性
  • 加えて,一般に、 ~web内容が利用者からもっと利用-可能になることも多い。
◎ Web Content Accessibility Guidelines (WCAG) covers a wide range of recommendations for making web content more accessible. Following these guidelines will make content accessible to a wider range of people with disabilities, including blindness and low vision, deafness and hearing loss, learning disabilities, cognitive limitations, limited movement, speech disabilities, photosensitivity and combinations of these. Following these guidelines will also often make your web content more usable to users in general.
`Authoring Tool Accessibility Guidelines (ATAG) 2.0^cite `ATAG$r (著作~toolにおける~accessibilityの指針) ◎ Authoring Tool Accessibility Guidelines (ATAG) 2.0 [ATAG]

この仕様は、 ~web内容~著作~toolを[ 障害を伴う人々から もっと~access可能にする ]ように設計するための指針を供する。 これらの指針に適合する著作~toolは、 次により~accessibilityを促進することになる:

  • 障害を伴う作者に~access可能な~UIを供する。
  • すべての作者に,~access可能な~web内容の生産を[ 可能化する/~supportする/促進する ]。
◎ This specification provides guidelines for designing web content authoring tools that are more accessible for people with disabilities. An authoring tool that conforms to these guidelines will promote accessibility by providing an accessible user interface to authors with disabilities as well as by enabling, supporting, and promoting the production of accessible web content by all authors.
User Agent Accessibility Guidelines (UAAG) 2.0 `UAAG$r (~UAにおける~accessibilityの指針) ◎ User Agent Accessibility Guidelines (UAAG) 2.0 [UAAG]

この文書は、[ 障害を伴う人々にとって,~web~accessibilityの障壁を低める ]ように~UAを設計するための指針を供する。 ~UAは、 ~browser, および[ ~web内容を検索取得して具現化する他の型の~software ]を含む。 これらの指針に適合する~UAは、 自前の~UIや他の内部的な便宜性を通して, ~accessibilityを促進することになる — 他の技術と通信する能(とりわけ支援~技術)も含め。 さらには,障害を伴う利用者のみならず、 すべての利用者にとって,適合~UAがもっと利用-可能になることを見出すはずである。 ◎ This document provides guidelines for designing user agents that lower barriers to web accessibility for people with disabilities. User agents include browsers and other types of software that retrieve and render web content. A user agent that conforms to these guidelines will promote accessibility through its own user interface and through other internal facilities, including its ability to communicate with other technologies (especially assistive technologies). Furthermore, all users, not just users with disabilities, should find conforming user agents to be more usable.