1. 2.3 共通マむクロ構文
      1. 2.3.1 Common parser idioms
      2. 2.3.2 真停属性
      3. 2.3.3 キヌワヌドおよび列挙属性
      4. 2.3.4 数
        1. 2.3.4.1 笊号付き敎数
        2. 2.3.4.2 非負敎数
        3. 2.4.3.3 浮動小数点数
        4. 2.3.4.4 Percentages and lengths
        5. 2.3.4.5 Nonzero percentages and lengths
        6. 2.3.4.6 浮動小数点数のリスト
        7. 2.3.4.7 Lists of dimensions
      5. 2.3.5 日付および時刻
        1. 2.3.5.1 月
        2. 2.3.5.2 日付
        3. 2.3.5.3 幎なし日付
        4. 2.3.5.4 時刻
        5. 2.3.5.5 ロヌカル日付および時刻
        6. 2.3.5.6 タむムゟヌン
        7. 2.3.5.7 グロヌバル日付および時刻
        8. 2.3.5.8 週
        9. 2.3.5.9 継続時間
        10. 2.3.5.10 時刻における曖昧な瞬間
      6. 2.3.6 Legacy colors
      7. 2.3.7 空癜区切りトヌクン
      8. 2.3.8 コンマ区切りトヌクン
      9. 2.3.9 参照
      10. 2.3.10 メディアク゚リヌ
      11. 2.3.11 䞀意の内郚倀

2.3 共通マむクロ構文

HTMLには、日付や数など、特定のデヌタ型を受け入れるさたざたな箇所がある。この節では、これらの圢匏の内容の適合基準が䜕か、そしおどのように解析するかを説明する。

実装者は、以䞋に説明される構文の解析を実装するために䜿甚するこずを怜蚎するかもしれないサヌドパヌティのラむブラリヌを泚意深く怜査するこずを匷く勧める。たずえば、日付ラむブラリヌはこの仕様で芁求されるものずは異なる゚ラヌ凊理の挙動を実装する可胜性が高い。これは、゚ラヌ凊理の挙動はこの仕様で䜿甚されるものず類䌌した日付構文を蚘述する仕様で倚くの堎合は定矩されず、それゆえに実装ぱラヌを凊理する方法が倧きく倉化する傟向があるためである。

2.3.1 Common parser idioms

Some of the micro-parsers described below follow the pattern of having an input variable that holds the string being parsed, and having a position variable pointing at the next character to parse in input.

2.3.2 真停属性

いく぀かの属性は真停属性である。芁玠での真停属性の存圚は真の倀を衚し、属性の䞍圚は停の倀を衚す。

属性が存圚する堎合、その倀は先頭たたは末尟の空癜なしで、空の文字列たたは属性の正芏名にASCII倧文字・小文字䞍区別で䞀臎する倀でなければならない。

倀"true"および"false"は真停属性で蚱可されない。停の倀を衚すため、属性は完党に省略される必芁がある。

checkedおよびdisabledずなるチェックボックスの䟋を瀺す。checkedおよびdisabled属性は真停属性である。

<label><input type=checkbox checked name=cheese disabled> Cheese</label>

これは次に曞かれるものず等䟡であるべきである

<label><input type=checkbox checked=checked name=cheese disabled=disabled> Cheese</label>

スタむルを混圚させるこずもできる。以䞋は䟝然ずしお等䟡である

<label><input type='checkbox' checked name=cheese disabled=""> Cheese</label>

2.3.3 キヌワヌドおよび列挙属性

列挙属性ず呌ばれる䞀郚の属性は、状態の有限集合を取る。このような属性の状態は、属性の倀、䞀連のキヌワヌドおよび状態のマッピング、ならびに属性の仕様で指定できる3぀の特殊な状態を組み合わせるこずによっお導出される。これらの特殊な状態は、無効倀のデフォルト、欠損倀のデフォルト、および空の倀のデフォルトである。

耇数のキヌワヌドを同じ状態にマップできる。

属性の状態を刀別するには、次のステップを利甚する

  1. 属性が指定されおいない堎合

    1. 属性が欠損倀のデフォルト状態が定矩されおいる堎合、その欠萜倀のデフォルト状態を返す。

    2. そうでなければ、状態なしを返す。

  2. 属性の倀が、属性に定矩されおいるキヌワヌドの1぀ずASCII倧文字・小文字䞍区別でマッチする堎合、そのキヌワヌドで衚される状態を返す。

  3. 属性が空の倀のデフォルト状態が定矩されおおり、その属性の倀が空の文字列である堎合、その空の倀のデフォルト状態を返す。

  4. 属性が無効倀のデフォルト状態が定矩されおいる堎合、その無効倀のデフォルト状態を返す。

  5. 状態なしを返す。

オヌサリングの適合のため、列挙属性を指定する堎合、属性の倀は次のいずれかでなければならない

反射の目的で、マッピングされおいるキヌワヌドがある状態は、正芏のキヌワヌドを持぀ず蚀われる。これは次のように決定される

  1. 特定の状態にマッピングされおいるキヌワヌドが1぀しかない堎合、そのキヌワヌドである。

  2. 特定の状態にマッピングされおいる適合キヌワヌドが1぀しかない堎合、それはその適合キヌワヌドである。

  3. 指定された状態にマッピングする2぀の適合キヌワヌドがあり、1぀が空文字列である堎合、正芏キヌワヌドは空の文字列ではない適合キヌワヌドになる。

  4. そうでなければ、状態の正芏キヌワヌドは、属性の仕様で明瀺的に指定される。

2.3.4 数

2.3.4.1 笊号付き敎数

文字列が1぀以䞊のASCII 数字、任意で接頭蟞U+002D HYPHEN-MINUS文字-を持぀堎合、文字列は劥圓な敎数である。

接頭蟞U+002D HYPHEN-MINUS-接頭蟞なしの劥圓な敎数は、10進数を衚す。U+002D HYPHEN-MINUS文字-接頭蟞ありの劥圓な敎数は、U+002D HYPHEN-MINUSに続く10進数を衚し、0から枛算される。

The rules for parsing integers are as given in the following algorithm. When invoked, the steps must be followed in the order given, aborting at the first step that returns a value. This algorithm will return either an integer or an error.

  1. Let input be the string being parsed.

  2. Let position be a pointer into input, initially pointing at the start of the string.

  3. Let sign have the value "positive".

  4. Skip ASCII whitespace within input given position.

  5. If position is past the end of input, return an error.

  6. If the character indicated by position (the first character) is a U+002D HYPHEN-MINUS character (-):

    1. Let sign be "negative".
    2. Advance position to the next character.
    3. If position is past the end of input, return an error.

    Otherwise, if the character indicated by position (the first character) is a U+002B PLUS SIGN character (+):

    1. Advance position to the next character. (The "+" is ignored, but it is not conforming.)
    2. If position is past the end of input, return an error.
  7. If the character indicated by position is not an ASCII digit, then return an error.

  8. Collect a sequence of code points that are ASCII digits from input given position, and interpret the resulting sequence as a base-ten integer. Let value be that integer.

  9. If sign is "positive", return value, otherwise return the result of subtracting value from zero.

