차례
    1. 2.5 공통 상세문법
      1. 2.5.1 파서 숙어
      2. 2.5.2 불리언 속성
      3. 2.5.3 키워드, 나열 속성
      4. 2.5.4 숫자
        1. 2.5.4.1 음이 아닌 정수
        2. 2.5.4.2 기호가 붙은 정수
        3. 2.5.4.3 실수
        4. 2.5.4.4 퍼센트와 길이
        5. 2.5.4.5 정수 목록
        6. 2.5.4.6 크기 목록
      5. 2.5.5 날짜와 시간
        1. 2.5.5.1
        2. 2.5.5.2
        3. 2.5.5.3 시간
        4. 2.5.5.4 날짜와 시간(지역)
        5. 2.5.5.5 날짜와 시간(국제)
        6. 2.5.5.6
        7. 2.5.5.7 모호한 시간
      6. 2.5.6 색상
      7. 2.5.7 공백문자로 구분된 토큰
      8. 2.5.8 쉼표로 구분된 토큰
      9. 2.5.9 참조
      10. 2.5.10 미디어 쿼리

2.5 공통 상세문법

HTML에는 특정한 데이터 타입만을 수용하는 곳이 많습니다. 이 섹션은 그러한 포맷이 포함되는 컨텐츠에 대한 요구사항과 파싱 방법을 설명합니다.

There are various places in HTML that accept particular data types, such as dates or numbers. This section describes what the conformance criteria for content in those formats is, and how to parse them.

Implementors are strongly urged to carefully examine any third-party libraries they might consider using to implement the parsing of syntaxes described below. For example, date libraries are likely to implement error handling behavior that differs from what is required in this specification, since error-handling behavior is often not defined in specifications that describe date syntaxes similar to those used in this specification, and thus implementations tend to vary greatly in how they handle errors.

2.5.1 파서 숙어

The space characters, for the purposes of this specification, are U+0020 SPACE, U+0009 CHARACTER TABULATION (tab), U+000A LINE FEED (LF), U+000C FORM FEED (FF), and U+000D CARRIAGE RETURN (CR).

The White_Space characters are those that have the Unicode property "White_Space" in the Unicode PropList.txt data file. [UNICODE]

This should not be confused with the "White_Space" value (abbreviated "WS") of the "Bidi_Class" property in the Unicode.txt data file.

The alphanumeric ASCII characters are those in the ranges U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9), U+0041 LATIN CAPITAL LETTER A to U+005A LATIN CAPITAL LETTER Z, U+0061 LATIN SMALL LETTER A to U+007A LATIN SMALL LETTER Z.

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.

For parsers based on this pattern, a step that requires the user agent to collect a sequence of characters means that the following algorithm must be run, with characters being the set of characters that can be collected:

  1. Let input and position be the same variables as those of the same name in the algorithm that invoked these steps.

  2. Let result be the empty string.

  3. While position doesn't point past the end of input and the character at position is one of the characters, append that character to the end of result and advance position to the next character in input.

  4. Return result.

The step skip whitespace means that the user agent must collect a sequence of characters that are space characters. The step skip White_Space characters means that the user agent must collect a sequence of characters that are White_Space characters. In both cases, the collected characters are not used. [UNICODE]

When a user agent is to strip line breaks from a string, the user agent must remove any U+000A LINE FEED (LF) and U+000D CARRIAGE RETURN (CR) characters from that string.

When a user agent is to strip leading and trailing whitespace from a string, the user agent must remove all space characters that are at the start or end of the string.

The code-point length of a string is the number of Unicode code points in that string.

2.5.2 불리언 속성

상당수의 속성이 불리언 속성입니다. 불리언 속성이 요소에 나타났다면 그것은 참을 의미합니다. 존재하지 않는다면 거짓을 의미합니다.

A number of attributes are boolean attributes. The presence of a boolean attribute on an element represents the true value, and the absence of the attribute represents the false value.

속성이 사용되었다면, 그 값은 빈 문자열이거나, 속성의 정규명칭과 아스키, 대소문자 구분 없이 일치해야 하며 앞뒤로 공백을 포함해서는 안 됩니다.

If the attribute is present, its value must either be the empty string or a value that is an ASCII case-insensitive match for the attribute's canonical name, with no leading or trailing whitespace.

불리언 속성에서는 true, false 값을 사용할 수 없습니다. false 값을 나타내려면 속성을 생략해야 합니다.

The values "true" and "false" are not allowed on boolean attributes. To represent a false value, the attribute has to be omitted altogether.

이 예제의 체크박스는 체크되었고, 비활성화되었습니다. checked 속성과 disabled 속성은 불리언 속성입니다.

Here is an example of a checkbox that is checked and disabled. The checked and disabled attributes are the boolean attributes.

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

예제는 이렇게 써도 같습니다.

This could be equivalently written as this:

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

스타일을 섞어 써도 무방합니다. 다음 역시 같은 것입니다.

You can also mix styles; the following is still equivalent:

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

2.5.3 키워드, 나열 속성

몇몇 속성들은 제한된 키워드의 집합 중에서 하나를 선택하는 것처럼 정의되어 있습니다. 그러한 속성을 나열 속성이라 칭합니다. 키워드들은 특정한 상태state에 대응하도록 정의되어 있습니다. (몇몇 키워드들이 같은 상태에 대응하기도 합니다. 이러한 경우는 키워드 중 일부가 다른 키워드의 동의어인 경우입니다. 다른 경우는, 키워드가 요구사항에 맞지는 않지만, 호환성을 위해 어쩔 수 없이 존속시키는 경우입니다.) 또한 두 가지 디폴트 상태가 정의되어 있습니다. 그중 하나는 틀린 값에 대한 디폴트이며, 다른 하나는 값이 없는 경우의 디폴트입니다.

