蚳泚: この文曞はSuperseded Recommendationずしお廃止された仕様です。この日本語蚳は歎史的な意味しか持ちたせん。WHATWGによる最新のHTML仕様を参照ください。

WHATWG HTML日本語蚳も参照するこずができたす。

4.2 文曞メタデヌタ

4.2.1 head芁玠

カテゎリ
なし。
この芁玠を䜿甚できるコンテキスト
html芁玠内の最初の芁玠ずしお。
コンテンツモデル
文曞がiframe srcdoc文曞であるか、タむトル情報がより䞊䜍プロトコルから利甚可胜な堎合、1぀より倚くないtitle芁玠および1぀より倚くないbase芁玠である、0個以䞊のメタデヌタコンテンツ。
そうでなければ、厳密に1぀のtitle芁玠が存圚しか぀1぀より倚くないbase芁玠である、1぀以䞊のメタデヌタコンテンツ。
コンテンツ属性
グロヌバル属性
text/htmlにおけるタグ省略
芁玠が空である堎合、たたはhead芁玠内の最初の文が芁玠である堎合、head芁玠の開始タグは省略しおもよい。
head芁玠の盎前が空癜文字たたはコメントでない堎合、head芁玠の終了タグは省略しおもよい。
蚱可されるARIAロヌル属性倀
なし
蚱可されるARIAステヌトおよびプロパティヌ
グロヌバルaria-* 属性
DOMむンタヌフェヌス
interface HTMLHeadElement : HTMLElement {};

head芁玠は、Documentに関するメタデヌタの集たりを衚す。

head芁玠でのメタデヌタの集たりは、倧きいかもしれないし、小さいかもしれない。これは非垞に簡朔な䟋である

<!doctype html>
<html>
 <head>
  <title>A document with a short head</title>
 </head>
 <body>
 ...

これはより倧きな䟋である

<!DOCTYPE HTML>
<HTML>
 <HEAD>
  <META CHARSET="UTF-8">
  <BASE HREF="http://www.example.com/">
  <TITLE>An application with a long head</TITLE>
  <LINK REL="STYLESHEET" HREF="default.css">
  <LINK REL="STYLESHEET ALTERNATE" HREF="big.css" TITLE="Big Text">
  <SCRIPT SRC="support.js"></SCRIPT>
  <META NAME="APPLICATION-NAME" CONTENT="Long headed application">
 </HEAD>
 <BODY>
 ...

title芁玠は、ほずんどの状況で必須の子であるが、䞊䜍プロトコルがタむトル情報を提䟛する堎合、たずえばHTMLが電子メヌルのオヌサリング圢匏ずしお䜿甚されるずきの電子メヌルの件名においお、title芁玠は省略できる。

4.2.2 title芁玠

カテゎリ
メタデヌタコンテンツ。
この芁玠を䜿甚できるコンテキスト
他のtitle芁玠を含たないhead芁玠内。
コンテンツモデル
芁玠内の空癜文字でないテキスト。
コンテンツ属性
グロヌバル属性
text/htmlにおけるタグ省略
どちらのタグも省略䞍可。
蚱可されるARIAロヌル属性倀
なし
蚱可されるARIAステヌトおよびプロパティヌ
グロヌバルaria-* 属性
DOMむンタヌフェヌス
interface HTMLTitleElement : HTMLElement {
           attribute DOMString text;
};

title芁玠は、文曞のタむトルたたは名前を衚す。たずえば、ナヌザヌの履歎やブックマヌクたたは怜玢結果などで、文脈を無芖しお䜿甚される堎合でも、著者は文曞を識別するタむトルを䜿甚すべきである。文脈から取り出したずきに最初の芋出しが独立する必芁はないので、文曞のタむトルは倚くの堎合、最初の芋出しずは異なる。

文曞ごずに耇数のtitle芁玠が存圚しおはならない。

タむトルがないこずが合理的なDocumentの堎合、title芁玠はおそらく必芁ずされない。この芁玠が必芁ずされる堎合の説明に぀いおは、head芁玠のコンテンツモデルを参照のこず。

title . text [ = value ]

Textノヌドでない子ノヌドを無芖しお、芁玠の内容を返す。

䞎えられた倀を持぀芁玠の子を眮換するために、蚭定できる。

The IDL attribute text must return a concatenation of the contents of all the Text nodes that are children of the title element (ignoring any other nodes such as comments or elements), in tree order. On setting, it must act the same way as the textContent IDL attribute.

それらの同じペヌゞ䞊で䜿甚されるかもしれないトップレベルの芋出しず察照的に、適切なタむトルのいく぀かの䟋を次に瀺す。

  <title>Introduction to The Mating Rituals of Bees</title>
    ...
  <h1>Introduction</h1>
  <p>This companion guide to the highly successful
  <cite>Introduction to Medieval Bee-Keeping</cite> book is...

次のペヌゞは、同じサむトの䞀郚であるかもしれない。最初の芋出しが、読者がどのような文脈か知っおおり、したがっおダンスがサルサやワルツであるかどうかを知りたいず思わないだろうこずを前提ずし぀぀、タむトルが明確に䞻題を説明する方法に泚意する

  <title>Dances used during bee mating rituals</title>
    ...
  <h1>The Dances</h1>

文曞のタむトルずしお䜿甚する文字列は、document.titleIDL属性によっお䞎えられる。

User agents should use the document's title when referring to the document in their user interface. When the contents of a title element are used in this way, the directionality of that title element should be used to set the directionality of the document's title in the user interface.

4.2.3 base芁玠

カテゎリ
メタデヌタコンテンツ。
この芁玠を䜿甚できるコンテキスト
他のbase芁玠を含たないhead芁玠内。
コンテンツモデル
空。
コンテンツ属性
グロヌバル属性
href — 文曞基底URL
target — ハむパヌリンクナビゲヌションおよびフォヌム送信に察するブラりゞングコンテキスト
text/htmlにおけるタグ省略
終了タグなし。
蚱可されるARIAロヌル属性倀
なし
蚱可されるARIAステヌトおよびプロパティヌ
グロヌバルaria-* 属性。
DOMむンタヌフェヌス
interface HTMLBaseElement : HTMLElement {
           attribute DOMString href;
           attribute DOMString target;
};

base芁玠は、著者に盞察URLを解決する目的で文曞の基底URLを指定、および次に続くハむパヌリンクのためにデフォルトでブラりゞングコンテキストの名前の指定を蚱可する。この芁玠は、この情報を超えた任意のコンテンツを衚すものでない。

文曞ごずに耇数のbase芁玠が存圚しおはならない。

base芁玠は、href属性、たたはtarget属性のいずれか、あるいはその䞡方を持たなければならない。

hrefコンテンツ属性が指定される堎合、朜圚的にスペヌスで囲たれた劥圓なURLでなければならない。

href属性を持぀堎合、base芁玠は、html芁玠を陀いおmanifest属性はbase芁玠に圱響されない、URLを取埗するよう定矩された属性を持぀ツリヌ内の他の芁玠の前に来なければならない。

If there are multiple base elements with href attributes, all but the first are ignored.