2.3.4.2 非負敎数

1぀以䞊のASCII数字からなる堎合、文字列は劥圓な非負敎数である。

劥圓な非負敎数は、10進数である数を衚す。

The rules for parsing non-negative integers are as given in the following algorithm. When invoked, the steps must be followed in the order given, aborting at the first step that returns a value. This algorithm will return either zero, a positive integer, or an error.

  1. Let input be the string being parsed.

  2. Let value be the result of parsing input using the rules for parsing integers.

  3. If value is an error, return an error.

  4. If value is less than zero, return an error.

  5. Return value.

2.3.4.3 浮動小数点数

次の堎合、文字列は劥圓な浮動小数点数である

  1. 任意で、1぀のA U+002D HYPHEN-MINUS文字-。

  2. 次のいずれかたたは䞡方の、䞎えられた順

    1. ひず続きの1぀以䞊のASCII数字。

    2. 次の䞡方の、䞎えられた順で

      1. 1぀のU+002E FULL STOP文字.。

      2. ひず続きの1぀以䞊のASCII数字。

  3. 任意で

    1. 1぀の U+0065 LATIN SMALL LETTER E文字eか1぀のU+0045 LATIN CAPITAL LETTER E文字Eのいずれか。

    2. 任意で、1぀のU+002D HYPHEN-MINUS文字-たたは1぀のU+002B PLUS SIGN文字+。

    3. ひず続きの1぀以䞊のASCII数字。

劥圓な浮動小数点数は、10の环乗による仮数郚の乗算によっお埗られる。ここで乗算は最初の数であり、10進数ずしお解釈されるもしあれば、小数点および小数点の埌の数を含み、文字列党䜓がU+002D HYPHEN-MINUS文字-で始たるおよび数倀が0でない堎合、負数ずしお仮数郚を解釈する。たたここで、もしあれば、指数はEの埌の数字であるEず数字ず数字の間にU+002D HYPHEN-MINUS文字-がある堎合、負数ずしお解釈され、数字が0でない、たたはその他Eず数字の間にU+002B PLUS SIGN文字+が存圚する堎合無芖できる。Eが存圚しない堎合、指数は0ずしお扱われる。

無限倧および非数NaN倀は劥圓な浮動小数点数ではない。

The valid floating-point number concept is typically only used to restrict what is allowed for authors, while the user agent requirements use the rules for parsing floating-point number values below (e.g., the max attribute of the progress element). However, in some cases the user agent requirements include checking if a string is a valid floating-point number (e.g., the value sanitization algorithm for the Number state of the input element, or the parse a srcset attribute algorithm).

The best representation of the number n as a floating-point number is the string obtained from running ToString(n). The abstract operation ToString is not uniquely determined. When there are multiple possible strings that could be obtained from ToString for a particular value, the user agent must always return the same string for that value (though it may differ from the value used by other user agents).

The rules for parsing floating-point number values are as given in the following algorithm. This algorithm must be aborted at the first step that returns something. This algorithm will return either a number or an error.

  1. Let input be the string being parsed.

  2. Let position be a pointer into input, initially pointing at the start of the string.

  3. Let value have the value 1.

  4. Let divisor have the value 1.

  5. Let exponent have the value 1.

  6. Skip ASCII whitespace within input given position.

  7. If position is past the end of input, return an error.

  8. If the character indicated by position is a U+002D HYPHEN-MINUS character (-):

    1. Change value and divisor to −1.
    2. Advance position to the next character.
    3. If position is past the end of input, return an error.

    Otherwise, if the character indicated by position (the first character) is a U+002B PLUS SIGN character (+):

    1. Advance position to the next character. (The "+" is ignored, but it is not conforming.)
    2. If position is past the end of input, return an error.
  9. If the character indicated by position is a U+002E FULL STOP (.), and that is not the last character in input, and the character after the character indicated by position is an ASCII digit, then set value to zero and jump to the step labeled fraction.

  10. If the character indicated by position is not an ASCII digit, then return an error.

  11. Collect a sequence of code points that are ASCII digits from input given position, and interpret the resulting sequence as a base-ten integer. Multiply value by that integer.

  12. If position is past the end of input, jump to the step labeled conversion.
  13. Fraction: If the character indicated by position is a U+002E FULL STOP (.), run these substeps:

    1. Advance position to the next character.

    2. If position is past the end of input, or if the character indicated by position is not an ASCII digit, U+0065 LATIN SMALL LETTER E (e), or U+0045 LATIN CAPITAL LETTER E (E), then jump to the step labeled conversion.

    3. If the character indicated by position is a U+0065 LATIN SMALL LETTER E character (e) or a U+0045 LATIN CAPITAL LETTER E character (E), skip the remainder of these substeps.

    4. Fraction loop: Multiply divisor by ten.

    5. Add the value of the character indicated by position, interpreted as a base-ten digit (0..9) and divided by divisor, to value.
    6. Advance position to the next character.

    7. If position is past the end of input, then jump to the step labeled conversion.

    8. If the character indicated by position is an ASCII digit, jump back to the step labeled fraction loop in these substeps.

  14. If the character indicated by position is U+0065 (e) or a U+0045 (E):

    1. Advance position to the next character.

    2. If position is past the end of input, then jump to the step labeled conversion.

    3. If the character indicated by position is a U+002D HYPHEN-MINUS character (-):

      1. Change exponent to −1.
      2. Advance position to the next character.
      3. If position is past the end of input, then jump to the step labeled conversion.

      Otherwise, if the character indicated by position is a U+002B PLUS SIGN character (+):

      1. Advance position to the next character.
      2. If position is past the end of input, then jump to the step labeled conversion.

    4. If the character indicated by position is not an ASCII digit, then jump to the step labeled conversion.

    5. Collect a sequence of code points that are ASCII digits from input given position, and interpret the resulting sequence as a base-ten integer. Multiply exponent by that integer.

    6. Multiply value by ten raised to the exponentth power.

  15. Conversion: Let S be the set of finite IEEE 754 double-precision floating-point values except −0, but with two special values added: 21024 and −21024.

  16. Let rounded-value be the number in S that is closest to value, selecting the number with an even significand if there are two equally close values. (The two special values 21024 and −21024 are considered to have even significands for this purpose.)

  17. If rounded-value is 21024 or −21024, return an error.

  18. Return rounded-value.

2.3.4.4 Percentages and lengths