Some attributes are defined as taking one of a finite set of keywords. Such attributes are called enumerated attributes. The keywords are each defined to map to a particular state (several keywords might map to the same state, in which case some of the keywords are synonyms of each other; additionally, some of the keywords can be said to be non-conforming, and are only in the specification for historical reasons). In addition, two default states can be given. The first is the invalid value default, the second is the missing value default.

나열 속성이 명시되었다면, 속성의 값은 키워드 중 하나와 아스키, 대소문자 구분 없이 일치해야 합니다. 값은 요구사항에 맞는 것이어야 하며, 앞뒤에 공백문자가 있어서는 안 됩니다.

If an enumerated attribute is specified, the attribute's value must be an ASCII case-insensitive match for one of the given keywords that are not said to be non-conforming, with no leading or trailing whitespace.

속성이 명시되었고, 그 값이 주어진 키워드 중 하나와 아스키, 대소문자 구분 없이 일치한다면, 키워드의 상태가 속성의 상태를 나타냅니다. 틀린 값에 대한 디폴트가 정의된 속성의 값이 주어진 키워드 중 아무것과도 일치하지 않다면, 속성은 틀린 값에 대한 디폴트를 나타냅니다. 값이 존재하지 않는 경우에 대한 디폴트가 정의된 속성의 값이 키워드 중 아무것과도 일치하지 않다면 속성은 값이 존재하지 않는 경우에 대한 디폴트 상태를 나타냅니다. 그렇지도 않다면, 디폴트가 없는 것이고 틀린 값은 무시해야 합니다.

When the attribute is specified, if its value is an ASCII case-insensitive match for one of the given keywords then that keyword's state is the state that the attribute represents. If the attribute value matches none of the given keywords, but the attribute has an invalid value default, then the attribute represents that state. Otherwise, if the attribute value matches none of the keywords but there is a missing value default state defined, then that is the state represented by the attribute. Otherwise, there is no default, and invalid values must be ignored.

값이 존재하지 않는 경우에 대한 디폴트가 정의된 속성이 명시되지 않았다면, 그 디폴트가 (생략된) 속성의 상태를 나타냅니다. 그렇지 않은 경우, 속성의 부재는 상태에 대한 정의가 없음을 의미합니다.

When the attribute is not specified, if there is a missing value default state defined, then that is the state represented by the (missing) attribute. Otherwise, the absence of the attribute means that there is no state represented.

빈 문자열도 유효한 키워드가 될 수 있습니다.

The empty string can be a valid keyword.

2.5.4 숫자

2.5.4.1 음이 아닌 정수

문자열이 0부터 9 사이의 숫자 중 하나 이상으로 구성되었다면 그것은 유효한 양의 정수입니다.

A string is a valid non-negative integer if it consists of one or more characters in the range U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9).

유효한 양의 정수는 십진수를 나타냅니다.

A valid non-negative integer represents the number that is represented in base ten by that string of digits.

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 position be a pointer into input, initially pointing at the start of the string.

  3. Skip whitespace.

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

  5. If the character indicated by position is a U+002B PLUS SIGN character (+), advance position to the next character. (The "+" is ignored, but it is not conforming.)

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

  7. If the character indicated by position is not one of U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9), then return an error.

  8. Collect a sequence of characters in the range U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9), and interpret the resulting sequence as a base-ten integer. Let value be that integer.

  9. Return value.

2.5.4.2 기호가 붙은 정수

문자열이 0부터 9까지의 숫자와 전치사로 붙을 수 있는 - 문자만으로 구성된 경우 그것은 유효한 정수입니다.

A string is a valid integer if it consists of one or more characters in the range U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9), optionally prefixed with a U+002D HYPHEN-MINUS character (-).

유효한 정수는 십진수입니다.

A valid integer without a U+002D HYPHEN-MINUS (-) prefix represents the number that is represented in base ten by that string of digits. A valid integer with a U+002D HYPHEN-MINUS (-) prefix represents the number represented in base ten by the string of digits that follows the U+002D HYPHEN-MINUS, subtracted from zero.

The rules for parsing integers are similar to the rules for non-negative integers, and 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 whitespace.

  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 one of U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9), then return an error.

  8. Collect a sequence of characters in the range U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9), 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.5.4.3 실수

문자열이 다음으로만 구성되었다면 그것은 유효한 부동소수점 숫자입니다.

A string is a valid floating point number if it consists of:

  1. - 문자. 선택적입니다.

    Optionally, a U+002D HYPHEN-MINUS character (-).

  2. 하나 또는 그 이상의, 0부터 9까지의 숫자.

    A series of one or more characters in the range U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9).

  3. 선택적으로:

    Optionally:

    1. 마침표 문자(소수점)

      A single U+002E FULL STOP character (.).

    2. 하나 또는 그 이상의, 0부터 9까지의 숫자.

      A series of one or more characters in the range U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9).

  4. 선택적으로:

    Optionally:

    1. e, 또는 E

      Either a U+0065 LATIN SMALL LETTER E character (e) or a U+0045 LATIN CAPITAL LETTER E character (E).

    2. 선택적으로:- 또는 + 문자

      Optionally, a U+002D HYPHEN-MINUS character (-) or U+002B PLUS SIGN character (+).

    3. 하나 또는 그 이상의, 0부터 9까지의 숫자.

      A series of one or more characters in the range U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9).

유효한 부동소수점 숫자를 정의하고 있습니다만, 수학이 약해서 잘못된 번역을 할까 봐 그냥 둡니다.