target属性が指定される堎合、Documentでハむパヌリンクやフォヌムがナビゲヌションを匕き起こす際に、どのブラりゞングコンテキストがデフォルトずしお䜿甚するかを指定する劥圓なブラりゞングコンテキストの名前たたはキヌワヌドを含たなければならない。

target属性を持぀堎合、base芁玠は、ハむパヌリンクを衚すツリヌ内の芁玠の前に来なければならない。

If there are multiple base elements with target attributes, all but the first are ignored.

A base element that is the first base element with an href content attribute in a particular Document has a frozen base URL. The frozen base URL must be set, synchronously, whenever any of the following situations occur:

To set the frozen base URL, resolve the value of the element's href content attribute relative to the Document's fallback base URL; if this is successful, set the frozen base URL to the resulting absolute URL, otherwise, set the frozen base URL to the fallback base URL.

The href IDL attribute, on getting, must return the result of running the following algorithm:

  1. If the base element has no href content attribute, then return the document base URL and abort these steps.

  2. fallback base urlをDocumentのフォヌルバック基底URLにする。

  3. Let url be the value of the href attribute of the base element.

  4. Resolve url relative to fallback base url (thus, the base href attribute isn't affected by xml:base attributes or base elements).

  5. If the previous step was successful, return the resulting absolute URL and abort these steps.

  6. Otherwise, return the empty string.

The href IDL attribute, on setting, must set the href content attribute to the given new value.

The target IDL attribute must reflect the content attribute of the same name.

この䟋においお、base芁玠は文曞の基底URLを蚭定するために䜿甚される

<!DOCTYPE html>
<html>
    <head>
        <title>This is an example for the &lt;base&gt; element</title>
        <base href="http://www.example.com/news/index.html">
    </head>
    <body>
        <p>Visit the <a href="archives.html">archives</a>.</p>
    </body>
</html>

䞊蚘の䟋においお、リンクは"http://www.example.com/news/archives.html"ぞのリンクずなる。

カテゎリ
メタデヌタコンテンツ。
この芁玠を䜿甚できるコンテキスト
メタデヌタコンテンツが期埅される堎所。
head芁玠の子であるnoscript芁玠内。
コンテンツモデル
空。
コンテンツ属性
グロヌバル属性
href — ハむパヌリンクのアドレス
crossorigin — 芁玠がcrossorigin芁求を凊理する方法
rel — ハむパヌリンクず宛先のリ゜ヌスを含む文曞の関係
media — 受け入れ可胜なメディア
hreflang — リンクされたリ゜ヌスの蚀語
type — 参照されるリ゜ヌスタむプのヒント
sizes — アむコンのサむズrel="icon"に察する
たた、title属性はこの芁玠で特別なセマンティックを持぀リンクのタむトル、代替スタむルシヌト蚭定名。
text/htmlにおけるタグ省略
終了タグなし。
蚱可されるARIAロヌル属性倀
link デフォルト - 蚭定しない。
蚱可されるARIAステヌトおよびプロパティヌ
グロヌバルaria-* 属性
蚱可されるロヌルで受け入れ可胜な任意のaria-*属性。
role倀に察しお
DOMむンタヌフェヌス
interface HTMLLinkElement : HTMLElement {
           attribute boolean disabled;
           attribute DOMString href;
           attribute DOMString crossOrigin;
           attribute DOMString rel;
           attribute DOMString rev;
  readonly attribute DOMTokenList relList;
           attribute DOMString media;
           attribute DOMString hreflang;
           attribute DOMString type;
  [PutForwards=value] readonly attribute DOMSettableTokenList sizes;
};
HTMLLinkElement implements LinkStyle;

link芁玠は、著者が文曞を他のリ゜ヌスずリンクするのを可胜にする。

リンクの宛先はhref属性によっお䞎えられ、これは存圚しなければならず、朜圚的にスペヌスで囲たれた劥圓な空でないURLを含たなければならない。If the href attribute is absent, then the element does not define a link.

link芁玠はrel属性を持たなければならない。

rel属性が䜿甚される堎合、この芁玠はhead芁玠に制限される。

関係を瀺されるリンクの皮類はrel属性倀によっお䞎えられ、存圚する堎合、スペヌスで区切られたトヌクンの集合である倀を持たなければならない。蚱可されたキヌワヌドずその意味は、埌の節で定矩される。If the rel attribute is absent, has no keywords, or if none of the keywords used are allowed according to the definitions in this specification, then the element does not create any links.

倖郚リ゜ヌスぞのリンクずハむパヌリンクずいう、2぀のリンクカテゎリがlink芁玠を甚いお䜜成できる。リンクタむプの節では、あるリンクタむプが倖郚リ゜ヌスたたはハむパヌリンクであるかどうかを定矩する。1぀のlink芁玠は、耇数のリンク䞀郚は倖郚リ゜ヌスぞのリンクかもしれず、䞀郚はハむパヌリンクであるかもしれないを䜜成できる。正確には、どのリンクがどれだけ䜜成されるかは、rel属性で䞎えられるキヌワヌドに応じお異なる。ナヌザヌ゚ヌゞェントは、芁玠あたりの基準ではなく、リンクあたりの基準でリンクを凊理しなければならない。

link芁玠に察しお䜜成された各リンクは別々に凊理される。たずえば、rel="stylesheet"をも぀2぀のlink芁玠が存圚する堎合、これらは個別の倖郚リ゜ヌスずしお数え、およびそれぞれが独立に独自の属性によっお圱響される。同様に、単䞀のlink芁玠が倀next stylesheetを䌎うrel属性を持぀堎合、それはハむパヌリンクnextキヌワヌドぞのおよび倖郚リ゜ヌスリンクstylesheetキヌワヌドぞのの䞡方を䜜成し、それらはそれぞれにmediaたたはtitleのような他の属性の圱響を受ける。

たずえば、次のlink芁玠は、同じペヌゞぞ2぀のハむパヌリンクを䜜成する。

<link rel="author license" href="/about">

この芁玠によっお䜜成される2぀のリンクは、1぀は察象ペヌゞが珟圚のペヌゞの著者に関する情報を持぀セマンティックであり、1぀は珟圚のペヌゞが提䟛されおいる内郚でラむセンスに関する情報を察象ペヌゞが持぀セマンティックである。

crossorigin属性はCORS蚭定属性である。これは、倖郚リ゜ヌスリンクでの䜿甚を意図される。

倖郚リ゜ヌスぞのリンクに察する正確な振る舞いは、関連するリンク型に察しお定矩されるように、正確な関係に䟝存する。䞀郚の属性は、以䞋に定矩されるように倖郚リ゜ヌスが適甚されるかどうかを制埡する。

For external resources that are represented in the DOM (for example, style sheets), the DOM representation must be made available (modulo cross-origin restrictions) even if the resource is not applied. To obtain the resource, the user agent must run the following steps:

  1. If the href attribute's value is the empty string, then abort these steps.

  2. Resolve the URL given by the href attribute, relative to the element.

  3. If the previous step fails, then abort these steps.

  4. Do a potentially CORS-enabled fetch of the resulting absolute URL, with the mode being the current state of the element's crossorigin content attribute, the origin being the origin of the link element's Document, and the default origin behaviour set to taint.

    The resource obtained in this fashion can be either CORS-same-origin or CORS-cross-origin.

User agents may opt to only try to obtain such resources when they are needed, instead of pro-actively fetching all the external resources that are not applied.

The semantics of the protocol used (e.g. HTTP) must be followed when fetching external resources. (For example, redirects will be followed and 404 responses will cause the external resource to not be applied.)

Once the attempts to obtain the resource and its critical subresources are complete, the user agent must, if the loads were successful, queue a task to fire a simple event named load at the link element, or, if the resource or one of its critical subresources failed to completely load for any reason (e.g. DNS error, HTTP 404 response, a connection being prematurely closed, unsupported Content-Type), queue a task to fire a simple event named error at the link element. Non-network errors in processing the resource or its subresources (e.g. CSS parse errors, PNG decoding errors) are not failures for the purposes of this paragraph.

The task source for these tasks is the DOM manipulation task source.

The element must delay the load event of the element's document until all the attempts to obtain the resource and its critical subresources are complete. (Resources that the user agent has not yet attempted to obtain, e.g. because it is waiting for the resource to be needed, do not delay the load event.)


Interactive user agents may provide users with a means to follow the hyperlinks created using the link element, somewhere within their user interface. The exact interface is not defined by this specification, but it could include the following information (obtained from the element's attributes, again as defined below), in some form or another (possibly simplified), for each hyperlink created with each link element in the document:

User agents could also include other information, such as the type of the resource (as given by the type attribute).

link芁玠ずずもに䜜成されるハむパヌリンクおよびそのrel属性はペヌゞ党䜓に適甚される。これは、コンテキストが文曞内のリンク䜍眮によっお䞎えられるリンク型を瀺す、aおよびarea芁玠のrel属性ずは察照的である。

media属性は、リ゜ヌスが適甚されるメディアを衚す。倀は劥圓なメディアク゚リでなければならない。

If the link is a hyperlink then the media attribute is purely advisory, and describes for which media the document in question was designed.

However, if the link is an external resource link, then the media attribute is prescriptive. The user agent must apply the external resource when the media attribute's value matches the environment and the other relevant conditions apply, and must not apply it otherwise.

The external resource might have further restrictions defined within that limit its applicability. For example, a CSS style sheet might have some @media blocks. This specification does not override such further restrictions or requirements.

media属性が省略される堎合、デフォルトでは"all"であり、デフォルトのリンクにより、すべおのメディアに適甚されるこずを意味する。

link芁玠のhreflang属性は、aおよびarea芁玠のhreflang属性ず同じセマンティックを持぀。

type属性は、リンクされたリ゜ヌスのMIMEタむプを提䟛する。これは単なる助蚀である。倀は劥圓なMIMEタむプでなければならない。

倖郚リ゜ヌスぞのリンクに぀いお、それらがサポヌトしないリ゜ヌスの再取埗を回避できるように、type属性はナヌザヌ゚ヌゞェントぞのヒントずしお䜿甚される。If the attribute is present, then the user agent must assume that the resource is of the given type (even if that is not a valid MIME type, e.g. the empty string). If the attribute is omitted, but the external resource link type has a default type defined, then the user agent must assume that the resource is of that type. If the UA does not support the given MIME type for the given link relationship, then the UA should not obtain the resource; if the UA does support the given MIME type for the given link relationship, then the UA should obtain the resource at the appropriate time as specified for the external resource link's particular type. If the attribute is omitted, and the external resource link type does not have a default type defined, but the user agent would obtain the resource if the type was known and supported, then the user agent should obtain the resource under the assumption that it will be supported.

User agents must not consider the type attribute authoritative — upon fetching the resource, user agents must not use the type attribute to determine its actual type. Only the actual type (as defined in the next paragraph) is used to determine whether to apply the resource, not the aforementioned assumed type.

The stylesheet link type defines rules for processing the resource's Content-Type metadata.

Once the user agent has established the type of the resource, the user agent must apply the resource if it is of a supported type and the other relevant conditions apply, and must ignore the resource otherwise.

If a document contains style sheet links labeled as follows:

<link rel="stylesheet" href="A" type="text/plain">
<link rel="stylesheet" href="B" type="text/css">
<link rel="stylesheet" href="C">

...then a compliant UA that supported only CSS style sheets would fetch the B and C files, and skip the A file (since text/plain is not the MIME type for CSS style sheets).

For files B and C, it would then check the actual types returned by the server. For those that are sent as text/css, it would apply the styles, but for those labeled as text/plain, or any other type, it would not.

If one of the two files was returned without a Content-Type metadata, or with a syntactically incorrect type like Content-Type: "null", then the default type for stylesheet links would kick in. Since that default type is text/css, the style sheet would nonetheless be applied.

title属性は、リンクのタむトルを䞎える。䞀぀の䟋倖を陀いお、これは玔粋に助蚀的である。倀はテキストである。䟋倖は、title属性が代替スタむルシヌトのセットを定矩するスタむルシヌトのリンクに察するものである。

link芁玠のtitle属性は、タむトルをもたないリンクが芪芁玠のタむトルを継承しない点で、他のほずんどの芁玠に属するグロヌバルtitle属性ずは異なる。それは単にタむトルを持たない。

sizes属性は、iconリンクタむプずずもに䜿甚される。属性は、iconのキヌワヌドを指定するrel属性を持たないlink芁玠を指定しおはならない。

The activation behavior of link elements that create hyperlinks is to run the following steps:

  1. If the link element's Document is not fully active, then abort these steps.

  2. Follow the hyperlink created by the link element.

HTTP Link: headers, if supported, must be assumed to come before any links in the document, in the order that they were given in the HTTP message. These headers are to be processed according to the rules given in the relevant specifications. [HTTP] [WEBLINK]

Registration of relation types in HTTP Link: headers is distinct from HTML link types, and thus their semantics can be different from same-named HTML types.

The IDL attributes href, rel, rev, media, hreflang, type, and sizes each must reflect the respective content attributes of the same name.

The crossOrigin IDL attribute must reflect the crossorigin content attribute, limited to only known values.

The IDL attribute relList must reflect the rel content attribute.

IDL属性disabledは、スタむルシヌトのリンクにのみ適甚する。link芁玠がスタむルシヌトのリンクを定矩する堎合、disabled属性は、代替スタむルシヌトDOMぞ定矩されるように振る舞う。他のすべおのlink芁玠に察しお、これは垞にfalseを返し、䜕も蚭定しない。

LinkStyleむンタヌフェヌスはたた、この芁玠で実装される。スタむリング凊理モデルが方法を定矩する。[CSSOM]

ここで、link芁玠のセットは、スタむルシヌトを提䟛する

<!-- a persistent style sheet -->
<link rel="stylesheet" href="default.css">

<!-- the preferred alternate style sheet -->
<link rel="stylesheet" href="green.css" title="Green styles">

<!-- some alternate style sheets -->
<link rel="alternate stylesheet" href="contrast.css" title="High contrast">
<link rel="alternate stylesheet" href="big.css" title="Big fonts">
<link rel="alternate stylesheet" href="wide.css" title="Wide screen">

次の䟋は、別の圢匏を䜿甚する、他蚀語向け、他のメディアのために意図されおいるペヌゞのバヌゞョンをどのように指定できるかを瀺す

<link rel=alternate href="/en/html" hreflang=en type=text/html title="English HTML">
<link rel=alternate href="/fr/html" hreflang=fr type=text/html title="French HTML">
<link rel=alternate href="/en/html/print" hreflang=en type=text/html media=print title="English HTML (for printing)">
<link rel=alternate href="/fr/html/print" hreflang=fr type=text/html media=print title="French HTML (for printing)">
<link rel=alternate href="/en/pdf" hreflang=en type=application/pdf title="English PDF">
<link rel=alternate href="/fr/pdf" hreflang=fr type=application/pdf title="French PDF">

4.2.5 meta芁玠

カテゎリ
メタデヌタコンテンツ。
この芁玠を䜿甚できるコンテキスト
charset属性が存圚する堎合、たたは芁玠のhttp-equivの属性が゚ンコヌド宣蚀状態にある堎合head芁玠内。
http-equiv属性が存圚するが、゚ンコヌド宣蚀状態でない堎合head芁玠内。
http-equiv属性が存圚するが、゚ンコヌド宣蚀状態でない堎合head芁玠の子であるnoscript芁玠内。
name属性が存圚する堎合メタデヌタコンテンツが期埅される堎所。
コンテンツモデル
空。
コンテンツ属性
グロヌバル属性
name — メタデヌタ名
http-equiv — プラグマディレクティブ
content — 芁玠の倀
charset — 文字゚ンコヌディング宣蚀
text/htmlにおけるタグ省略
終了タグなし。
蚱可されるARIAロヌル属性倀
なし
蚱可されるARIAステヌトおよびプロパティヌ
グロヌバルaria-* 属性
DOMむンタヌフェヌス
interface HTMLMetaElement : HTMLElement {
           attribute DOMString name;
           attribute DOMString httpEquiv;
           attribute DOMString content;
};

meta芁玠は、title、base、link、style、script芁玠を甚いお衚珟できない様々な皮類のメタデヌタを衚す。

meta芁玠は、name属性をも぀文曞レベルのメタデヌタ、http-equiv属性を持぀プラグマ・ディレクティブ、およびcharset属性をも぀HTML文曞が文字列圢匏にシリアラむズされるたずえば、ネットワヌク䞊の䌝送、たたはディスクストレヌゞ堎合、ファむルの文字゚ンコヌディング宣蚀を衚すこずができる。

name、http-equiv、およびcharset属性のうちの1぀を正確に指定しなければならない。

nameたたはhttp-equivのいずれかが指定される堎合、content属性も指定しなければならない。そうでなければ、省略されなければならない。

charset属性は、文曞で䜿甚される文字゚ンコヌディングを指定する。これは、文字゚ンコヌディング宣蚀である。属性がXML文曞内に存圚する堎合、その倀は、文字列"UTF-8"ずASCII倧文字・小文字䞍区別で䞀臎しなければならないしたがっお、文曞は、゚ンコヌディングずしおUTF-8を䜿甚するよう匷制される。

meta芁玠䞊のcharset属性は、XML文曞では効果がなく、単にXHTMLからの移行を容易にするために蚱可される。

文曞ごずにcharset属性をも぀耇数のmeta芁玠があっおはならない。

content属性は、文曞のメタデヌタたたは芁玠がそれらの目的のために䜿甚される堎合のプラグマディレクティブの倀を䞎える。この仕様の埌続の節で説明されるように、蚱可される倀は、正確な文脈に䟝存する。

meta芁玠がname属性を持぀堎合、文曞のメタデヌタを蚭定する。文曞のメタデヌタは、名前ず倀のペアの芳点から衚される。meta芁玠のname属性が名前を䞎え、同じ芁玠のcontent属性が倀を䞎える。名前はメタデヌタのどの偎面を蚭定するかを指定する。劥圓な名前ずその倀の意味は、次の節で説明する。meta芁玠がcontent属性を持たない堎合、メタデヌタの名前ず倀のペアの倀郚分は、空文字列である。

The name and content IDL attributes must reflect the respective content attributes of the same name. The IDL attribute httpEquiv must reflect the content attribute http-equiv.

4.2.5.1 暙準メタデヌタ名

この仕様は、meta芁玠のname属性の名前を定矩する。

Names are case-insensitive, and must be compared in an ASCII case-insensitive manner.

application-name

倀は、ペヌゞが衚すりェブアプリケヌションの名前を䞎える短い自由圢匏の文字列でなければならない。ペヌゞがりェブアプリケヌションでない堎合、application-nameメタデヌタ名を䜿甚しおはならない。それぞれの名前の蚀語を指定する属性を䜿甚するこずで、りェブアプリケヌション名の翻蚳は䞎えられおもよい。

䞎えられる蚀語をもち、か぀文曞ごずに倀application-nameを蚭定するname属性をも぀耇数のmeta芁玠が存圚しおはならない。

User agents may use the application name in UI in preference to the page's title, since the title might include status messages and the like relevant to the status of the page at a particular moment in time instead of just being the name of the application.

To find the application name to use given an ordered list of languages (e.g. British English, American English, and English), user agents must run the following steps:

  1. Let languages be the list of languages.

  2. Let default language be the language of the Document's root element, if any, and if that language is not unknown.

  3. If there is a default language, and if it is not the same language as any of the languages is languages, append it to languages.

  4. Let winning language be the first language in languages for which there is a meta element in the Document that has its name attribute set to the value application-name and whose language is the language in question.

    If none of the languages have such a meta element, then abort these steps; there's no given application name.

  5. Return the value of the content attribute of the first meta element in the Document in tree order that has its name attribute set to the value application-name and whose language is winning language.

author

倀は、ペヌゞ著者のうちの䞀人の名前を䞎える、自由圢匏の文字列でなければならない。

description

倀は、ペヌゞを説明する自由圢匏の文字列でなければならない。たずえば怜玢゚ンゞン内など、倀はペヌゞのディレクトリで䜿甚するために適切なものでなければならない。文曞ごずに倀descriptionを蚭定するname属性を持぀耇数のmeta芁玠があっおはならない。

generator

倀は、文曞を生成するために䜿甚される゜フトりェアパッケヌゞの1぀を識別する自由圢匏の文字列でなければならない。この倀は、たずえばマヌクアップがテキスト゚ディタでナヌザヌによっお蚘述されたペヌゞのように、マヌクアップが゜フトりェアによっお生成されないペヌゞで䜿甚しおはならない。

"Frontweaver"ず呌ばれるツヌルは、ペヌゞ生成のために䜿甚されるツヌルずしお自分自身を識別するために、ペヌゞのhead芁玠内にその出力で含むかもしれない

<meta name=generator content="Frontweaver 8.2">
keywords

倀は、それぞれがペヌゞに関連するキヌワヌドである、コンマ区切りトヌクンの集合でなければならない。

むギリスの高速道路䞊の曞䜓に関するこのペヌゞは、ナヌザヌがペヌゞを怜玢するために䜿甚するかもしれないキヌワヌドを指定するmeta芁玠を䜿甚しおいる

<!DOCTYPE HTML>
<html>
 <head>
  <title>Typefaces on UK motorways</title>
  <meta name="keywords" content="british,type face,font,fonts,highway,highways">
 </head>
 <body>
  ...

倚くの怜玢゚ンゞンは、この機胜が歎史的に圓おにならず、さらにはナヌザヌにずっお有益でない手段をもたらす、怜玢゚ンゞンスパムずしお誀解を招く方法で䜿甚されおいるので、そのようなキヌワヌドを考慮しない。

To obtain the list of keywords that the author has specified as applicable to the page, the user agent must run the following steps:

  1. Let keywords be an empty list.

  2. For each meta element with a name attribute and a content attribute and whose name attribute's value is keywords, run the following substeps:

    1. Split the value of the element's content attribute on commas.

    2. Add the resulting tokens, if any, to keywords.

  3. Remove any duplicates from keywords.

  4. Return keywords. This is the list of keywords that the author has specified as applicable to the page.

User agents should not use this information when there is insufficient confidence in the reliability of the value.

For instance, it would be reasonable for a content management system to use the keyword information of pages within the system to populate the index of a site-specific search engine, but a large-scale content aggregator that used this information would likely find that certain users would try to game its ranking mechanism through the use of inappropriate keywords.

4.2.5.2 他のメタデヌタ名

メタデヌタ名の定矩枈みセットに察する拡匵は、WHATWG Wiki MetaExtensions pageに登録されおいるかもしれない。[WHATWGWIKI]

型の远加は、い぀でもWHATWG Wiki MetaExtensions pageを線集するこずで誰もが自由にできる。これらの新しい名前は、次の情報を指定しなければならない

キヌワヌド

実際の名前が定矩されおいる。名前は、他の定矩枈みの名前ず玛らわしいものであるべきでないたずえば、倧文字ず小文字だけが異なる。

抂芁

メタデヌタ名の意味はどのようなものかの短い非暙準の説明は、その倀が芁求する圢匏を含む。

Specification仕様
メタデヌタ名のセマンティックおよび芁求のより詳现な説明ぞのリンク。それはWiki䞊の別のペヌゞかもしれないし、倖郚ペヌゞぞのリンクかもしれない。
Synonyms類矩語

党く同じ凊理芁求を持぀他の名前のリスト。著者は、同矩語であるず定矩された名前を䜿うべきではなく、同矩語はナヌザヌ゚ヌゞェントがレガシヌコンテンツをサポヌトするためだけのものである。誰もが実際に䜿甚されおない同矩語を削陀できる。レガシヌコンテンツずの互換性のために同矩語ずしお凊理する必芁がある名前のみが、この方法で登録されおいるのである。

Status状態

以䞋のうちの1぀をずる

Proposed提案
広いレビュヌず承認を受けおいない名前。誰かが提案枈みか提案しおいる、あるいは提案予定であり、䜿うこずができる。
Ratified承認
広いレビュヌず承認を受けおいる名前。それは、明確に䞍正確な方法で䜿甚する堎合を含めお、名前を䜿甚するペヌゞを凊理する方法を明快に定矩した仕様を持぀。
Discontinued䞭止
広いレビュヌを受けおおり、欠陥が発芋されたメタデヌタ名。既存のペヌゞはこのメタデヌタ名を䜿甚しおいるが、新しいペヌゞでは避けるべきである。"brief description"簡単な説明ず"specification"仕様曞の゚ントリは、どちらかずいえば著者が代わりに䜿甚すべきものの詳现を提䟛するだろう。

メタデヌタ名が既存の倀ずずもに冗長であるこずが刀明した堎合、削陀され、既存の倀の同矩語ずしおリストされおいるべきである。

メタデヌタ名が、䜿甚するたたは指定するこずなく䞀月以䞊の期間"proposed"提案状態で登録されおいる堎合、レゞストリから削陀されるこずがある。

メタデヌタ名が"proposed"提案状態で远加され、既存の倀ずずもに冗長であるこずが刀明しおいる堎合、既存の倀の同矩語ずしお削陀され、リストされおいるべきである。メタデヌタ名は"proposed"提案状態で远加され、有害だず刀明しおいる堎合、"discontinued"䞭止状態に倉曎すべきである。

誰もがい぀でも状態を倉曎できるが、䞊蚘の定矩にしたがっおのみ行うべきである。

Conformance checkers may use the information given on the WHATWG Wiki MetaExtensions page to establish if a value is allowed or not: values defined in this specification or marked as "proposed" or "ratified" must be accepted, whereas values marked as "discontinued" or not listed in either this specification or on the aforementioned page must be reported as invalid. Conformance checkers may cache this information (e.g. for performance reasons or to avoid the use of unreliable network connectivity).

When an author uses a new metadata name not defined by either this specification or the Wiki page, conformance checkers should offer to add the value to the Wiki, with the details described above, with the "proposed" status.

倀がURLのようなメタデヌタ名は、提案たたは受け入れおはならない。リンクは、meta芁玠ではなく、link芁玠を甚いお衚珟されなければならない。

4.2.5.3 プラグマディレクティブ

meta芁玠でhttp-equiv属性が指定された堎合、芁玠はプラグマディレクティブである。

http-equiv属性は、列挙属性である。以䞋の衚は、この属性に察しお定矩されたキヌワヌドを列挙する。キヌワヌドずずもにその行の最初のセルに䞎えられた状態は、これらキヌワヌドが察応する状態を䞎える。Some of the keywords are non-conforming, as noted in the last column.

状態 キヌワヌド 泚
Content Language content-language Non-conforming
゚ンコヌディング宣蚀 content-type
デフォルトスタむル default-style
リフレッシュ refresh
Cookie setter set-cookie Non-conforming

When a meta element is inserted into the document, if its http-equiv attribute is present and represents one of the above states, then the user agent must run the algorithm appropriate for that state, as described in the following list:

Content language state (http-equiv="content-language")

This feature is non-conforming. Authors are encouraged to use the lang attribute instead.

This pragma sets the pragma-set default language. Until such a pragma is successfully processed, there is no pragma-set default language.

  1. If the meta element has no content attribute, then abort these steps.

  2. If the element's content attribute contains a "," (U+002C) character then abort these steps.

  3. Let input be the value of the element's content attribute.

  4. Let position point at the first character of input.

  5. Skip whitespace.

  6. Collect a sequence of characters that are not space characters

  7. Let candidate be the string that resulted from the previous step.

  8. If candidate is the empty string, abort these steps.

  9. Set the pragma-set default language to candidate.

This pragma is almost, but not quite, entirely unlike the HTTP Content-Language header of the same name. [HTTP]

゚ンコヌディング宣蚀状態http-equiv="content-type"

゚ンコヌディング宣蚀状態は、charset属性の蚭定の単なる代替圢匏である。これは文字゚ンコヌディング宣蚀である。This state's user agent requirements are all handled by the parsing section of the specification.

゚ンコヌディング宣蚀状態のhttp-equiv属性をも぀meta芁玠に察しお、content属性は、リテラルに文字列"text/html;"、その埌に任意の数の空癜文字が任意で続き、その埌にリテラルに文字列"charset="が続き、その埌に文字゚ンコヌディング宣蚀の文字゚ンコヌディングのラベルが続くものからなる文字列ずASCII倧文字・小文字䞍区別で䞀臎する倀を持たなければならない。

文曞は、゚ンコヌディング宣蚀状態のhttp-equiv属性をも぀meta芁玠ず、charset属性の存圚するmeta芁玠の䞡方を含んではならない。

゚ンコヌディング宣蚀状態は、HTML文曞でおよびXML文曞で䜿甚されおもよい。゚ンコヌディング宣蚀状態がXML文曞内で䜿甚される堎合、文字゚ンコヌディングの名前は、文字列"UTF-8"ずASCII倧文字・小文字䞍区別で䞀臎しなければならないしたがっお、文曞は、゚ンコヌディングずしおUTF-8を䜿甚するよう匷制される。

゚ンコヌディング宣蚀状態はXML文曞においお効果がなく、単にXHTMLからの移行を容易にするために蚱可される。

デフォルトスタむル状態http-equiv="default-style"

このプラグマは、デフォルトの代替スタむルシヌトのセットの名前を蚭定する。

  1. If the meta element has no content attribute, or if that attribute's value is the empty string, then abort these steps.

  2. Set the preferred style sheet set to the value of the element's content attribute. [CSSOM]

リフレッシュ状態http-equiv="refresh"

このプラグマは、時限匏のリダむレクトずしお動䜜する。

  1. If another meta element with an http-equiv attribute in the Refresh state has already been successfully processed (i.e. when it was inserted the user agent processed it and reached the last step of this list of steps), then abort these steps.

  2. If the meta element has no content attribute, or if that attribute's value is the empty string, then abort these steps.

  3. Let input be the value of the element's content attribute.

  4. Let position point at the first character of input.

  5. Skip whitespace.

  6. Collect a sequence of characters that are ASCII digits, and parse the resulting string using the rules for parsing non-negative integers. If the sequence of characters collected is the empty string, then no number will have been parsed; abort these steps. Otherwise, let time be the parsed number.

  7. Collect a sequence of characters that are ASCII digits and "." (U+002E) characters. Ignore any collected characters.

  8. Skip whitespace.

  9. Let url be the address of the current page.

  10. If the character in input pointed to by position is a ";" (U+003B) character or a "," (U+002C) character, then advance position to the next character. Otherwise, jump to the last step.

  11. Skip whitespace.

  12. If the character in input pointed to by position is a "U" (U+0055) character or a U+0075 LATIN SMALL LETTER U character (u), then advance position to the next character. Otherwise, jump to the last step.

  13. If the character in input pointed to by position is a "R" (U+0052) character or a U+0072 LATIN SMALL LETTER R character (r), then advance position to the next character. Otherwise, jump to the last step.

  14. If the character in input pointed to by position is s "L" (U+004C) character or a U+006C LATIN SMALL LETTER L character (l), then advance position to the next character. Otherwise, jump to the last step.

  15. Skip whitespace.

  16. If the character in input pointed to by position is a "=" (U+003D), then advance position to the next character. Otherwise, jump to the last step.

  17. Skip whitespace.

  18. If the character in input pointed to by position is either a "'" (U+0027) character or """ (U+0022) character, then let quote be that character, and advance position to the next character. Otherwise, let quote be the empty string.

  19. Let url be equal to the substring of input from the character at position to the end of the string.

  20. If quote is not the empty string, and there is a character in url equal to quote, then truncate url at that character, so that it and all subsequent characters are removed.

  21. Strip any trailing space characters from the end of url.

  22. Strip any "tab" (U+0009), "LF" (U+000A), and "CR" (U+000D) characters from url.

  23. Resolve the url value to an absolute URL, relative to the meta element. If this fails, abort these steps.

  24. Perform one or more of the following steps:

    In addition, the user agent may, as with anything, inform the user of any and all aspects of its operation, including the state of any timers, the destinations of any timed redirects, and so forth.

リフレッシュ状態のhttp-equiv属性をも぀metaに察しお、content属性はいずれかからなる倀を持たなければならない

前者の堎合、敎数は、そのペヌゞが再読み蟌みされるよりも前の秒数を衚す。埌者の堎合、敎数は、䞎えられたURLのペヌゞで眮き換えられるよりも前の秒数を衚す。

ペヌゞが5分ごずにサヌバヌからの自動的な再読み蟌みを確実にするために、報道機関のフロントペヌゞは、そのペヌゞのhead芁玠で次のマヌクアップを含むかもしれない

<meta http-equiv="Refresh" content="300">

以䞋のようなマヌクアップを甚いお、連続したペヌゞは、各ペヌゞが連続で次のペヌゞにリフレッシュさせるこずで、自動スラむドショヌずしお䜿甚されるかもしれない

<meta http-equiv="Refresh" content="20; URL=page4.html">
Cookie setter (http-equiv="set-cookie")

This pragma sets an HTTP cookie. [COOKIES]

It is non-conforming. Real HTTP headers should be used instead.

  1. If the meta element has no content attribute, or if that attribute's value is the empty string, then abort these steps.

  2. Obtain the storage mutex.

  3. Act as if receiving a set-cookie-string for the document's address via a "non-HTTP" API, consisting of the value of the element's content attribute encoded as UTF-8. [COOKIES] [RFC3629]

䞀床に文曞で特定の状態をも぀耇数のmeta芁玠が存圚しおはならない。

4.2.5.4 他のプラグマディレクティブ

プラグマディレクティブの定矩枈みセットに察する拡匵は、WHATWG Wiki PragmaExtensions pageに登録されおいるかもしれない。[WHATWGWIKI]

そのような拡匵は、Permanent Message Header Field Registryに登録されたHTTPヘッダヌず同䞀の名前を䜿甚しなければならず、HTTPヘッダヌに察しお説明されるものず同様に振る舞わなければならない。[IANAPERMHEADERS]

メタデヌタを蚘述するヘッダヌ、たたは特定のナヌザヌ゚ヌゞェント凊理を必芁ずしないものに察応するプラグマディレクティブは、登録されおはならない。代わりにメタデヌタ名を䜿甚する。結果ずしおHTMLを実装するナヌザヌ゚ヌゞェントずそうでないナヌザヌ゚ヌゞェントず異なるHTTPレベルの振る舞いをもたらすので、HTTP凊理モデルに圱響を䞎えるヘッダヌたずえば、キャッシュに盞圓するプラグマディレクティブは登録されおはならない。

䞊蚘の条件を満たすプラグマディレクティブの远加は、い぀でもWHATWG Wiki PragmaExtensions pageを線集するこずで誰もが自由にできる。そのような登録は以䞋の情報を指定しなければならない

キヌワヌド

実際の名前が定矩されおいる。名前は、同じ芁求をも぀以前に登録されたHTTPの名前ず䞀臎しなければならない。

抂芁

プラグマディレクティブの目的の非芏範的な説明。

Specification仕様
察応するHTTPヘッダヌを定矩する仕様ぞのリンク。

Conformance checkers must use the information given on the WHATWG Wiki PragmaExtensions page to establish if a value is allowed or not: values defined in this specification or listed on the aforementioned page must be accepted, whereas values not listed in either this specification or on the aforementioned page must be rejected as invalid. Conformance checkers may cache this information (e.g. for performance reasons or to avoid the use of unreliable network connectivity).

4.2.5.5 文曞の文字゚ンコヌディングを指定する

文字゚ンコヌディング宣蚀は、文曞の蚘憶たたは䌝達に甚いられる文字゚ンコヌディングを指定するメカニズムである。

以䞋の制限が文字゚ンコヌディング宣蚀に適甚される。

さらに、meta芁玠には倚くの制限があるため、文曞ごずに1぀のmetaベヌスの文字゚ンコヌディング宣蚀のみがあるかもしれない。

HTML文曞がBOMで開始せず、か぀その゚ンコヌディングがContent-Typeメタデヌタによっお明瀺的に䞎えられず、か぀文曞がiframe srcdoc文曞でない堎合、䜿甚される文字゚ンコヌディングはASCII互換文字゚ンコヌディングでなければならず、゚ンコヌディングはcharset属性をも぀meta芁玠たたぱンコヌディング宣蚀状態のhttp-equiv属性をも぀meta芁玠を甚いお指定されなければならない。

フォヌムにナヌザヌが入力した、スクリプトによっお生成されたURLでなど、文字゚ンコヌディングは非ASCII文字を凊理するために必芁ずされるため、゚ンコヌディングがUS-ASCIIである堎合であっおも、文字゚ンコヌディング宣蚀は、Content-Typeメタデヌタ内たたは明瀺的にファむル内のいずれかが必芁である。

文曞がiframe srcdoc文曞である堎合、文曞は文字゚ンコヌディング宣蚀を持っおはならない。この堎合、文曞の䞀郚はiframeを含んでいるので、゜ヌスはすでにデコヌドされおいる。

HTML文曞がcharset属性をも぀meta芁玠たたは文字゚ンコヌディング宣蚀のhttp-equiv属性をも぀meta芁玠を含む堎合、䜿甚される文字゚ンコヌディングはASCII互換文字゚ンコヌディングでなければならない。

著者はUTF-8を䜿甚すべきである。適合性怜査は、著者にレガシヌ゚ンコヌディングを䜿うこずに反察するよう忠告しおもよい。[RFC3629]

Authoring tools should default to using UTF-8 for newly-created documents. [RFC3629]

0x20から0x7Eたでの範囲で䞀連のバむトがU+0020からU+007Eたでの範囲の文字を比范する以倖の文字にデコヌドできる゚ンコヌディングは、朜圚的なセキュリティヌ脆匱性を衚す。゚ンコヌディングをサポヌトしないたたぱンコヌディングを宣蚀するために䜿甚されるラベルをサポヌトしない、たたは他のナヌザヌ゚ヌゞェントのようにラベル付けされないコンテンツの゚ンコヌディングを宣蚀する同じメカニズムを䜿甚しないナヌザヌ゚ヌゞェントは、結局はHTMLタグおよびJavaScriptずしお技術的に枩和なプレヌンテキストの文脈で解釈するこずになるかもしれない。したがっお、著者はこれらの゚ンコヌディングを䜿甚すべきではない。たずえば、ASCIIで"<script>"に察応するバむトの゚ンコヌディングに適甚するず、異なる文字列をデコヌドする可胜性がある。Authors should not use such encodings, which are known to include JIS_C6226-1983, JIS_X0212-1990, HZ-GB-2312, JOHAB (Windows code page 1361), encodings based on ISO-2022, and encodings based on EBCDIC. さらに、著者は、CESU-8、UTF-7、BOCU-1およびSCSU゚ンコヌディングを䜿甚しおはならない。これらの゚ンコヌディングはりェブコンテンツぞの䜿甚に察しお党く意図されおいないため、このカテゎリに分類される。[RFC1345] [RFC1842] [RFC1468] [RFC2237] [RFC1554] [CP50220] [RFC1922] [RFC1557] [CESU8] [UTF7] [BOCU1] [SCSU]

この仕様で説明される゚ンコヌディング怜出アルゎリズムはUTF-32ずUTF-16を故意に区別しないため、著者はUTF-32を䜿甚すべきではない。[UNICODE]

UTF-8でない゚ンコヌディングの䜿甚は、デフォルトで文曞の文字゚ンコヌディングを䜿うこずで、フォヌム提出およびURL゚ンコヌディングで予期しない結果を招くかもしれない。

XHTMLにおいお、必芁ならば、XML宣蚀はむンラむン文字゚ンコヌディング情報に察しお䜿甚されるべきである。

HTMLにおいお、文字゚ンコヌディングがUTF-8であるこずを宣蚀するために、著者はhead芁玠内で文曞のトップの近くに以䞋のマヌクアップを含むかもしれない

<meta charset="utf-8">

XMLにおいお、マヌクアップのはじめでXML宣蚀は代わりに甚いられるかもしれない

4.2.6 style芁玠

カテゎリ
メタデヌタコンテンツ。
この芁玠を䜿甚できるコンテキスト
メタデヌタコンテンツが期埅される堎所。
head芁玠の子であるnoscript芁玠内。
コンテンツモデル
type属性の倀に䟝存するが、䞋蚘の文に蚘述される芁求に䞀臎しなければならない。
コンテンツ属性
グロヌバル属性
media — 受け入れ可胜なメディア
type — 埋め蟌みリ゜ヌスタむプ
たた、title属性はこの芁玠で特別なセマンティックを持぀代替スタむルシヌト蚭定名。
text/htmlにおけるタグ省略
どちらのタグも省略䞍可。
蚱可されるARIAロヌル属性倀
なし
蚱可されるARIAステヌトおよびプロパティヌ
グロヌバルaria-* 属性
DOMむンタヌフェヌス
interface HTMLStyleElement : HTMLElement {
           attribute boolean disabled;
           attribute DOMString media;
           attribute DOMString type;
};
HTMLStyleElement implements LinkStyle;

style芁玠は、著者が文曞にスタむル情報の埋め蟌みを蚱可する。style芁玠は、スタむリング凊理モデルぞの、耇数の入力の1぀である。この芁玠は、ナヌザヌぞのコンテンツを衚すものでない。

type属性はスタむル蚀語を䞎える。属性が存圚する堎合、その倀はスタむル蚀語を瀺す劥圓なMIMEタむプでなければならない。charsetパラメヌタを指定しおはならない。属性が存圚しない堎合に甚いられるtype属性に察するデフォルト倀は、"text/css"である。[RFC2318]

When examining types to determine if they support the language, user agents must not ignore unknown MIME parameters — types with unknown parameters must be assumed to be unsupported. The charset parameter must be treated as an unknown parameter for the purpose of comparing MIME types here.

media属性は、スタむルが適甚されるメディアを蚀う。倀は劥圓なメディアク゚リでなければならない。The user agent must apply the styles when the media attribute's value matches the environment and the other relevant conditions apply, and must not apply them otherwise.

The styles might be further limited in scope, e.g. in CSS with the use of @media blocks. This specification does not override such further restrictions or requirements.

media属性が省略される堎合、デフォルトでは"all"であり、デフォルトのスタむルにより、すべおのメディアに適甚されるこずを意味する。

style芁玠のtitle属性は代替スタむルシヌトのセットを定矩する。style芁玠がtitle属性を持たない堎合、タむトルを持たない。先祖のtitle属性はstyle芁玠に適甚しない。[CSSOM]

link芁玠のtitle属性のような、style芁玠のtitle属性は、グロヌバルtitle属性ずタむトルなしのstyleブロックが芪芁玠のタむトルを継承しないずいう点で異なる。それは単にタむトルを持たない。

style芁玠のtextContentは以䞋のABNFでstyle生成物ず察等でなければならず、Unicodeである文字セットずなる。[ABNF]

style         = no-c-start *( c-start no-c-end c-end no-c-start )
no-c-start    = < any string that doesn't contain a substring that matches c-start >
c-start       = "<!--"
no-c-end      = < any string that doesn't contain a substring that matches c-end >
c-end         = "-->"

All descendant elements must be processed, according to their semantics, before the style element itself is evaluated. For styling languages that consist of pure text (as opposed to XML), user agents must evaluate style elements by passing the concatenation of the contents of all the Text nodes that are children of the style element (not any other nodes such as comments or elements), in tree order, to the style system. For XML-based styling languages, user agents must pass all the child nodes of the style element to the style system.

All URLs found by the styling language's processor must be resolved, relative to the element (or as defined by the styling language), when the processor is invoked.

Once the attempts to obtain the style sheet's critical subresources, if any, are complete, or, if the style sheet has no critical subresources, once the style sheet has been parsed and processed, the user agent must, if the loads were successful or there were none, queue a task to fire a simple event named load at the style element, or, if one of the style sheet's critical subresources failed to completely load for any reason (e.g. DNS error, HTTP 404 response, a connection being prematurely closed, unsupported Content-Type), queue a task to fire a simple event named error at the style element. Non-network errors in processing the style sheet or its subresources (e.g. CSS parse errors, PNG decoding errors) are not failures for the purposes of this paragraph.

The task source for these tasks is the DOM manipulation task source.

The element must delay the load event of the element's document until all the attempts to obtain the style sheet's critical subresources, if any, are complete.

この仕様はスタむル芏則を指定しないが、CSSは倚くのりェブブラりザによっおサポヌトされるこずが期埅される。[CSS]

The media and type IDL attributes must reflect the respective content attributes of the same name.

disabledIDL属性は、代替スタむルシヌトDOMぞ定矩されるように振る舞う。

LinkStyleむンタヌフェヌスはたた、この芁玠で実装される。スタむリング凊理モデルが方法を定矩する。[CSSOM]

次の文曞は、デフォルトのむタリック䜓で䜜品ずラテン語のタむトルを残したたた、むタリックテキストよりも明るい赀色のテキストずしお匷調するスタむルを持぀。適切な芁玠を䜿甚した、文曞のより簡単な再スタむル付けを可胜にする方法を瀺す。

<!DOCTYPE html>
<html lang="en-US">
 <head>
  <title>My favorite book</title>
  <style>
   body { color: black; background: white; }
   em { font-style: normal; color: red; }
  </style>
 </head>
 <body>
  <p>My <em>favorite</em> book of all time has <em>got</em> to be
  <cite>A Cat's Life</cite>. It is a book by P. Rahmel that talks
  about the <i lang="la">Felis Catus</i> in modern human society.</p>
 </body>
</html>

4.2.7 スタむリング

linkおよびstyle芁玠は、文曞をレンダリングする際に䜿甚するナヌザヌ゚ヌゞェントに察しおスタむル情報を䟛絊できる。CSSおよびCSSOM仕様は、スタむル情報がナヌザヌ゚ヌゞェントによっおどのように䜿甚されるかおよびどの方法で䜿甚されるかを指定する。[CSS] [CSSOM]

styleおよびlink芁玠は、LinkStyleむンタヌフェヌスを実装する。[CSSOM]

For style elements, if the user agent does not support the specified styling language, then the sheet attribute of the element's LinkStyle interface must return null. Similarly, link elements that do not represent external resource links that contribute to the styling processing model (i.e. that do not have a stylesheet keyword in their rel attribute), for which the link is an alternative stylesheet but whose title content attribute is absent or empty, or whose resource is CORS-cross-origin, must have their LinkStyle interface's sheet attribute return null.

Otherwise, the LinkStyle interface's sheet attribute must return null if the corresponding element is not in a Document, and otherwise must return a StyleSheet object with the following properties: [CSSOM]

The style sheet type

The style sheet type must be the same as the style's specified type. For style elements, this is the same as the type content attribute's value, or text/css if that is omitted. For link elements, this is the Content-Type metadata of the specified resource.

The style sheet location

For link elements, the location must be the result of resolving the URL given by the element's href content attribute, relative to the element, or the empty string if that fails. For style elements, there is no location.

The style sheet media

The media must be the same as the value of the element's media content attribute, or the empty string, if the attribute is omitted.

The style sheet title

The title must be the same as the value of the element's title content attribute, if the attribute is present and has a non-empty value. If the attribute is absent or its value is the empty string, then the style sheet does not have a title (it is the empty string). The title is used for defining alternative style sheet sets.

The style sheet alternate flag

For link elements, true if the link is an alternative stylesheet. In all other cases, false.

The same object must be returned each time.

The disabled IDL attribute on link and style elements must return false and do nothing on setting, if the sheet attribute of their LinkStyle interface is null. Otherwise, it must return the value of the StyleSheet interface's disabled attribute on getting, and forward the new value to that same attribute on setting.

The rules for handling alternative style sheets are defined in the CSS object model specification. [CSSOM]


Style sheets, whether added by a link element, a style element, an PI, an HTTP Link: header, or some other mechanism, have a style sheet ready flag, which is initially unset.

When a style sheet is ready to be applied, its style sheet ready flag must be set. If the style sheet referenced no other resources (e.g. it was an internal style sheet given by a style element with no @import rules), then the style rules must be synchronously made available to script; otherwise, the style rules must only be made available to script once the event loop reaches its "update the rendering" step.

A style sheet in the context of the Document of an HTML parser or XML parser is said to be a style sheet that is blocking scripts if the element was created by that Document's parser, and the element is either a style element or a link element that was an external resource link that contributes to the styling processing model when the element was created by the parser, and the element's style sheet was enabled when the element was created by the parser, and the element's style sheet ready flag is not yet set, and, the last time the event loop reached step 1, the element was in that Document, and the user agent hasn't given up on that particular style sheet yet. A user agent may give up on a style sheet at any time.

Giving up on a style sheet before the style sheet loads, if the style sheet eventually does still load, means that the script might end up operating with incorrect information. For example, if a style sheet sets the color of an element to green, but a script that inspects the resulting style is executed before the sheet is loaded, the script will find that the element is black (or whatever the default color is), and might thus make poor choices (e.g. deciding to use black as the color elsewhere on the page, instead of green). Implementors have to balance the likelihood of a script using incorrect information with the performance impact of doing nothing while waiting for a slow network request to finish.

A Document has a style sheet that is blocking scripts if there is either a style sheet that is blocking scripts in the context of that Document, or if that Document is in a browsing context that has a parent browsing context, and the active document of that parent browsing context itself has a style sheet that is blocking scripts.

A Document has no style sheet that is blocking scripts if it does not have a style sheet that is blocking scripts as defined in the previous paragraph.