The rules for parsing dimension values are as given in the following algorithm. When invoked, the steps must be followed in the order given, aborting at the first step that returns a value. This algorithm will return either a number greater than or equal to 0.0, or failure; if a number is returned, then it is further categorized as either a percentage or a length.

  1. Let input be the string being parsed.

  2. Let position be a position variable for input, initially pointing at the start of input.

  3. Skip ASCII whitespace within input given position.

  4. If position is past the end of input or the code point at position within input is not an ASCII digit, then return failure.

  5. Collect a sequence of code points that are ASCII digits from input given position, and interpret the resulting sequence as a base-ten integer. Let value be that number.

  6. If position is past the end of input, then return value as a length.

  7. If the code point at position within input is U+002E (.):

    1. Advance position by 1.

    2. If position is past the end of input or the code point at position within input is not an ASCII digit, then return the current dimension value with value, input, and position.

    3. Let divisor have the value 1.

    4. While true:

      1. Multiply divisor by ten.

      2. Add the value of the code point at position within input, interpreted as a base-ten digit (0..9) and divided by divisor, to value.

      3. Advance position by 1.

      4. If position is past the end of input, then return value as a length.

      5. If the code point at position within input is not an ASCII digit, then break.

  8. Return the current dimension value with value, input, and position.

The current dimension value, given value, input, and position, is determined as follows:

  1. If position is past the end of input, then return value as a length.

  2. If the code point at position within input is U+0025 (%), then return value as a percentage.

  3. Return value as a length.

2.3.4.5 Nonzero percentages and lengths

The rules for parsing nonzero dimension values are as given in the following algorithm. When invoked, the steps must be followed in the order given, aborting at the first step that returns a value. This algorithm will return either a number greater than 0.0, or an error; if a number is returned, then it is further categorized as either a percentage or a length.

  1. Let input be the string being parsed.

  2. Let value be the result of parsing input using the rules for parsing dimension values.

  3. If value is an error, return an error.

  4. If value is zero, return an error.

  5. If value is a percentage, return value as a percentage.

  6. Return value as a length.

2.3.4.6 浮動小数点数のリスト

劥圓な浮動小数点数リストは、U+002C COMMA文字によっお区切られる倚数の劥圓な浮動小数点数であり、他の文字を持たないたずえばASCII空癜文字のない。さらに、䞎えられる浮動小数点数の数、たたは蚱可される倀の範囲には制限があるかもしれない。

The rules for parsing a list of floating-point numbers are as follows:

  1. Let input be the string being parsed.

  2. Let position be a pointer into input, initially pointing at the start of the string.

  3. Let numbers be an initially empty list of floating-point numbers. This list will be the result of this algorithm.

  4. Collect a sequence of code points that are ASCII whitespace, U+002C COMMA, or U+003B SEMICOLON characters from input given position. This skips past any leading delimiters.

  5. While position is not past the end of input:

    1. Collect a sequence of code points that are not ASCII whitespace, U+002C COMMA, U+003B SEMICOLON, ASCII digits, U+002E FULL STOP, or U+002D HYPHEN-MINUS characters from input given position. This skips past leading garbage.

    2. Collect a sequence of code points that are not ASCII whitespace, U+002C COMMA, or U+003B SEMICOLON characters from input given position, and let unparsed number be the result.

    3. Let number be the result of parsing unparsed number using the rules for parsing floating-point number values.

    4. If number is an error, set number to zero.

    5. Append number to numbers.

    6. Collect a sequence of code points that are ASCII whitespace, U+002C COMMA, or U+003B SEMICOLON characters from input given position. This skips past the delimiter.

  6. Return numbers.

2.3.4.7 Lists of dimensions

The rules for parsing a list of dimensions are as follows. These rules return a list of zero or more pairs consisting of a number and a unit, the unit being one of percentage, relative, and absolute.

  1. Let raw input be the string being parsed.

  2. If the last character in raw input is a U+002C COMMA character (,), then remove that character from raw input.

  3. Split the string raw input on commas. Let raw tokens be the resulting list of tokens.

  4. Let result be an empty list of number/unit pairs.

  5. For each token in raw tokens, run the following substeps:

    1. Let input be the token.

    2. Let position be a pointer into input, initially pointing at the start of the string.

    3. Let value be the number 0.

    4. Let unit be absolute.

    5. If position is past the end of input, set unit to relative and jump to the last substep.

    6. If the character at position is an ASCII digit, collect a sequence of code points that are ASCII digits from input given position, interpret the resulting sequence as an integer in base ten, and increment value by that integer.

    7. If the character at position is U+002E (.):

      1. Collect a sequence of code points consisting of ASCII whitespace and ASCII digits from input given position. Let s be the resulting sequence.

      2. Remove all ASCII whitespace in s.

      3. If s is not the empty string:

        1. Let length be the number of characters in s (after the spaces were removed).

        2. Let fraction be the result of interpreting s as a base-ten integer, and then dividing that number by 10length.

        3. Increment value by fraction.

    8. Skip ASCII whitespace within input given position.

    9. If the character at position is a U+0025 PERCENT SIGN character (%), then set unit to percentage.

      Otherwise, if the character at position is a U+002A ASTERISK character (*), then set unit to relative.

    10. Add an entry to result consisting of the number given by value and the unit given by unit.

  6. Return the list result.

2.3.5 日付および時刻

䞋蚘のアルゎリズムにおいお、幎yearの月monthの日数はmonthが1、3、5、7、8、10、12ならば31である。monthが4、6、9、11ならば30である。monthが2か぀yearが400で割り切れる数、たたはyearが4で割り切れるが100で割り切れないならば29であり、そうでなければ28である。これは、グレゎリオ暊の閏幎を考慮に入れおいる。[GREGORIAN]

ASCII数字がこの節で定矩される日付および時刻の構文で䜿甚される堎合、これらは10進数で衚珟される。

While the formats described here are intended to be subsets of the corresponding ISO8601 formats, this specification defines parsing rules in much more detail than ISO8601. Implementers are therefore encouraged to carefully examine any date parsing libraries before using them to implement the parsing rules described below; ISO8601 libraries might not parse dates and times in exactly the same manner. [ISO8601]

この仕様が先発グレゎリオ暊を参照する堎合、これは、1幎に遡っお挿入された珟代のグレゎリオ暊を意味する。先発グレゎリオ日付ずしお明瀺的に参照される先発グレゎリオ暊での日付は、たずえ暊が問題の時刻たたは堎所で䜿甚されおいないずしおも、その暊を䜿甚しお説明される。[GREGORIAN]

この仕様においおワむダ圢匏ずしおのグレゎリオ暊の䜿甚は、決定に関わる人々の文化的なバむアスに起因する恣意的な遞択肢である。著者に察するフォヌムの日付、時刻、数倀の圢匏、フォヌムコントロヌルのロヌカラむれヌションに関する実装ノヌトおよびtimeの節も参照のこず。

2.3.5.1 月

月は、タむムゟヌン情報および幎ず月を超えた日付を持たない、特定の先発グレゎリオ暊から成る。[GREGORIAN]