A valid floating point number represents the number obtained by multiplying the significand by ten raised to the power of the exponent, where the significand is the first number, interpreted as base ten (including the decimal point and the number after the decimal point, if any, and interpreting the significand as a negative number if the whole string starts with a U+002D HYPHEN-MINUS character (-) and the number is not zero), and where the exponent is the number after the E, if any (interpreted as a negative number if there is a U+002D HYPHEN-MINUS character (-) between the E and the number and the number is not zero, or else ignoring a U+002B PLUS SIGN character (+) between the E and the number if there is one). If there is no E, then the exponent is treated as zero.

무한대의 값과 NaN 값은 유효한 부동소수점 숫자가 아닙니다. 역주

The Infinity and Not-a-Number (NaN) values are not valid floating point numbers.

The best representation of the number n as a floating point number is the string obtained from applying the JavaScript operator ToString to n. The JavaScript operator ToString is not uniquely determined. When there are multiple possible strings that could be obtained from the JavaScript operator 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 whitespace.

  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.
  9. If the character indicated by position is not one of U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9), then return an error.

  10. Collect a sequence of characters in the range U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9), and interpret the resulting sequence as a base-ten integer. Multiply value by that integer.

  11. If position is past the end of input, jump to the step labeled conversion.
  12. 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 one of U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9), then jump to the step labeled conversion.

    3. Fraction loop: Multiply divisor by ten.

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

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

    7. If the character indicated by position is one of U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9), jump back to the step labeled fraction loop in these substeps.

  13. 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), run these substeps:

    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 one of U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9), then jump to the step labeled conversion.

    5. Collect a sequence of characters in the range U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9), 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.

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

  15. 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.)

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

  17. Return rounded-value.

2.5.4.4 퍼센트와 길이

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 1.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 position be a pointer into input, initially pointing at the start of the string.

  3. Skip whitespace.

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

  5. If the character indicated by position is a U+002B PLUS SIGN character (+), advance position to the next character.

  6. Collect a sequence of characters that are U+0030 DIGIT ZERO (0) characters, and discard them.

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

  8. If the character indicated by position is not one of U+0031 DIGIT ONE (1) to U+0039 DIGIT NINE (9), then return an error.

  9. Collect a sequence of characters in the range U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9), and interpret the resulting sequence as a base-ten integer. Let value be that number.

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

  11. If the character indicated by position is a U+002E FULL STOP character (.):

    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 one of U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9), then return value as a length.

    3. Let divisor have the value 1.

    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 return value as a length.

    8. If the character indicated by position is one of U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9), return to the step labeled fraction loop in these substeps.

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

  13. If the character indicated by position is a U+0025 PERCENT SIGN character (%), return value as a percentage.

  14. Return value as a length.

2.5.4.5 정수 목록

유효한 정수 목록유효한 정수들이 콤마로 구분된 형태이며 다른 문자(예를 들어, 공백문자)는 허용되지 않습니다. 또한, 주어지는 정수 또는 그 범위에 제한이 있을 수 있습니다.

A valid list of integers is a number of valid integers separated by U+002C COMMA characters, with no other characters (e.g. no space characters). In addition, there might be restrictions on the number of integers that can be given, or on the range of values allowed.

The rules for parsing a list of integers 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 integers. This list will be the result of this algorithm.

  4. If there is a character in the string input at position position, and it is either a U+0020 SPACE, U+002C COMMA, or U+003B SEMICOLON character, then advance position to the next character in input, or to beyond the end of the string if there are no more characters.

  5. If position points to beyond the end of input, return numbers and abort.

  6. If the character in the string input at position position is a U+0020 SPACE, U+002C COMMA, or U+003B SEMICOLON character, then return to step 4.

  7. Let negated be false.

  8. Let value be 0.

  9. Let started be false. This variable is set to true when the parser sees a number or a U+002D HYPHEN-MINUS character (-).

  10. Let got number be false. This variable is set to true when the parser sees a number.

  11. Let finished be false. This variable is set to true to switch parser into a mode where it ignores characters until the next separator.

  12. Let bogus be false.

  13. Parser: If the character in the string input at position position is:

    A U+002D HYPHEN-MINUS character

    Follow these substeps:

    1. If got number is true, let finished be true.
    2. If finished is true, skip to the next step in the overall set of steps.
    3. If started is true, let negated be false.
    4. Otherwise, if started is false and if bogus is false, let negated be true.
    5. Let started be true.
    A character in the range U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9)

    Follow these substeps:

    1. If finished is true, skip to the next step in the overall set of steps.
    2. Multiply value by ten.
    3. Add the value of the digit, interpreted in base ten, to value.
    4. Let started be true.
    5. Let got number be true.
    A U+0020 SPACE character
    A U+002C COMMA character
    A U+003B SEMICOLON character

    Follow these substeps:

    1. If got number is false, return the numbers list and abort. This happens if an entry in the list has no digits, as in "1,2,x,4".
    2. If negated is true, then negate value.
    3. Append value to the numbers list.
    4. Jump to step 4 in the overall set of steps.
    A character in the range U+0001 to U+001F, U+0021 to U+002B, U+002D to U+002F, U+003A, U+003C to U+0040, U+005B to U+0060, U+007b to U+007F (i.e. any other non-alphabetic ASCII character)

    Follow these substeps:

    1. If got number is true, let finished be true.
    2. If finished is true, skip to the next step in the overall set of steps.
    3. Let negated be false.
    Any other character

    Follow these substeps:

    1. If finished is true, skip to the next step in the overall set of steps.
    2. Let negated be false.
    3. Let bogus be true.
    4. If started is true, then return the numbers list, and abort. (The value in value is not appended to the list first; it is dropped.)
  14. Advance position to the next character in input, or to beyond the end of the string if there are no more characters.

  15. If position points to a character (and not to beyond the end of input), jump to the big Parser step above.

  16. If negated is true, then negate value.

  17. If got number is true, then append value to the numbers list.

  18. Return the numbers list and abort.