䞎えられた順で次のコンポヌネントからなる堎合、文字列は、幎yearおよび月monthで衚される劥圓な月文字列である

  1. 4桁以䞊で衚されるyear。ここでyear > 0である。
  2. A U+002D HYPHEN-MINUS文字-
  3. 1 ≀ month ≀ 12の範囲で、月monthを衚す2぀のASCII数字

The rules to parse a month string are as follows. This will return either a year and month, or nothing. If at any point the algorithm says that it "fails", this means that it is aborted at that point and returns nothing.

  1. Let input be the string being parsed.

  2. Let position be a pointer into input, initially pointing at the start of the string.

  3. Parse a month component to obtain year and month. If this returns nothing, then fail.

  4. If position is not beyond the end of input, then fail.

  5. Return year and month.

The rules to parse a month component, given an input string and a position, are as follows. This will return either a year and a month, or nothing. If at any point the algorithm says that it "fails", this means that it is aborted at that point and returns nothing.

  1. Collect a sequence of code points that are ASCII digits from input given position. If the collected sequence is not at least four characters long, then fail. Otherwise, interpret the resulting sequence as a base-ten integer. Let year be that number.

  2. If year is not a number greater than zero, then fail.

  3. If position is beyond the end of input or if the character at position is not a U+002D HYPHEN-MINUS character, then fail. Otherwise, move position forwards one character.

  4. Collect a sequence of code points that are ASCII digits from input given position. If the collected sequence is not exactly two characters long, then fail. Otherwise, interpret the resulting sequence as a base-ten integer. Let month be that number.

  5. If month is not a number in the range 1 ≀ month ≀ 12, then fail.

  6. Return year and month.

2.3.5.2 日付

日付は、幎月日からなりタむムゟヌン情報を持たない、特定の先発グレゎリオ暊からなる。[GREGORIAN]

䞎えられた順で次のコンポヌネントからなる堎合、文字列は幎year、月month、日dayで衚される劥圓な日付文字列である

  1. yearおよびmonthで衚される、劥圓な月文字列
  2. A U+002D HYPHEN-MINUS文字-
  3. 1 ≀ day ≀ maxdayの範囲でのdayで衚される2぀のASCII数字。ここでmaxdayは幎yearおよび月monthでの日の数である。

The rules to parse a date string are as follows. This will return either a date, or nothing. If at any point the algorithm says that it "fails", this means that it is aborted at that point and returns nothing.

  1. Let input be the string being parsed.

  2. Let position be a pointer into input, initially pointing at the start of the string.

  3. Parse a date component to obtain year, month, and day. If this returns nothing, then fail.

  4. If position is not beyond the end of input, then fail.

  5. Let date be the date with year year, month month, and day day.

  6. Return date.

The rules to parse a date component, given an input string and a position, are as follows. This will return either a year, a month, and a day, or nothing. If at any point the algorithm says that it "fails", this means that it is aborted at that point and returns nothing.

  1. Parse a month component to obtain year and month. If this returns nothing, then fail.

  2. Let maxday be the number of days in month month of year year.

  3. If position is beyond the end of input or if the character at position is not a U+002D HYPHEN-MINUS character, then fail. Otherwise, move position forwards one character.

  4. Collect a sequence of code points that are ASCII digits from input given position. If the collected sequence is not exactly two characters long, then fail. Otherwise, interpret the resulting sequence as a base-ten integer. Let day be that number.

  5. If day is not a number in the range 1 ≀ day ≀ maxday, then fail.

  6. Return year, month, and day.

2.3.5.3 幎なし日付

幎なし日付はグレコリオ月ずその月の日からなるが、幎を䌎わない。[GREGORIAN]

䞎えられた順で次のコンポヌネントからなる堎合、文字列は月monthおよび日dayで衚される劥圓な幎なし日付文字列である

  1. 任意で、2぀のA U+002D HYPHEN-MINUS文字-
  2. 1 ≀ month ≀ 12の範囲で、月monthを衚す2぀のASCII数字
  3. A U+002D HYPHEN-MINUS文字-
  4. 1 ≀ day ≀ maxdayの範囲でのdayで衚される2぀のASCII数字。ここでmaxdayは月monthか぀任意の閏幎たずえば4たたは2000における日数である。

蚀い換えるず、2月を意味するmonthが"02"である堎合、あたかもその幎は閏幎かのように、日は29であっおもよい。

The rules to parse a yearless date string are as follows. This will return either a month and a day, or nothing. If at any point the algorithm says that it "fails", this means that it is aborted at that point and returns nothing.

  1. Let input be the string being parsed.

  2. Let position be a pointer into input, initially pointing at the start of the string.

  3. Parse a yearless date component to obtain month and day. If this returns nothing, then fail.

  4. If position is not beyond the end of input, then fail.

  5. Return month and day.

The rules to parse a yearless date component, given an input string and a position, are as follows. This will return either a month and a day, or nothing. If at any point the algorithm says that it "fails", this means that it is aborted at that point and returns nothing.

  1. Collect a sequence of code points that are U+002D HYPHEN-MINUS characters (-) from input given position. If the collected sequence is not exactly zero or two characters long, then fail.

  2. Collect a sequence of code points that are ASCII digits from input given position. If the collected sequence is not exactly two characters long, then fail. Otherwise, interpret the resulting sequence as a base-ten integer. Let month be that number.

  3. If month is not a number in the range 1 ≀ month ≀ 12, then fail.

  4. Let maxday be the number of days in month month of any arbitrary leap year (e.g. 4 or 2000).

  5. If position is beyond the end of input or if the character at position is not a U+002D HYPHEN-MINUS character, then fail. Otherwise, move position forwards one character.

  6. Collect a sequence of code points that are ASCII digits from input given position. If the collected sequence is not exactly two characters long, then fail. Otherwise, interpret the resulting sequence as a base-ten integer. Let day be that number.

  7. If day is not a number in the range 1 ≀ day ≀ maxday, then fail.

  8. Return month and day.

2.3.5.4 時刻

時刻は、時、分、秒、秒以䞋からなりタむムゟヌン情報を持たない、特定の時刻からなる。

䞎えられた順で次のコンポヌネントからなる堎合、文字列は、時hour、分minute、秒secondで衚される劥圓な時刻文字列である

  1. 0 ≀ hour ≀ 23の範囲で、hourを衚す2぀のASCII数字
  2. A U+003A COLON文字:
  3. 0 ≀ minute ≀ 59の範囲でminuteを衚す2぀のASCII数字
  4. If second is nonzero, or optionally if second is zero:
    1. A U+003A COLON文字:
    2. 0 ≀ s ≀ 59の範囲で、second敎数郚を衚す2぀のASCII数字
    3. secondが非敎数である堎合、たたは任意でsecondが敎数である堎合
      1. A U+002E FULL STOP character (.)
      2. second分数郚で衚される、1、2、たた3桁

secondコンポヌネントは60たたは61にはなり埗ない。閏秒を衚すこずはできない。

The rules to parse a time string are as follows. This will return either a time, or nothing. If at any point the algorithm says that it "fails", this means that it is aborted at that point and returns nothing.

  1. Let input be the string being parsed.

  2. Let position be a pointer into input, initially pointing at the start of the string.

  3. Parse a time component to obtain hour, minute, and second. If this returns nothing, then fail.

  4. If position is not beyond the end of input, then fail.

  5. Let time be the time with hour hour, minute minute, and second second.

  6. Return time.

The rules to parse a time component, given an input string and a position, are as follows. This will return either an hour, a minute, and a second, or nothing. If at any point the algorithm says that it "fails", this means that it is aborted at that point and returns nothing.

  1. Collect a sequence of code points that are ASCII digits from input given position. If the collected sequence is not exactly two characters long, then fail. Otherwise, interpret the resulting sequence as a base-ten integer. Let hour be that number.

  2. If hour is not a number in the range 0 ≀ hour ≀ 23, then fail.
  3. If position is beyond the end of input or if the character at position is not a U+003A COLON character, then fail. Otherwise, move position forwards one character.

  4. Collect a sequence of code points that are ASCII digits from input given position. If the collected sequence is not exactly two characters long, then fail. Otherwise, interpret the resulting sequence as a base-ten integer. Let minute be that number.

  5. If minute is not a number in the range 0 ≀ minute ≀ 59, then fail.
  6. Let second be 0.

  7. If position is not beyond the end of input and the character at position is U+003A (:):

    1. Advance position to the next character in input.

    2. If position is beyond the end of input, or at the last character in input, or if the next two characters in input starting at position are not both ASCII digits, then fail.

    3. Collect a sequence of code points that are either ASCII digits or U+002E FULL STOP characters from input given position. If the collected sequence is three characters long, or if it is longer than three characters long and the third character is not a U+002E FULL STOP character, or if it has more than one U+002E FULL STOP character, then fail. Otherwise, interpret the resulting sequence as a base-ten number (possibly with a fractional part). Set second to that number.

    4. If second is not a number in the range 0 ≀ second < 60, then fail.

  8. Return hour, minute, and second.

2.3.5.5 ロヌカル日付および時刻

ロヌカル日付および時刻は、幎、月、日、時、分、秒、秒以䞋からなる特定の先発グレコリオ暊からなるが、タむムゟヌン情報を持たない。[GREGORIAN]

䞎えられた順で次のコンポヌネントからなる堎合、文字列は劥圓なロヌカル日付および時刻文字列である

  1. 日付を衚す劥圓な日付文字列
  2. U+0054 LATIN CAPITAL LETTER T文字TたたはU+0020 SPACE文字
  3. 時刻を衚す劥圓な時刻文字列

䞎えられた順で次のコンポヌネントからなる堎合、文字列は劥圓な芏栌化ロヌカル日付および時刻文字列である

  1. 日付を衚す劥圓な日付文字列
  2. A U+0054 LATIN CAPITAL LETTER T文字T
  3. 時刻を衚す劥圓な時刻文字列は、䞎えられた時刻に察しお可胜な限り最短の文字列ずしお衚珟されるたずえば、䞎えられた時刻がその分の0秒である堎合、完党に秒のコンポヌネントを省略する

The rules to parse a local date and time string are as follows. This will return either a date and time, or nothing. If at any point the algorithm says that it "fails", this means that it is aborted at that point and returns nothing.

  1. Let input be the string being parsed.

  2. Let position be a pointer into input, initially pointing at the start of the string.

  3. Parse a date component to obtain year, month, and day. If this returns nothing, then fail.

  4. If position is beyond the end of input or if the character at position is neither a U+0054 LATIN CAPITAL LETTER T character (T) nor a U+0020 SPACE character, then fail. Otherwise, move position forwards one character.

  5. Parse a time component to obtain hour, minute, and second. If this returns nothing, then fail.

  6. If position is not beyond the end of input, then fail.

  7. Let date be the date with year year, month month, and day day.

  8. Let time be the time with hour hour, minute minute, and second second.

  9. Return date and time.

2.3.5.6 タむムゟヌン

タむムゟヌンオフセットは笊号付きの時ず分の数字からなる。

次のいずれかからなる堎合、文字列は、タむムゟヌンオフセットを衚す劥圓なタむムゟヌンオフセット文字列である

この圢匏は、-23:59から+23:59たでのタむムゟヌンオフセットを蚱可する。特に、実際のタむムゟヌンオフセットの範囲は-12:00から+14:00たでであり、実際のタむムゟヌンオフセットの分コンポヌネントは垞に00、30たたは45のいずれかである。ずはいえ、タむムゟヌンは政争の具ずしお䜿甚され、非垞に気たぐれな政策決定の察象ずされるので、氞遠に保持される保蚌はない。

正匏なタむムゟヌンの圢成以前に遡る歎史的な時代でのタむムゟヌンのオフセットを䜿甚に぀いおの詳现は、䞋蚘のグロヌバル日付および時刻の節にある䜿甚䞊の泚意ず䟋を参照のこず。

The rules to parse a time-zone offset string are as follows. This will return either a time-zone offset, or nothing. If at any point the algorithm says that it "fails", this means that it is aborted at that point and returns nothing.

  1. Let input be the string being parsed.

  2. Let position be a pointer into input, initially pointing at the start of the string.

  3. Parse a time-zone offset component to obtain timezonehours and timezoneminutes. If this returns nothing, then fail.

  4. If position is not beyond the end of input, then fail.

  5. Return the time-zone offset that is timezonehours hours and timezoneminutes minutes from UTC.

The rules to parse a time-zone offset component, given an input string and a position, are as follows. This will return either time-zone hours and time-zone minutes, or nothing. If at any point the algorithm says that it "fails", this means that it is aborted at that point and returns nothing.

  1. If the character at position is a U+005A LATIN CAPITAL LETTER Z character (Z):

    1. Let timezonehours be 0.

    2. Let timezoneminutes be 0.

    3. Advance position to the next character in input.

    Otherwise, if the character at position is either a U+002B PLUS SIGN (+) or a U+002D HYPHEN-MINUS (-):

    1. If the character at position is a U+002B PLUS SIGN (+), let sign be "positive". Otherwise, it's a U+002D HYPHEN-MINUS (-); let sign be "negative".

    2. Advance position to the next character in input.

    3. Collect a sequence of code points that are ASCII digits from input given position. Let s be the collected sequence.

    4. If s is exactly two characters long:

      1. Interpret s as a base-ten integer. Let timezonehours be that number.

      2. If position is beyond the end of input or if the character at position is not a U+003A COLON character, then fail. Otherwise, move position forwards one character.

      3. Collect a sequence of code points that are ASCII digits from input given position. If the collected sequence is not exactly two characters long, then fail. Otherwise, interpret the resulting sequence as a base-ten integer. Let timezoneminutes be that number.

      If s is exactly four characters long:

      1. Interpret the first two characters of s as a base-ten integer. Let timezonehours be that number.

      2. Interpret the last two characters of s as a base-ten integer. Let timezoneminutes be that number.

      Otherwise, fail.

    5. If timezonehours is not a number in the range 0 ≀ timezonehours ≀ 23, then fail.
    6. If sign is "negative", then negate timezonehours.
    7. If timezoneminutes is not a number in the range 0 ≀ timezoneminutes ≀ 59, then fail.
    8. If sign is "negative", then negate timezoneminutes.

    Otherwise, fail.

  2. Return timezonehours and timezoneminutes.