2.5.4.6 크기 목록

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 a character in the range U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9), collect a sequence of characters in the range U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9), interpret the resulting sequence as an integer in base ten, and increment value by that integer.

    7. If the character at position is a U+002E FULL STOP character (.), run these substeps:

      1. Collect a sequence of characters consisting of space characters and characters in the range U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9). Let s be the resulting sequence.

      2. Remove all space characters in s.

      3. If s is not the empty string, run these subsubsteps:

        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 whitespace.

    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.5.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]

In the algorithms below, the number of days in month month of year year is: 31 if month is 1, 3, 5, 7, 8, 10, or 12; 30 if month is 4, 6, 9, or 11; 29 if month is 2 and year is a number divisible by 400, or if year is a number divisible by 4 but not by 100; and 28 otherwise. This takes into account leap years in the Gregorian calendar. [GREGORIAN]

이 섹션에서 정의하는 날짜와 시간의 문자에서 숫자는 0부터 9까지의 10진수입니다.

The digits in the date and time syntaxes defined in this section must be characters in the range U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9), used to express numbers in base ten.

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. Implementors 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]

2.5.5.1

은 타임존 정보를 포함하지 않고, 연월 앞에 날짜 정보를 포함하지 않는 그레고리안 단위입니다. [GREGORIAN]

A month consists of a specific proleptic Gregorian date with no time-zone information and no date information beyond a year and a month. [GREGORIAN]

문자열이 다음과 같은 요소로 순서에 맞게 구성된다면 그것은 yearmonth월을 나타내는 유효한 월 문자열입니다.

A string is a valid month string representing a year year and month month if it consists of the following components in the given order:

  1. year를 나타내는, 4 혹은 그 이상의 0보다 큰 숫자.

    Four or more digits, representing year, where year > 0

  2. - 문자.

    A U+002D HYPHEN-MINUS character (-)

  3. 1 이상이고 12 이하인, month를 나타내는 두개의 숫자.

    Two digits, representing the month month, in the range 1 ≤ month ≤ 12

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 characters in the range U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9). If the collected sequence is not at least four characters long, then fail. Otherwise, interpret the resulting sequence as a base-ten integer. Let that number be the year.

  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 characters in the range U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9). If the collected sequence is not exactly two characters long, then fail. Otherwise, interpret the resulting sequence as a base-ten integer. Let that number be the month.

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

  6. Return year and month.

2.5.5.2 날짜

날짜는 년, 월, 일로 구성되는, 타임존 정보를 포함하지 않는 그레고리안 단위입니다. [GREGORIAN]

A date consists of a specific proleptic Gregorian date with no time-zone information, consisting of a year, a month, and a day. [GREGORIAN]

문자열이 다음과 같은 요소로 순서에 맞게 구성된다면 그것은 yearmonthday일을 나타내는 유효한 날짜 문자열입니다.

A string is a valid date string representing a year year, month month, and day day if it consists of the following components in the given order:

  1. yearmonth월을 나타내는 유효한 월 문자열.

    A valid month string, representing year and month

  2. - 문자.

    A U+002D HYPHEN-MINUS character (-)

  3. 1보다 크고 maxday보다 작은, day를 나타내는 2자리 숫자. 여기에서 maxdayyearmonth 월이 포함하는 날짜의 개수입니다.

    Two digits, representing day, in the range 1 ≤ day ≤ maxday where maxday is the number of days in the month month and year year

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 characters in the range U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9). If the collected sequence is not exactly two characters long, then fail. Otherwise, interpret the resulting sequence as a base-ten integer. Let that number be the day.

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

  6. Return year, month, and day.

2.5.5.3 시간

시간은 시, 분, 초, 1초의 몇분의 일로 구성되는 타임존 없는 시간입니다.

A time consists of a specific time with no time-zone information, consisting of an hour, a minute, a second, and a fraction of a second.

유효한 시간 문자열hour시, minute분, second초가 다음의 순서로 구성된 형태입니다.

A string is a valid time string representing an hour hour, a minute minute, and a second second if it consists of the following components in the given order:

  1. 0 ≤ hour ≤ 23 범위의, 시간을 나타내는 2자리 숫자

    Two digits, representing hour, in the range 0 ≤ hour ≤ 23

  2. : 문자

    A U+003A COLON character (:)

  3. 0 ≤ minute ≤ 59 범위의, 분을 나타내는 2자리 숫자

    Two digits, representing minute, in the range 0 ≤ minute ≤ 59

  4. 선택적으로 (second값이 0이 아닌 경우에는 필요함):

    Optionally (required if second is non-zero):

    1. : 문자

      A U+003A COLON character (:)

    2. 0 ≤ minute ≤ 59 범위의, 초를 나타내는 2자리 숫자

      Two digits, representing the integer part of second, in the range 0 ≤ s ≤ 59

    3. 선택적으로 (second값이 정수가 아닌 경우에는 필요함):

      Optionally (required if second is not an integer):

      1. . 문자

        A 002E FULL STOP character (.)

      2. 초 아래를 나타내는 하나 혹은 그 이상의 숫자

        One or more digits, representing the fractional part of second

second 초를 나타내는 숫자는 60이나 61이 될수는 없습니다: 윤초는 나타낼 수 없습니다.