2.3.5.7 グロヌバル日付および時刻

グロヌバル日付および時刻は、笊号付き時分からなるタむムゟヌンオフセットずずもに幎、月、日、時、分、秒、秒以䞋からなる特定先発グレコリオ暊で構成する。[GREGORIAN]

䞎えられた順で次のコンポヌネントからなる堎合、日付、時刻、タむムゟヌンオフセットを衚す文字列は劥圓なグロヌバル日付および時刻である

  1. 日付を衚す劥圓な日付文字列
  2. U+0054 LATIN CAPITAL LETTER T文字TたたはU+0020 SPACE文字
  3. 時刻を衚す劥圓な時刻文字列
  4. タむムゟヌンオフセットを衚す劥圓なタむムゟヌンオフセット文字列

20䞖玀半ばにUTCを圢成する前の日付の時刻は、UTCUT1の近䌌がSI秒を刻むではなく、UT10°経床での珟代の地球倪陜時の芋地から衚珟および解釈されなければならない。タむムゟヌンを圢成する前の時刻は、適切なロヌカル時刻ずロンドンのグリニッゞで芳枬された時刻ずの間のおおよその珟代的な違いのある明瀺的なタむムゟヌンずずもにUT1の時刻ずしお衚珟および解釈されなければならない。

以䞋は劥圓なグロヌバル日付および時刻ずしお蚘述される䟋の䞀郚である。

"0037-12-13 00:00Z"
ネロロヌマ皇垝の誕生日にロンドン時を甚いた地域での真倜䞭。これが実際に察応しおいる日付のさらなる議論に぀いおは䞋蚘を参照のこず。
"1979-10-14T12:00:00.001-04:00"
倏時間の間にアメリカ東海岞で䜿甚されるタむムゟヌンで、1979幎10月14日の正午1ミリ秒埌。
"8592-01-01T02:09+02:09"
8592幎1月1日のUTCで倜䞭。珟圚の実際のタむムゟヌンではない、UTCより早く時刻が2時9分であるタむムゟヌンに関連付けられるが、それでもなお、蚱可される。

次の日付に関しおいく぀かの泚目に倀する点がある

The rules to parse a global date and time string are as follows. This will return either a time in UTC, with associated time-zone offset information for roundtripping or display purposes, or nothing. If at any point the algorithm says that it "fails", this means that it is aborted at that point and returns nothing.

  1. Let input be the string being parsed.

  2. Let position be a pointer into input, initially pointing at the start of the string.

  3. Parse a date component to obtain year, month, and day. If this returns nothing, then fail.

  4. If position is beyond the end of input or if the character at position is neither a U+0054 LATIN CAPITAL LETTER T character (T) nor a U+0020 SPACE character, then fail. Otherwise, move position forwards one character.

  5. Parse a time component to obtain hour, minute, and second. If this returns nothing, then fail.

  6. If position is beyond the end of input, then fail.

  7. Parse a time-zone offset component to obtain timezonehours and timezoneminutes. If this returns nothing, then fail.

  8. If position is not beyond the end of input, then fail.

  9. Let time be the moment in time at year year, month month, day day, hours hour, minute minute, second second, subtracting timezonehours hours and timezoneminutes minutes. That moment in time is a moment in the UTC time zone.

  10. Let timezone be timezonehours hours and timezoneminutes minutes from UTC.

  11. Return time and timezone.

2.3.5.8 週

週は、週番号幎ず週番号からなる。週番号は、月曜日から始たる7日間を瀺す。次の定矩に埓っお、このカレンダヌシステムにおける週番号幎は52たたは53の7日間を持぀。グレゎリオ暊の日付で1969幎12月29日1969-12-29月曜日で始たる7日間は、1970週番号幎で週番号1ずしお定矩される。連続した週は連番が付けられる。週番号幎で1週目の前の週は、前の週番号幎の最終週である。逆もたた同様である。[GREGORIAN]

最初の日1月1日が朚曜である先発グレコリオ暊の幎year、たたは最初の日1月1日が朚曜である先発グレコリオ暊の幎yearのいずれかに察応する堎合、数字yearずずもに週番号幎は53週を持぀。ここで、yearは400で割り切れる数字、たたは4で割り切れるが100で割り切れない数字である。他のすべおの週番号幎は52週である。

53週をも぀週番号幎の最終日の週番号は53であり、52週をも぀週番号幎の最終日の週番号は52である。

特定の日の週番号幎の数は、先発グレゎリオ暊で、その日を含む幎の数ず異なる堎合がある。週番号幎yでの最初の週は、グレコリオ幎yの最初の朚曜を含む週である。

珟代の甚途に察しお、ここで定矩される週は、ISO 8601で定矩されるようなISO週に盞圓する。[ISO8601]

䞎えられた順で次のコンポヌネントからなる堎合、文字列は、週番号幎yearおよび週weekを衚す劥圓な週文字列である

  1. 4桁以䞊で衚されるyear。ここでyear > 0である。
  2. A U+002D HYPHEN-MINUS文字-
  3. U+0057 LATIN CAPITAL LETTER W文字W
  4. 1 ≀ week ≀ maxweekの範囲で、週weekを衚す2぀のASCII数字。ここで maxweekは週番号幎yearの最終日の週番号である。

The rules to parse a week string are as follows. This will return either a week-year number and week number, or nothing. If at any point the algorithm says that it "fails", this means that it is aborted at that point and returns nothing.

  1. Let input be the string being parsed.

  2. Let position be a pointer into input, initially pointing at the start of the string.

  3. Collect a sequence of code points that are ASCII digits from input given position. If the collected sequence is not at least four characters long, then fail. Otherwise, interpret the resulting sequence as a base-ten integer. Let year be that number.

  4. If year is not a number greater than zero, then fail.

  5. If position is beyond the end of input or if the character at position is not a U+002D HYPHEN-MINUS character, then fail. Otherwise, move position forwards one character.

  6. If position is beyond the end of input or if the character at position is not a U+0057 LATIN CAPITAL LETTER W character (W), then fail. Otherwise, move position forwards one character.

  7. Collect a sequence of code points that are ASCII digits from input given position. If the collected sequence is not exactly two characters long, then fail. Otherwise, interpret the resulting sequence as a base-ten integer. Let week be that number.

  8. Let maxweek be the week number of the last day of year year.

  9. If week is not a number in the range 1 ≀ week ≀ maxweek, then fail.

  10. If position is not beyond the end of input, then fail.

  11. Return the week-year number year and the week number week.