The second component cannot be 60 or 61; leap seconds cannot be represented.

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 characters in the range U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9). If the collected sequence is not exactly two characters long, then fail. Otherwise, interpret the resulting sequence as a base-ten integer. Let that number be the hour.

  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 characters in the range U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9). If the collected sequence is not exactly two characters long, then fail. Otherwise, interpret the resulting sequence as a base-ten integer. Let that number be the minute.

  5. If minute is not a number in the range 0 ≤ minute ≤ 59, then fail.
  6. Let second be a string with the value "0".

  7. If position is not beyond the end of input and the character at position is a U+003A COLON, then run these substeps:

    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 two characters both in the range U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9), then fail.

    3. Collect a sequence of characters that are either characters in the range U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9) or U+002E FULL STOP characters. If the collected sequence has more than one U+002E FULL STOP characters, or if the last character in the sequence is a U+002E FULL STOP character, then fail. Otherwise, let the collected string be second instead of its previous value.

  8. Interpret second as a base-ten number (possibly with a fractional part). Let second be that number instead of the string version.

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

  10. Return hour, minute, and second.

2.5.5.4 지역적 날짜와 시간

지역적 날짜와 시간 문자열은 년~초를 나타내는 그레고리안 단위입니다. 타임존 정보는 들어 있지 않습니다. 이 문자열은 유효한 날짜 문자열T유효한 시간 문자열의 형태, 즉 2010-07-31T17:05:15.013 으로서 2010년 7월 31일 오후5시 5분 15초, 13밀리초 를 나타냅니다. [GREGORIAN]

A local date and time consists of a specific proleptic Gregorian date, consisting of a year, a month, and a day, and a time, consisting of an hour, a minute, a second, and a fraction of a second, but expressed without a time zone. [GREGORIAN]

유효한 지역적 날짜와 시간 문자열은 날짜와 시간을 나타내며 다음과 같이 구성됩니다.

A string is a valid local date and time string representing a date and time if it consists of the following components in the given order:

  1. 날짜를 나타내는 유효한 날짜 문자열

    A valid date string representing the date.

  2. T 문자

    A U+0054 LATIN CAPITAL LETTER T character (T).

  3. 시간을 나타내는 유효한 시간 문자열

    A valid time string representing the time.

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 not a U+0054 LATIN CAPITAL LETTER T character (T) 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.5.5.5 국제적 날짜와 시간

국제적 날짜와 시간 문자열은 타임존 오프셋 정보를 포함합니다. 타임존 오프셋 정보는 Z로 UTC, 혹은 +/- 문자 뒤에 UTC 기준에서 더하거나 뺄 만큼의 시:분 문자열로 나타냅니다. [GREGORIAN]

A global date and time consists of a specific proleptic Gregorian date, consisting of a year, a month, and a day, and a time, consisting of an hour, a minute, a second, and a fraction of a second, expressed with a time-zone offset, consisting of a signed number of hours and minutes. [GREGORIAN]

유효한 국제적 날짜와 시간 문자열은 날짜, 시간, 타임존 오프셋을 나타내는 문자열이며 다음의 순서로 구성됩니다.

A string is a valid global date and time string representing a date, time, and a time-zone offset if it consists of the following components in the given order:

  1. 날짜를 나타내는 유효한 날짜 문자열

    A valid date string representing the date

  2. T 문자

    A U+0054 LATIN CAPITAL LETTER T character (T)

  3. 시간을 나타내는 유효한 시간 문자열

    A valid time string representing the time

  4. 다음 중 하나:

    Either:

이러한 포맷은 타임존 오프셋을 23시간 59분 만큼 허용합니다. 그러나, 실제로는, 실제 타임존은 -12:00 부터 +14:00 까지이며 오프셋에서의 분 정보는 항상 00, 30, 45중 하나입니다.

This format allows for time-zone offsets from -23:59 to +23:59. In practice, however, the range of offsets of actual time zones is -12:00 to +14:00, and the minutes component of offsets of actual time zones is always either 00, 30, or 45.

다음은 유효한 국제적 날짜와 시간 문자열 사례입니다.

The following are some examples of dates written as valid global date and time strings.

"0037-12-13T00:00Z"

네로(로마 황제)의 생일에 해당하는 미드나잇UTC 입니다. 이것이 정확히 어떤 날짜를 가리키는지는 아래에서 설명할 것입니다.

Midnight UTC on the birthday of Nero (the Roman Emperor). See below for further discussion on which date this actually corresponds to.

"1979-10-14T12:00:00.001-04:00"

1979년 10월 14일 정오에서 1 밀리 초 만큼 지난 시간입니다. 타임존은 미국 동부 해안에서 서머타임이 적용된 시간대입니다.

One millisecond after noon on October 14th 1979, in the time zone in use on the east coast of the USA during daylight saving time.

"8592-01-01T02:09+02:09"

8592년 1월 1일의 미드나잇 UTC 입니다. 타임존 정보는 2시간 9분 만큼 앞서 있습니다. 이러한 타임존은 현재로서는 사용하지 않는 타임존이지만, 당연히 허용되는 값입니다.

Midnight UTC on the 1st of January, 8592. The time zone associated with that time is two hours and nine minutes ahead of UTC, which is not currently a real time zone, but is nonetheless allowed.

이러한 날짜들에서 유념해둘 만한 몇 가지는 :

Several things are notable about these dates:

The best representation of the global date and time string datetime is the valid global date and time string representing datetime with the last character of the string not being a U+005A LATIN CAPITAL LETTER Z character (Z), even if the time zone is UTC, and with a U+002D HYPHEN-MINUS character (-) representing the sign of the time-zone offset when the time zone is UTC.

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 round tripping 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 not a U+0054 LATIN CAPITAL LETTER T character (T) 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.

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), then:

    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 (-), then:

    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 characters in the range U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9). If the collected sequence is not exactly two characters long, then fail. Otherwise, interpret the resulting sequence as a base-ten integer. Let that number be the timezonehours.

    4. If timezonehours is not a number in the range 0 ≤ timezonehours ≤ 23, then fail.
    5. If sign is "negative", then negate timezonehours.
    6. 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.

    7. Collect a sequence of characters in the range U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9). If the collected sequence is not exactly two characters long, then fail. Otherwise, interpret the resulting sequence as a base-ten integer. Let that number be the timezoneminutes.

    8. If timezoneminutes is not a number in the range 0 ≤ timezoneminutes ≤ 59, then fail.
    9. If sign is "negative", then negate timezoneminutes.

    Otherwise, fail.

  2. Return timezonehours and timezoneminutes.