2.3.5.9 継続時間

継続時間は耇数秒からなる。

月ず秒は同等ではない1か月は正確な秒数ではなく、その正確な長さは、枬定された正確な1日に䟝存する期間であるので、この仕様で定矩される継続時間は月を含めるこずはできないたた幎は12か月に等しい特定の秒数を蚘述する継続時間のみが蚘述可胜である。

次のいずれかからなる堎合、文字列は、継続時間tで衚す劥圓な継続時間文字列である

The rules to parse a duration string are as follows. This will return either a duration or nothing. If at any point the algorithm says that it "fails", this means that it is aborted at that point and returns nothing.

  1. Let input be the string being parsed.

  2. Let position be a pointer into input, initially pointing at the start of the string.

  3. Let months, seconds, and component count all be zero.

  4. Let M-disambiguator be minutes.

    This flag's other value is months. It is used to disambiguate the "M" unit in ISO8601 durations, which use the same unit for months and minutes. Months are not allowed, but are parsed for future compatibility and to avoid misinterpreting ISO8601 durations that would be valid in other contexts.

  5. Skip ASCII whitespace within input given position.

  6. If position is past the end of input, then fail.

  7. If the character in input pointed to by position is a U+0050 LATIN CAPITAL LETTER P character, then advance position to the next character, set M-disambiguator to months, and skip ASCII whitespace within input given position.

  8. While true:

    1. Let units be undefined. It will be assigned one of the following values: years, months, weeks, days, hours, minutes, and seconds.

    2. Let next character be undefined. It is used to process characters from the input.

    3. If position is past the end of input, then break.

    4. If the character in input pointed to by position is a U+0054 LATIN CAPITAL LETTER T character, then advance position to the next character, set M-disambiguator to minutes, skip ASCII whitespace within input given position, and continue.

    5. Set next character to the character in input pointed to by position.

    6. If next character is a U+002E FULL STOP character (.), then let N be 0. (Do not advance position. That is taken care of below.)

      Otherwise, if next character is an ASCII digit, then collect a sequence of code points that are ASCII digits from input given position, interpret the resulting sequence as a base-ten integer, and let N be that number.

      Otherwise, next character is not part of a number; fail.

    7. If position is past the end of input, then fail.

    8. Set next character to the character in input pointed to by position, and this time advance position to the next character. (If next character was a U+002E FULL STOP character (.) before, it will still be that character this time.)

    9. If next character is U+002E (.):

      1. Collect a sequence of code points that are ASCII digits from input given position. Let s be the resulting sequence.

      2. If s is the empty string, then fail.

      3. Let length be the number of characters in s.

      4. Let fraction be the result of interpreting s as a base-ten integer, and then dividing that number by 10length.

      5. Increment N by fraction.

      6. Skip ASCII whitespace within input given position.

      7. If position is past the end of input, then fail.

      8. Set next character to the character in input pointed to by position, and advance position to the next character.

      9. If next character is neither a U+0053 LATIN CAPITAL LETTER S character nor a U+0073 LATIN SMALL LETTER S character, then fail.

      10. Set units to seconds.

      Otherwise:

      1. If next character is ASCII whitespace, then skip ASCII whitespace within input given position, set next character to the character in input pointed to by position, and advance position to the next character.

      2. If next character is a U+0059 LATIN CAPITAL LETTER Y character, or a U+0079 LATIN SMALL LETTER Y character, set units to years and set M-disambiguator to months.

        If next character is a U+004D LATIN CAPITAL LETTER M character or a U+006D LATIN SMALL LETTER M character, and M-disambiguator is months, then set units to months.

        If next character is a U+0057 LATIN CAPITAL LETTER W character or a U+0077 LATIN SMALL LETTER W character, set units to weeks and set M-disambiguator to minutes.

        If next character is a U+0044 LATIN CAPITAL LETTER D character or a U+0064 LATIN SMALL LETTER D character, set units to days and set M-disambiguator to minutes.

        If next character is a U+0048 LATIN CAPITAL LETTER H character or a U+0068 LATIN SMALL LETTER H character, set units to hours and set M-disambiguator to minutes.

        If next character is a U+004D LATIN CAPITAL LETTER M character or a U+006D LATIN SMALL LETTER M character, and M-disambiguator is minutes, then set units to minutes.

        If next character is a U+0053 LATIN CAPITAL LETTER S character or a U+0073 LATIN SMALL LETTER S character, set units to seconds and set M-disambiguator to minutes.

        Otherwise, if next character is none of the above characters, then fail.

    10. Increment component count.

    11. Let multiplier be 1.

    12. If units is years, multiply multiplier by 12 and set units to months.

    13. If units is months, add the product of N and multiplier to months.

      Otherwise:

      1. If units is weeks, multiply multiplier by 7 and set units to days.

      2. If units is days, multiply multiplier by 24 and set units to hours.

      3. If units is hours, multiply multiplier by 60 and set units to minutes.

      4. If units is minutes, multiply multiplier by 60 and set units to seconds.

      5. Forcibly, units is now seconds. Add the product of N and multiplier to seconds.

    14. Skip ASCII whitespace within input given position.

  9. If component count is zero, fail.

  10. If months is not zero, fail.

  11. Return the duration consisting of seconds seconds.

2.3.5.10 時刻における曖昧な瞬間

次のいずれかである堎合、文字列は任意の時刻を持぀劥圓な日付文字列である


The rules to parse a date or time string are as follows. The algorithm will return either a date, a time, a global date and time, or nothing. If at any point the algorithm says that it "fails", this means that it is aborted at that point and returns nothing.

  1. Let input be the string being parsed.

  2. Let position be a pointer into input, initially pointing at the start of the string.

  3. Set start position to the same position as position.

  4. Set the date present and time present flags to true.

  5. Parse a date component to obtain year, month, and day. If this fails, then set the date present flag to false.

  6. If date present is true, and position is not beyond the end of input, and the character at position is either a U+0054 LATIN CAPITAL LETTER T character (T) or a U+0020 SPACE character, then advance position to the next character in input.

    Otherwise, if date present is true, and either position is beyond the end of input or the character at position is neither a U+0054 LATIN CAPITAL LETTER T character (T) nor a U+0020 SPACE character, then set time present to false.

    Otherwise, if date present is false, set position back to the same position as start position.

  7. If the time present flag is true, then parse a time component to obtain hour, minute, and second. If this returns nothing, then fail.

  8. If the date present and time present flags are both true, but position is beyond the end of input, then fail.

  9. If the date present and time present flags are both true, parse a time-zone offset component to obtain timezonehours and timezoneminutes. If this returns nothing, then fail.

  10. If position is not beyond the end of input, then fail.

  11. If the date present flag is true and the time present flag is false, then let date be the date with year year, month month, and day day, and return date.

    Otherwise, if the time present flag is true and the date present flag is false, then let time be the time with hour hour, minute minute, and second second, and return time.

    Otherwise, let time be the moment in time at year year, month month, day day, hours hour, minute minute, second second, subtracting timezonehours hours and timezoneminutes minutes, that moment in time being a moment in the UTC time zone; let timezone be timezonehours hours and timezoneminutes minutes from UTC; and return time and timezone.

2.3.6 Legacy colors

Some obsolete legacy attributes parse colors using the rules for parsing a legacy color value, given a string input. They will return either a CSS color or failure.

  1. If input is the empty string, then return failure.

  2. Strip leading and trailing ASCII whitespace from input.

  3. If input is an ASCII case-insensitive match for "transparent", then return failure.

  4. If input is an ASCII case-insensitive match for one of the named colors, then return the CSS color corresponding to that keyword. [CSSCOLOR]

    CSS2 System Colors are not recognized.

  5. If input's code point length is four, and the first character in input is U+0023 (#), and the last three characters of input are all ASCII hex digits:

    1. Let result be a CSS color.

    2. Interpret the second character of input as a hexadecimal digit; let the red component of result be the resulting number multiplied by 17.

    3. Interpret the third character of input as a hexadecimal digit; let the green component of result be the resulting number multiplied by 17.

    4. Interpret the fourth character of input as a hexadecimal digit; let the blue component of result be the resulting number multiplied by 17.

    5. Return result.

  6. Replace any code points greater than U+FFFF in input (i.e., any characters that are not in the basic multilingual plane) with "00".

  7. If input's code point length is greater than 128, truncate input, leaving only the first 128 characters.

  8. If the first character in input is U+0023 (#), then remove it.

  9. Replace any character in input that is not an ASCII hex digit with U+0030 (0).

  10. While input's code point length is zero or not a multiple of three, append U+0030 (0) to input.

  11. Split input into three strings of equal code point length, to obtain three components. Let length be the code point length that all of those components have (one third the code point length of input).

  12. If length is greater than 8, then remove the leading length-8 characters in each component, and let length be 8.

  13. While length is greater than two and the first character in each component is U+0030 (0), remove that character and reduce length by one.

  14. If length is still greater than two, truncate each component, leaving only the first two characters in each.

  15. Let result be a CSS color.

  16. Interpret the first component as a hexadecimal number; let the red component of result be the resulting number.

  17. Interpret the second component as a hexadecimal number; let the green component of result be the resulting number.

  18. Interpret the third component as a hexadecimal number; let the blue component of result be the resulting number.

  19. Return result.

2.3.7 空癜区切りトヌクン

空癜区切りトヌクンの集合は、1぀以䞊のASCII空癜文字によっお区切られた0個以䞊の単語トヌクンずしお知られるを含む文字列である。ここで、単語は1぀以䞊の文字を含み、ASCII空癜文字を含たない。

空癜区切りトヌクンの集合を構成する文字列は、先頭たたは末尟にASCII空癜文字を持っおもよい。

順䞍同の䞀意な空癜区切りトヌクンの集合は、繰り返しトヌクンのない空癜区切りトヌクンの集合である。

順序付きの䞀意な空癜区切りトヌクンの集合は、繰り返しトヌクンはないが、トヌクンの順序が意味のある空癜区切りトヌクンの集合である。

空癜区切りトヌクンの集合は時折定矩された蚱可される倀の集合を持぀。蚱可された倀の集合が定矩される堎合、トヌクンはすべお蚱可される倀のリストでなければならない。その他の倀は䞍適合である。そのような蚱可される倀の集合が甚意されない堎合、すべおの倀は適合である。

空癜区切りトヌクンの集合のトヌクンがどのように比范されるかたずえば、倧文字小文字を区別するかどうかは、セットごずに定矩される。

2.3.8 コンマ区切りトヌクン

コンマ区切りトヌクンの集合は、それぞれ単䞀のU+002C COMMA文字,で区切られる0個以䞊のトヌクンを含む文字列である。ここでトヌクンは0個以䞊の任意の文字列からなり、先頭も末尟もASCII空癜文字でなく、U+002C COMMA文字,を含たず、任意でASCII空癜文字に囲たれるものである。

たずえば、文字列" a ,b,,d d "は4぀のトヌクンからなる。"a"、"b"、空文字列および"d d"。各トヌクンの呚りの先頭ず末尟の空癜はトヌクンの䞀郚ずしおカりントされず、空文字列はトヌクンであるかもしれない。

コンマ区切りトヌクンの集合は時に劥圓なトヌクンを構成するさらなる制玄を持぀。そのような制限が定矩される堎合、トヌクンはすべおその制限に収たるようにしなければならない。その他の倀は䞍適合である。そのような制限が指定されない堎合、すべおの倀は適合である。

2.3.9 参照

タむプtype芁玠の劥圓なハッシュ名参照は、 U+0023 NUMBER SIGN文字#の埌に同じツリヌでタむプtypeをも぀芁玠のname属性の倀に正確に䞀臎する文字列から構成される文字列である。

The rules for parsing a hash-name reference to an element of type type, given a context node scope, are as follows:

  1. If the string being parsed does not contain a U+0023 NUMBER SIGN character, or if the first such character in the string is the last character in the string, then return null.

  2. Let s be the string from the character immediately after the first U+0023 NUMBER SIGN character in the string being parsed up to the end of that string.

  3. Return the first element of type type in scope's tree, in tree order, that has an id or name attribute whose value is s, or null if there is no such element.

    Although id attributes are accounted for when parsing, they are not used in determining whether a value is a valid hash-name reference. That is, a hash-name reference that refers to an element based on id is a conformance error (unless that element also has a name attribute with the same value).

2.3.10 メディアク゚リヌ

Media Queriesの<media-query-list>生成物に䞀臎する堎合、文字列は劥圓なメディアク゚リヌリストである。[MQ]

空文字列、ASCII空癜文字のみからなる文字列、たたはMedia Queriesで䞎えられる定矩に埓ったナヌザヌ環境にマッチするメディアク゚リヌの堎合、文字列はナヌザヌ環境に䞀臎する。[MQ]

2.3.11 䞀意の内郚倀

䞀意の内郚倀は、シリアル化可胜で、倀によっお比范可胜であり、スクリプトに公開されるこずのない倀である。

新しい䞀意の内郚倀を䜜成するには、このアルゎリズムによっお以前に返されたこずのない䞀意の内郚倀を返す。