2.5.5.6

는 주-년 숫자와 주 숫자로 구성됩니다. 주 숫자는 월요일부터 시작하는 7일간의 기간을 나타냅니다. 이러한 시스템에서 각각의 주-년은 52 또는 53개의 주 숫자를 포함하게 됩니다. 그러한 주 숫자는 그레고리력 1969년 12월 29일로부터 시작하여, 1970 주-년의 1주가 됩니다. 이어지는 주 들은 연속적으로 번호를 받게 됩니다. 어떤 주-년의 1주 앞의 주는 그 전 주-년의 마지막 주가 되며, 그 역도 마찬가지입니다. [GREGORIAN]

A week consists of a week-year number and a week number representing a seven-day period starting on a Monday. Each week-year in this calendaring system has either 52 or 53 such seven-day periods, as defined below. The seven-day period starting on the Gregorian date Monday December 29th 1969 (1969-12-29) is defined as week number 1 in week-year 1970. Consecutive weeks are numbered sequentially. The week before the number 1 week in a week-year is the last week in the previous week-year, and vice versa. [GREGORIAN]

이러한 개념이 잘 잡히지 않아, 잘못된 번역을 할 우려가 있어 옮기지 않습니다.

A week-year with a number year has 53 weeks if it corresponds to either a year year in the proleptic Gregorian calendar that has a Thursday as its first day (January 1st), or a year year in the proleptic Gregorian calendar that has a Wednesday as its first day (January 1st) and where year is a number divisible by 400, or a number divisible by 4 but not by 100. All other week-years have 52 weeks.

The week number of the last day of a week-year with 53 weeks is 53; the week number of the last day of a week-year with 52 weeks is 52.

The week-year number of a particular day can be different than the number of the year that contains that day in the proleptic Gregorian calendar. The first week in a week-year y is the week that contains the first Thursday of the Gregorian year y.

A string is a valid week string representing a week-year year and week week if it consists of the following components in the given order:

  1. Four or more digits, representing year, where year > 0
  2. A U+002D HYPHEN-MINUS character (-)
  3. A U+0057 LATIN CAPITAL LETTER W character (W)
  4. Two digits, representing the week week, in the range 1 ≤ week ≤ maxweek, where maxweek is the week number of the last day of week-year 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 characters in the range U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9). If the collected sequence is not at least four characters long, then fail. Otherwise, interpret the resulting sequence as a base-ten integer. Let that number be the year.

  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 characters in the range U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9). If the collected sequence is not exactly two characters long, then fail. Otherwise, interpret the resulting sequence as a base-ten integer. Let that number be the week.

  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.5.5.7 모호한 시간

문자열이 다음중 하나에 속한다면 그 문자열은 유효한 날짜 또는 시간 문자열입니다 :

A string is a valid date or time string if it is also one of the following:

문자열이 0개 혹은 그 이상의 공백문자로 시작해서, 유효한 날짜 또는 시간 문자열로 이어지고, 0개 혹은 그 이상의 공백문자로 종료된다면 그 문자열은 내용상 유효한 날짜 또는 시간 문자열입니다.

A string is a valid date or time string in content if it consists of zero or more White_Space characters, followed by a valid date or time string, followed by zero or more further White_Space characters.


문자열이 다음 중 하나에 속한다면 그 문자열은 선택적으로 시간정보를 갖는 유효한 날짜 문자열입니다:

A string is a valid date string with optional time if it is also one of the following:

선택적으로 시간정보를 갖는 유효한 날짜 문자열이 0개 이상의 공백문자로 둘러싸인 형태는 내용상 유효한, 선택적으로 시간정보를 갖는 유효한 날짜 문자열입니다.

A string is a valid date string in content with optional time if it consists of zero or more White_Space characters, followed by a valid date string with optional time, followed by zero or more further White_Space characters.


The rules to parse a date or time string are as follows. The algorithm is invoked with a flag indicating if the in attribute variant or the in content variant is to be used. 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. For the in content variant: skip White_Space characters.

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

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

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

  7. If date present is true, and position is not beyond the end of input, and the character at position is a U+0054 LATIN CAPITAL LETTER T character (T), 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 not a U+0054 LATIN CAPITAL LETTER T character (T), then set time present to false.

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

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

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

  10. 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.

  11. For the in content variant: skip White_Space characters.

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

  13. 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.5.6 색상

심플 컬러는 3개의, 0부터 255까지의 8비트 숫자들로 구성됩니다. 3개의 숫자는 각각 sRGB 컬러스페이스에서 붉은색, 녹색, 푸른색을 나타냅니다. [SRGB]

A simple color consists of three 8-bit numbers in the range 0..255, representing the red, green, and blue components of the color respectively, in the sRGB color space. [SRGB]

문자열이 정확히 7글자이고, 첫 글자가 # 이며, 남은 6개의 글자가 모두 0 ~ F로 구성되었다면 그 문자열은 유효한 심플 컬러입니다. 6개의 글자는 2자리를 묶어 16진수를 구성하고 각각 R, G, B 부분을 나타냅니다.

A string is a valid simple color if it is exactly seven characters long, and the first character is a U+0023 NUMBER SIGN character (#), and the remaining six characters are all in the range U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9), U+0041 LATIN CAPITAL LETTER A to U+0046 LATIN CAPITAL LETTER F, U+0061 LATIN SMALL LETTER A to U+0066 LATIN SMALL LETTER F, with the first two digits representing the red component, the middle two digits representing the green component, and the last two digits representing the blue component, in hexadecimal.

문자열이 유효한 심플 컬러이고 A~F를 포함하지 않는다면 그 문자열은 유효한 소문자 심플 컬러입니다.

A string is a valid lowercase simple color if it is a valid simple color and doesn't use any characters in the range U+0041 LATIN CAPITAL LETTER A to U+0046 LATIN CAPITAL LETTER F.

The rules for parsing simple color 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 simple color or an error.

  1. Let input be the string being parsed.

  2. If input is not exactly seven characters long, then return an error.

  3. If the first character in input is not a U+0023 NUMBER SIGN character (#), then return an error.

  4. If the last six characters of input are not all in the range U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9), U+0041 LATIN CAPITAL LETTER A to U+0046 LATIN CAPITAL LETTER F, U+0061 LATIN SMALL LETTER A to U+0066 LATIN SMALL LETTER F, then return an error.

  5. Let result be a simple color.

  6. Interpret the second and third characters as a hexadecimal number and let the result be the red component of result.

  7. Interpret the fourth and fifth characters as a hexadecimal number and let the result be the green component of result.

  8. Interpret the sixth and seventh characters as a hexadecimal number and let the result be the blue component of result.

  9. Return result.

The rules for serializing simple color values given a simple color are as given in the following algorithm:

  1. Let result be a string consisting of a single U+0023 NUMBER SIGN character (#).

  2. Convert the red, green, and blue components in turn to two-digit hexadecimal numbers using the digits U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9) and U+0061 LATIN SMALL LETTER A to U+0066 LATIN SMALL LETTER F, zero-padding if necessary, and append these numbers to result, in the order red, green, blue.

  3. Return result, which will be a valid lowercase simple color.


Some obsolete legacy attributes parse colors in a more complicated manner, using the rules for parsing a legacy color value, which are 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 simple color or an error.

  1. Let input be the string being parsed.

  2. If input is the empty string, then return an error.

  3. Let keyword be a string with the same value as input.

  4. Strip leading and trailing whitespace from keyword.

  5. If keyword is an ASCII case-insensitive match for the string "transparent", then return an error.

  6. If keyword is an ASCII case-insensitive match for one of the keywords listed in the SVG color keywords section of the CSS3 Color specification, then return the simple color corresponding to that keyword. [CSSCOLOR]

    CSS2 System Colors are not recognised.

  7. If input is four characters long, and the first character in input is a U+0023 NUMBER SIGN character (#), and the last three characters of input are all in the range U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9), U+0041 LATIN CAPITAL LETTER A to U+0046 LATIN CAPITAL LETTER F, and U+0061 LATIN SMALL LETTER A to U+0066 LATIN SMALL LETTER F, then run these substeps:

    1. Let result be a simple 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.

  8. Replace any characters in input that have a Unicode code point greater than U+FFFF (i.e. any characters that are not in the basic multilingual plane) with the two-character string "00".

  9. If input is longer than 128 characters, truncate input, leaving only the first 128 characters.

  10. If the first character in input is a U+0023 NUMBER SIGN character (#), remove it.

  11. Replace any character in input that is not in the range U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9), U+0041 LATIN CAPITAL LETTER A to U+0046 LATIN CAPITAL LETTER F, and U+0061 LATIN SMALL LETTER A to U+0066 LATIN SMALL LETTER F with the character U+0030 DIGIT ZERO (0).

  12. While input's length is zero or not a multiple of three, append a U+0030 DIGIT ZERO (0) character to input.

  13. Split input into three strings of equal length, to obtain three components. Let length be the length of those components (one third the length of input).

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

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

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

  17. Let result be a simple color.

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

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

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

  21. Return result.


2.5.7 공백문자로 구분된 토큰

공백문자로 구분된 토큰의 목록이란, 하나 또는 그 이상의 공백문자로 구분되는 0 또는 그 이상의 단어(토큰)들로 구성된 문자열입니다. 단어란 하나 또는 그 이상의 글자를 포함하며 공백문자는 포함하지 않는 문자열입니다. 역주

A set of space-separated tokens is a string containing zero or more words (known as tokens) separated by one or more space characters, where words consist of any string of one or more characters, none of which are space characters.

이러한 문자열은 앞뒤로 공백문자를 포함할 수 있습니다.

A string containing a set of space-separated tokens may have leading or trailing space characters.

공백문자로 구분되고 순서 없이 유일한 토큰의 목록이란, 공백문자로 구분된 토큰의 목록이면서 단어들 사이에 중복이 없는 문자열입니다.

An unordered set of unique space-separated tokens is a set of space-separated tokens where none of the tokens are duplicated.

공백문자로 구분되고 정렬된 유일한 토큰의 목록이란, 공백문자로 구분된 토큰의 목록이면서 그 사이에 중복이 없고, 토큰 사이의 순서에 의미가 있는 문자열입니다.

An ordered set of unique space-separated tokens is a set of space-separated tokens where none of the tokens are duplicated but where the order of the tokens is meaningful.

공백문자로 구분된 토큰의 목록은 허용된 값만 갖도록 정의된 때가 있습니다. 이렇게 허용된 값으로만 목록이 정의될 경우, 토큰들은 허용된 값의 목록에 속해야 하며, 다른 값은 요구사항에 맞지 않는 것입니다. 만약 그러한 허용된 값의 집합이 제공되지 않는다면, 어떤 값도 요구사항에 맞습니다.

Sets of space-separated tokens sometimes have a defined set of allowed values. When a set of allowed values is defined, the tokens must all be from that list of allowed values; other values are non-conforming. If no such set of allowed values is provided, then all values are conforming.

공백문자로 구분된 토큰의 목록에서 토큰이 비교(예를 들어, 대소문자를 구분하거나 그렇지 않거나)되는 방법은 각각의 목록에 따라 다릅니다.

How tokens in a set of space-separated tokens are to be compared (e.g. case-sensitively or not) is defined on a per-set basis.

When a user agent has to split a string on spaces, it must use the following algorithm:

  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 tokens be a list of tokens, initially empty.

  4. Skip whitespace

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

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

    2. Add the string collected in the previous step to tokens.

    3. Skip whitespace

  6. Return tokens.

When a user agent has to remove a token from a string, it must use the following algorithm:

  1. Let input be the string being modified.

  2. Let token be the token being removed. It will not contain any space characters.

  3. Let output be the output string, initially empty.

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

  5. Loop: If position is beyond the end of input, abort these steps.

  6. If the character at position is a space character:

    1. Append the character at position to the end of output.

    2. Advance position so it points at the next character in input.

    3. Return to the step labeled loop.

  7. Otherwise, the character at position is the first character of a token. Collect a sequence of characters that are not space characters, and let that be s.

  8. If s is exactly equal to token (this is a case-sensitive comparison), then:

    1. Skip whitespace (in input).

    2. Remove any space characters currently at the end of output.

    3. If position is not past the end of input, and output is not the empty string, append a single U+0020 SPACE character at the end of output.

  9. Otherwise, append s to the end of output.

  10. Return to the step labeled loop.

This causes any occurrences of the token to be removed from the string, and any spaces that were surrounding the token to be collapsed to a single space, except at the start and end of the string, where such spaces are removed.

2.5.8 콤마로 구분된 토큰

콤마(,)로 구분된 토큰의 목록이란, 콤마를 포함하지 않고 공백문자로 시작하거나 끝나지 않는 각각의 토큰들이 콤마로 구분되었고 전체 문자열의 앞뒤에는 공백문자를 허용하는 형태입니다.

A set of comma-separated tokens is a string containing zero or more tokens each separated from the next by a single U+002C COMMA character (,), where tokens consist of any string of zero or more characters, neither beginning nor ending with space characters, nor containing any U+002C COMMA characters (,), and optionally surrounded by space characters.

예를 들어, " a ,b,,d d " 이란 문자열은 4개의 단위를 포함합니다. 각각의 단위는 "a", "b", 빈 문자열, "d d" 입니다. 각각의 토큰에서 둘러싼 공백문자는 토큰에 포함되지 않으며, 빈 문자열 역시 하나의 단위로 인식됩니다. 역주

For instance, the string " a ,b,,d d " consists of four tokens: "a", "b", the empty string, and "d d". Leading and trailing whitespace around each token doesn't count as part of the token, and the empty string can be a token.

이러한 목록은 토큰에 좀더 제한이 가해지는 경우가 있습니다. 그러한 제한이 정의되어 있을 경우, 모든 토큰은 그러한 제한사항에 맞아야 하며 그렇지 않은 값은 요구사항에 맞지 않는 것입니다.

Sets of comma-separated tokens sometimes have further restrictions on what consists a valid token. When such restrictions are defined, the tokens must all fit within those restrictions; other values are non-conforming. If no such restrictions are specified, then all values are conforming.

When a user agent has to split a string on commas, it must use the following algorithm:

  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 tokens be a list of tokens, initially empty.

  4. Token: If position is past the end of input, jump to the last step.

  5. Collect a sequence of characters that are not U+002C COMMA characters (,). Let s be the resulting sequence (which might be the empty string).

  6. Remove any leading or trailing sequence of space characters from s.

  7. Add s to tokens.

  8. If position is not past the end of input, then the character at position is a U+002C COMMA character (,); advance position past that character.

  9. Jump back to the step labeled token.

  10. Return tokens.

2.5.9 참조

type 타입의 요소에 대한 유효한 해시명 참조란, 그러한 요소의 name 속성의 값 앞에 #가 붙은 문자열입니다.

A valid hash-name reference to an element of type type is a string consisting of a U+0023 NUMBER SIGN character (#) followed by a string which exactly matches the value of the name attribute of an element with type type in the document.

The rules for parsing a hash-name reference to an element of type type 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 and abort these steps.

  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 that has an id attribute whose value is a case-sensitive match for s or a name attribute whose value is a compatibility caseless match for s.

2.5.10 미디어 쿼리

문자열이 미디어 쿼리 명세의 media_query_list에 대응한다면 그것은 유효한 미디어 쿼리입니다. [MQ]

A string is a valid media query if it matches the media_query_list production of the Media Queries specification. [MQ]

빈 문자열과 공백문자만으로 구성된 문자열, 미디어 쿼리 명세에서 정의된 사용자의 환경에 걸맞는 미디어 쿼리 문자열은 사용자의 환경에 대응하는 문자열입니다. [MQ]

A string matches the environment of the user if it is the empty string, a string consisting of only space characters, or is a media query that matches the user's environment according to the definitions given in the Media Queries specification. [MQ]

Infinity는 자바스크립트에서 무한대를 나타내는 표현이며, NaN은 Not a Number, 즉 숫자가 아님을 나타내는 표현입니다. 뒤의 것은 문자열에 숫자를 곱하려고 했다거나 하는 경우에 반환됩니다. 돌아가기

토큰token은 최소한의 의미 단위를 말합니다. 돌아가기

분리된 목록 중 첫 번째 것에서 앞뒤의 공백이, 마지막 것에서 뒤의 공백이 삭제되었음을 눈여겨보십시오. 돌아가기