Annex B (normative) 웹 브라우저를 위한 추가 ECMAScript 기능

이 annex에서 정의되는 ECMAScript language syntax와 semantics는 ECMAScript host가 web browser일 때 요구됩니다. 이 annex의 내용은 normative이지만 ECMAScript host가 web browser가 아닌 경우 optional입니다.

이 annex에서 정의되는 일부 기능은 이 annex에 specified되며, 일부는 이 문서의 main body에 specified됩니다.

기능이 main body에 specified되는 경우, 그것이 문서에 영향을 주는 각 지점은 coloured box 안의 “Normative Optional”이라는 단어로 표시됩니다. 또한 그 기능이 algorithm이나 early error rule에서 특정 wording을 수반하는 경우, 이는 relevant feature를 “the host supports”한다는 condition으로 guarded됩니다. Web browsers는 이러한 모든 기능을 support해야 합니다.

Note

이 annex는 web browser ECMAScript hosts의 다양한 legacy features와 기타 characteristics를 설명합니다. 이 annex에 specified된 모든 language features와 behaviours는 하나 이상의 바람직하지 않은 characteristics를 가지고 있으며 legacy usage가 없다면 이 specification에서 제거될 것입니다. 그러나 많은 기존 web pages가 이러한 features를 사용하기 때문에 web browsers는 계속 이를 support해야 합니다. 이 annex의 specifications는 이러한 legacy features의 interoperable implementations에 대한 requirements를 정의합니다.

이러한 features는 core ECMAScript language의 일부로 간주되지 않습니다. Programmers는 새로운 ECMAScript code를 작성할 때 이러한 features와 behaviours의 존재를 사용하거나 가정해서는 안 됩니다. ECMAScript implementations는 implementation이 web browser의 일부이거나 web browsers가 마주치는 동일한 legacy ECMAScript code를 실행해야 하는 경우가 아니면 이러한 features를 implement하지 않는 것이 권장됩니다.

B.1 추가 구문

B.1.1 HTML-like Comments

12.4의 syntax와 semantics는 다음과 같이 extended됩니다. 단, 이 extension은 goal symbol Module을 사용하여 source text를 parsing할 때는 allowed되지 않습니다:

Syntax

InputElementHashbangOrRegExp :: WhiteSpace LineTerminator Comment CommonToken HashbangComment RegularExpressionLiteral HTMLCloseComment Comment :: MultiLineComment SingleLineComment SingleLineHTMLOpenComment SingleLineHTMLCloseComment SingleLineDelimitedComment MultiLineComment :: /* FirstCommentLineopt LineTerminator MultiLineCommentCharsopt */ HTMLCloseCommentopt FirstCommentLine :: SingleLineDelimitedCommentChars SingleLineHTMLOpenComment :: <!-- SingleLineCommentCharsopt SingleLineHTMLCloseComment :: LineTerminatorSequence HTMLCloseComment SingleLineDelimitedComment :: /* SingleLineDelimitedCommentCharsopt */ HTMLCloseComment :: WhiteSpaceSequenceopt SingleLineDelimitedCommentSequenceopt --> SingleLineCommentCharsopt SingleLineDelimitedCommentChars :: SingleLineNotAsteriskChar SingleLineDelimitedCommentCharsopt * SingleLinePostAsteriskCommentCharsopt SingleLineNotAsteriskChar :: SourceCharacter but not one of * or LineTerminator SingleLinePostAsteriskCommentChars :: SingleLineNotForwardSlashOrAsteriskChar SingleLineDelimitedCommentCharsopt * SingleLinePostAsteriskCommentCharsopt SingleLineNotForwardSlashOrAsteriskChar :: SourceCharacter but not one of / or * or LineTerminator WhiteSpaceSequence :: WhiteSpace WhiteSpaceSequenceopt SingleLineDelimitedCommentSequence :: SingleLineDelimitedComment WhiteSpaceSequenceopt SingleLineDelimitedCommentSequenceopt

line terminator code point를 포함하는 MultiLineComment와 유사하게, SingleLineHTMLCloseComment는 syntactic grammar에 의한 parsing purposes에서 LineTerminator로 간주됩니다.

B.1.2 Regular Expressions Patterns

22.2.1의 syntax는 다음과 같이 modified되고 extended됩니다. 이러한 changes는 grammar productions의 ordering과 contextual information에 의해 resolved되는 ambiguities를 도입합니다. 다음 grammar를 사용하여 parsing할 때, 각 alternative는 previous production alternatives가 match하지 않는 경우에만 considered됩니다.

이 alternative pattern grammar와 semantics는 BMP patterns의 syntax와 semantics만 변경합니다. 다음 grammar extensions는 [UnicodeMode] parameter로 parameterized된 productions를 포함합니다. 그러나 이러한 extensions 중 어느 것도 [UnicodeMode] parameter가 goal symbol에 present한 상태로 parsing할 때 recognized되는 Unicode patterns의 syntax를 변경하지 않습니다.

Syntax

Term[UnicodeMode, UnicodeSetsMode, NamedCaptureGroups] :: [+UnicodeMode] Assertion[+UnicodeMode, ?UnicodeSetsMode, ?NamedCaptureGroups] [+UnicodeMode] Atom[+UnicodeMode, ?UnicodeSetsMode, ?NamedCaptureGroups] Quantifier [+UnicodeMode] Atom[+UnicodeMode, ?UnicodeSetsMode, ?NamedCaptureGroups] [~UnicodeMode] QuantifiableAssertion[?NamedCaptureGroups] Quantifier [~UnicodeMode] Assertion[~UnicodeMode, ~UnicodeSetsMode, ?NamedCaptureGroups] [~UnicodeMode] ExtendedAtom[?NamedCaptureGroups] Quantifier [~UnicodeMode] ExtendedAtom[?NamedCaptureGroups] Assertion[UnicodeMode, UnicodeSetsMode, NamedCaptureGroups] :: ^ $ \b \B [+UnicodeMode] (?= Disjunction[+UnicodeMode, ?UnicodeSetsMode, ?NamedCaptureGroups] ) [+UnicodeMode] (?! Disjunction[+UnicodeMode, ?UnicodeSetsMode, ?NamedCaptureGroups] ) [~UnicodeMode] QuantifiableAssertion[?NamedCaptureGroups] (?<= Disjunction[?UnicodeMode, ?UnicodeSetsMode, ?NamedCaptureGroups] ) (?<! Disjunction[?UnicodeMode, ?UnicodeSetsMode, ?NamedCaptureGroups] ) QuantifiableAssertion[NamedCaptureGroups] :: (?= Disjunction[~UnicodeMode, ~UnicodeSetsMode, ?NamedCaptureGroups] ) (?! Disjunction[~UnicodeMode, ~UnicodeSetsMode, ?NamedCaptureGroups] ) ExtendedAtom[NamedCaptureGroups] :: . \ AtomEscape[~UnicodeMode, ?NamedCaptureGroups] \ [lookahead = c] CharacterClass[~UnicodeMode, ~UnicodeSetsMode] ( GroupSpecifier[~UnicodeMode]opt Disjunction[~UnicodeMode, ~UnicodeSetsMode, ?NamedCaptureGroups] ) (? RegularExpressionModifiers : Disjunction[~UnicodeMode, ~UnicodeSetsMode, ?NamedCaptureGroups] ) (? RegularExpressionModifiers - RegularExpressionModifiers : Disjunction[~UnicodeMode, ~UnicodeSetsMode, ?NamedCaptureGroups] ) InvalidBracedQuantifier ExtendedPatternCharacter InvalidBracedQuantifier :: { DecimalDigits[~Sep] } { DecimalDigits[~Sep] ,} { DecimalDigits[~Sep] , DecimalDigits[~Sep] } ExtendedPatternCharacter :: SourceCharacter but not one of ^ $ \ . * + ? ( ) [ | AtomEscape[UnicodeMode, NamedCaptureGroups] :: [+UnicodeMode] DecimalEscape [~UnicodeMode] DecimalEscape but only if the CapturingGroupNumber of DecimalEscape is ≤ CountLeftCapturingParensWithin(the Pattern containing DecimalEscape) CharacterClassEscape[?UnicodeMode] CharacterEscape[?UnicodeMode, ?NamedCaptureGroups] [+NamedCaptureGroups] k GroupName[?UnicodeMode] CharacterEscape[UnicodeMode, NamedCaptureGroups] :: ControlEscape c AsciiLetter 0 [lookahead ∉ DecimalDigit] HexEscapeSequence RegExpUnicodeEscapeSequence[?UnicodeMode] [~UnicodeMode] LegacyOctalEscapeSequence IdentityEscape[?UnicodeMode, ?NamedCaptureGroups] IdentityEscape[UnicodeMode, NamedCaptureGroups] :: [+UnicodeMode] SyntaxCharacter [+UnicodeMode] / [~UnicodeMode] SourceCharacterIdentityEscape[?NamedCaptureGroups] SourceCharacterIdentityEscape[NamedCaptureGroups] :: [~NamedCaptureGroups] SourceCharacter but not c [+NamedCaptureGroups] SourceCharacter but not one of c or k ClassAtomNoDash[UnicodeMode, NamedCaptureGroups] :: SourceCharacter but not one of \ or ] or - \ ClassEscape[?UnicodeMode, ?NamedCaptureGroups] \ [lookahead = c] ClassEscape[UnicodeMode, NamedCaptureGroups] :: b [+UnicodeMode] - [~UnicodeMode] c ClassControlLetter CharacterClassEscape[?UnicodeMode] CharacterEscape[?UnicodeMode, ?NamedCaptureGroups] ClassControlLetter :: DecimalDigit _ Note

동일한 left-hand sides가 [+UnicodeMode]와 [~UnicodeMode] guards 모두와 함께 발생하는 경우 이는 disambiguation priority를 control하기 위한 것입니다.

B.1.2.1 Static Semantics: Early Errors

22.2.1.1의 semantics는 다음과 같이 extended됩니다:

ExtendedAtom :: InvalidBracedQuantifier
  • 이 production에 의해 match되는 source text가 있으면 Syntax Error입니다.

Additionally, 다음 productions에 대한 rules는 highlighted text의 addition으로 modified됩니다:

NonemptyClassRanges :: ClassAtom - ClassAtom ClassContents NonemptyClassRangesNoDash :: ClassAtomNoDash - ClassAtom ClassContents

B.1.2.2 Static Semantics: CountLeftCapturingParensWithin and CountLeftCapturingParensBefore

CountLeftCapturingParensWithinCountLeftCapturingParensBefore의 definitions에서, “ Atom :: ( GroupSpecifieropt Disjunction ) ”에 대한 references는 “ Atom :: ( GroupSpecifieropt Disjunction ) ” 또는 “ ExtendedAtom :: ( GroupSpecifieropt Disjunction ) ”를 의미하는 것으로 interpreted되어야 합니다.

B.1.2.3 Static Semantics: IsCharacterClass

22.2.1.6의 semantics는 다음과 같이 extended됩니다:

ClassAtomNoDash :: \ [lookahead = c]
  1. false를 반환한다.

B.1.2.4 Static Semantics: CharacterValue

22.2.1.7의 semantics는 다음과 같이 extended됩니다:

ClassAtomNoDash :: \ [lookahead = c]
  1. U+005C (REVERSE SOLIDUS)의 numeric value를 반환한다.
ClassEscape :: c ClassControlLetter
  1. codePointClassControlLetter와 match된 code point로 둔다.
  2. icodePoint의 numeric value로 둔다.
  3. i를 32로 나눈 remainder를 반환한다.
CharacterEscape :: LegacyOctalEscapeSequence
  1. LegacyOctalEscapeSequence의 MV를 반환한다(12.9.4.3 참조).

B.1.2.5 Runtime Semantics: CompileSubpattern

CompileSubpattern의 semantics는 다음과 같이 extended됩니다:

Term :: QuantifiableAssertion Quantifier 에 대한 rule은 Term :: Atom Quantifier 와 동일하지만 Atom 대신 QuantifiableAssertion이 substituted됩니다.

Term :: ExtendedAtom Quantifier 에 대한 rule은 Term :: Atom Quantifier 와 동일하지만 Atom 대신 ExtendedAtom이 substituted됩니다.

Term :: ExtendedAtom 에 대한 rule은 Term :: Atom 와 동일하지만 Atom 대신 ExtendedAtom이 substituted됩니다.

B.1.2.6 Runtime Semantics: CompileAssertion

Assertion :: (?= Disjunction ) Assertion :: (?! Disjunction ) productions에 대한 CompileAssertion rules는 QuantifiableAssertion productions에도 사용되지만, Assertion 대신 QuantifiableAssertion이 substituted됩니다.

B.1.2.7 Runtime Semantics: CompileAtom

Atom :: PatternCharacter 를 제외한 Atom productions에 대한 CompileAtom rules는 ExtendedAtom productions에도 사용되지만, Atom 대신 ExtendedAtom이 substituted됩니다. parameter direction을 가지는 다음 rules도 added됩니다:

ExtendedAtom :: \ [lookahead = c]
  1. charSet를 single character \ U+005C (REVERSE SOLIDUS)를 포함하는 CharSet으로 둔다.
  2. CharacterSetMatcher(regexpRecord, charSet, false, direction)를 반환한다.
ExtendedAtom :: ExtendedPatternCharacter
  1. charExtendedPatternCharacter가 represented하는 character로 둔다.
  2. charSet를 character char를 포함하는 one-element CharSet으로 둔다.
  3. CharacterSetMatcher(regexpRecord, charSet, false, direction)를 반환한다.

B.1.2.8 Runtime Semantics: CompileToCharSet

22.2.2.9의 semantics는 다음과 같이 extended됩니다:

다음 두 rules는 CompileToCharSet의 corresponding rules를 replace합니다.

NonemptyClassRanges :: ClassAtom - ClassAtom ClassContents
  1. charSet를 argument regexpRecord를 사용한 첫 번째 ClassAtomCompileToCharSet으로 둔다.
  2. otherSet를 argument regexpRecord를 사용한 두 번째 ClassAtomCompileToCharSet으로 둔다.
  3. remainingSet를 argument regexpRecord를 사용한 ClassContentsCompileToCharSet으로 둔다.
  4. rangeSetCharacterRangeOrUnion(regexpRecord, charSet, otherSet)로 둔다.
  5. rangeSetremainingSet의 union을 반환한다.
NonemptyClassRangesNoDash :: ClassAtomNoDash - ClassAtom ClassContents
  1. charSet를 argument regexpRecord를 사용한 ClassAtomNoDashCompileToCharSet으로 둔다.
  2. otherSet를 argument regexpRecord를 사용한 ClassAtomCompileToCharSet으로 둔다.
  3. remainingSet를 argument regexpRecord를 사용한 ClassContentsCompileToCharSet으로 둔다.
  4. rangeSetCharacterRangeOrUnion(regexpRecord, charSet, otherSet)로 둔다.
  5. rangeSetremainingSet의 union을 반환한다.

또한 다음 rules가 CompileToCharSet에 added됩니다.

ClassEscape :: c ClassControlLetter
  1. charValue를 이 ClassEscapeCharacterValue로 둔다.
  2. char를 character value가 charValue인 character로 둔다.
  3. single character char를 포함하는 CharSet을 반환한다.
ClassAtomNoDash :: \ [lookahead = c]
  1. single character \ U+005C (REVERSE SOLIDUS)를 포함하는 CharSet을 반환한다.
Note
이 production은 character class 내에서 sequence \c 뒤에 acceptable control character가 따르지 않는 경우에만 reached될 수 있습니다.

B.1.2.8.1 CharacterRangeOrUnion ( regexpRecord, charSet, otherSet )

The abstract operation CharacterRangeOrUnion takes arguments regexpRecord (a RegExp Record), charSet (a CharSet), and otherSet (a CharSet) and returns a CharSet. It performs the following steps when called:

  1. HasEitherUnicodeFlag(regexpRecord)가 false이면, 다음을 수행한다.
    1. charSet이 정확히 one character를 포함하지 않거나 otherSet이 정확히 one character를 포함하지 않으면, 다음을 수행한다.
      1. remainingSet를 single character - U+002D (HYPHEN-MINUS)를 포함하는 CharSet으로 둔다.
      2. CharSets charSet, otherSetremainingSet의 union을 반환한다.
  2. CharacterRange(charSet, otherSet)를 반환한다.

B.1.2.9 Static Semantics: ParsePattern ( patternText, u, v )

22.2.3.4의 semantics는 다음과 같이 extended됩니다:

abstract operation ParsePattern은 arguments patternText (Unicode code points의 sequence), u (a Boolean), 및 v (a Boolean)를 받습니다. called될 때 다음 steps를 수행합니다:

  1. vtrue이고 utrue이면, 다음을 수행한다.
    1. parseResult를 하나 이상의 SyntaxError objects를 포함하는 List로 둔다.
  2. Else if vtrue이면, 다음을 수행한다.
    1. parseResultParseText(patternText, Pattern[+UnicodeMode, +UnicodeSetsMode, +NamedCaptureGroups])로 둔다.
  3. Else if utrue이면, 다음을 수행한다.
    1. parseResultParseText(patternText, Pattern[+UnicodeMode, ~UnicodeSetsMode, +NamedCaptureGroups])로 둔다.
  4. Else,
    1. parseResultParseText(patternText, Pattern[~UnicodeMode, ~UnicodeSetsMode, ~NamedCaptureGroups])로 둔다.
    2. parseResultParse Node이고 parseResultGroupName을 포함하면, 다음을 수행한다.
      1. parseResultParseText(patternText, Pattern[~UnicodeMode, ~UnicodeSetsMode, +NamedCaptureGroups])로 설정한다.
  5. parseResult를 반환한다.

B.2 추가 Built-in Properties

ECMAScript host가 web browser일 때 standard built-in objects의 다음 additional properties가 defined됩니다.

B.2.1 Global Object의 추가 Properties

Table 103의 entries가 Table 6에 added됩니다.

Table 103: 추가 Well-known Intrinsic Objects
Intrinsic Name Global Name ECMAScript Language Association
%escape% "escape" escape function (B.2.1.1)
%unescape% "unescape" unescape function (B.2.1.2)

B.2.1.1 escape ( string )

이 function은 global object의 property입니다. 특정 code units가 hexadecimal escape sequence로 replaced된 String value의 새 version을 computes합니다.

numeric value가 0x00FF 이하인 code unit을 replacing할 때는 %xx form의 two-digit escape sequence가 사용됩니다. numeric value가 0x00FF보다 strictly greater한 code unit을 replacing할 때는 %uxxxx form의 four-digit escape sequence가 사용됩니다.

이는 %escape% intrinsic object입니다.

called될 때 다음 steps를 수행합니다:

  1. string을 ? ToString(string)으로 설정한다.
  2. lengthstring의 length로 둔다.
  3. result를 empty String으로 둔다.
  4. unescapedSetASCII word characters"@*+-./"string-concatenation으로 둔다.
  5. k를 0으로 둔다.
  6. k < length인 동안 반복한다.
    1. codeUnitstring 내 index k에 있는 code unit으로 둔다.
    2. unescapedSetcodeUnit을 포함하면, 다음을 수행한다.
      1. nextPartcodeUnit으로 둔다.
    3. Else,
      1. codeUnitNumbercodeUnit의 numeric value로 둔다.
      2. codeUnitNumber < 256이면, 다음을 수행한다.
        1. hex를 uppercase hexadecimal number로 formatted된 codeUnitNumber의 String representation으로 둔다.
        2. nextPart"%"StringPad(hex, 2, "0", start)의 string-concatenation으로 둔다.
      3. Else,
        1. hex를 uppercase hexadecimal number로 formatted된 codeUnitNumber의 String representation으로 둔다.
        2. nextPart"%u"StringPad(hex, 4, "0", start)의 string-concatenation으로 둔다.
    4. resultresultnextPartstring-concatenation으로 설정한다.
    5. kk + 1로 설정한다.
  7. result를 반환한다.
Note

encoding은 RFC 1738에 described된 encoding에 부분적으로 based되지만, 이 standard에 specified된 전체 encoding은 RFC 1738의 contents와 무관하게 위에 described되어 있습니다. 이 encoding은 RFC 3986에 의해 RFC 1738에 이루어진 changes를 reflect하지 않습니다.

B.2.1.2 unescape ( string )

이 function은 global object의 property입니다. escape function에 의해 introduced될 수 있는 sort의 각 escape sequence가 그것이 represents하는 code unit으로 replaced된 String value의 새 version을 computes합니다.

이는 %unescape% intrinsic object입니다.

called될 때 다음 steps를 수행합니다:

  1. string을 ? ToString(string)으로 설정한다.
  2. lengthstring의 length로 둔다.
  3. result를 empty String으로 둔다.
  4. k를 0으로 둔다.
  5. k < length인 동안 반복한다.
    1. codeUnitstring 내 index k에 있는 code unit으로 둔다.
    2. codeUnit이 code unit 0x0025 (PERCENT SIGN)이면, 다음을 수행한다.
      1. hexDigits를 empty String으로 둔다.
      2. optionalAdvance를 0으로 둔다.
      3. k + 5 < length이고 string 내 index k + 1에 있는 code unit이 code unit 0x0075 (LATIN SMALL LETTER U)이면, 다음을 수행한다.
        1. hexDigitsstringsubstring from k + 2 to k + 6으로 설정한다.
        2. optionalAdvance를 5로 설정한다.
      4. Else if k + 3 ≤ length이면, 다음을 수행한다.
        1. hexDigitsstringsubstring from k + 1 to k + 3으로 설정한다.
        2. optionalAdvance를 2로 설정한다.
      5. parseResultParseText(hexDigits, HexDigits[~Sep])로 둔다.
      6. parseResultParse Node이면, 다음을 수행한다.
        1. codeUnitNumberparseResult의 MV로 둔다.
        2. codeUnit을 numeric value가 codeUnitNumber인 code unit으로 설정한다.
        3. kk + optionalAdvance로 설정한다.
    3. resultresultcodeUnitstring-concatenation으로 설정한다.
    4. kk + 1로 설정한다.
  6. result를 반환한다.

B.2.2 String.prototype Object의 추가 Properties

B.2.2.1 String.prototype.substr ( start, length )

이 method는 this value를 String으로 converting한 결과의 substring을 반환하며, index start에서 시작하여 length code units만큼 이어집니다(lengthundefined이면 String의 end까지). start가 negative이면, sourceLength가 String의 length일 때 sourceLength + start로 treated됩니다. 결과는 String object가 아니라 String value입니다.

called될 때 다음 steps를 수행합니다:

  1. objthis value로 둔다.
  2. RequireObjectCoercible(obj)를 수행한다.
  3. string을 ? ToString(obj)로 둔다.
  4. sizestring의 length로 둔다.
  5. intStart를 ? ToIntegerOrInfinity(start)로 둔다.
  6. intStart = -∞이면, intStart를 0으로 설정한다.
  7. Else if intStart < 0이면, intStartmax(size + intStart, 0)으로 설정한다.
  8. Else, intStartmin(intStart, size)로 설정한다.
  9. lengthundefined이면 intLengthsize로 둔다; 그렇지 않으면 intLength를 ? ToIntegerOrInfinity(length)로 둔다.
  10. intLength를 0과 size 사이로 clamping한 result로 설정한다.
  11. intEndmin(intStart + intLength, size)로 둔다.
  12. stringsubstring from intStart to intEnd를 반환한다.
Note

이 method는 intentionally generic합니다; this value가 String object일 것을 require하지 않습니다. 따라서 method로 사용하기 위해 다른 kinds of objects로 transferred될 수 있습니다.

B.2.2.2 String.prototype.anchor ( name )

이 method는 called될 때 다음 steps를 수행합니다:

  1. stringthis value로 둔다.
  2. CreateHTML(string, "a", "name", name)를 반환한다.

B.2.2.2.1 CreateHTML ( contents, tag, attr, attrValue )

The abstract operation CreateHTML takes arguments contents (an ECMAScript language value), tag (a String), attr (a String), and attrValue (an ECMAScript language value) and returns either a normal completion containing a String or a throw completion. It performs the following steps when called:

  1. RequireObjectCoercible(contents)를 수행한다.
  2. contentsString을 ? ToString(contents)으로 둔다.
  3. part1"<"tagstring-concatenation으로 둔다.
  4. attr이 empty String이 아니면, 다음을 수행한다.
    1. attrValueString을 ? ToString(attrValue)로 둔다.
    2. escapedAttrValueattrValueString과 같지만 attrValueString 내 code unit 0x0022 (QUOTATION MARK)의 각 occurrence가 six code unit sequence "&quot;"로 replaced된 String value로 둔다.
    3. part1을 다음의 string-concatenation으로 설정한다:
      • part1
      • code unit 0x0020 (SPACE)
      • attr
      • code unit 0x003D (EQUALS SIGN)
      • code unit 0x0022 (QUOTATION MARK)
      • escapedAttrValue
      • code unit 0x0022 (QUOTATION MARK)
  5. part2part1">"string-concatenation으로 둔다.
  6. part3part2contentsStringstring-concatenation으로 둔다.
  7. part4part3, "</", tag, 및 ">"string-concatenation으로 둔다.
  8. part4를 반환한다.

B.2.2.3 String.prototype.big ( )

이 method는 called될 때 다음 steps를 수행합니다:

  1. stringthis value로 둔다.
  2. CreateHTML(string, "big", "", "")를 반환한다.

B.2.2.4 String.prototype.blink ( )

이 method는 called될 때 다음 steps를 수행합니다:

  1. stringthis value로 둔다.
  2. CreateHTML(string, "blink", "", "")를 반환한다.

B.2.2.5 String.prototype.bold ( )

이 method는 called될 때 다음 steps를 수행합니다:

  1. stringthis value로 둔다.
  2. CreateHTML(string, "b", "", "")를 반환한다.

B.2.2.6 String.prototype.fixed ( )

이 method는 called될 때 다음 steps를 수행합니다:

  1. stringthis value로 둔다.
  2. CreateHTML(string, "tt", "", "")를 반환한다.

B.2.2.7 String.prototype.fontcolor ( colour )

이 method는 called될 때 다음 steps를 수행합니다:

  1. stringthis value로 둔다.
  2. CreateHTML(string, "font", "color", colour)를 반환한다.

B.2.2.8 String.prototype.fontsize ( size )

이 method는 called될 때 다음 steps를 수행합니다:

  1. stringthis value로 둔다.
  2. CreateHTML(string, "font", "size", size)를 반환한다.

B.2.2.9 String.prototype.italics ( )

이 method는 called될 때 다음 steps를 수행합니다:

  1. stringthis value로 둔다.
  2. CreateHTML(string, "i", "", "")를 반환한다.

B.2.2.10 String.prototype.link ( url )

이 method는 called될 때 다음 steps를 수행합니다:

  1. stringthis value로 둔다.
  2. CreateHTML(string, "a", "href", url)를 반환한다.

B.2.2.11 String.prototype.small ( )

이 method는 called될 때 다음 steps를 수행합니다:

  1. stringthis value로 둔다.
  2. CreateHTML(string, "small", "", "")를 반환한다.

B.2.2.12 String.prototype.strike ( )

이 method는 called될 때 다음 steps를 수행합니다:

  1. stringthis value로 둔다.
  2. CreateHTML(string, "strike", "", "")를 반환한다.

B.2.2.13 String.prototype.sub ( )

이 method는 called될 때 다음 steps를 수행합니다:

  1. stringthis value로 둔다.
  2. CreateHTML(string, "sub", "", "")를 반환한다.

B.2.2.14 String.prototype.sup ( )

이 method는 called될 때 다음 steps를 수행합니다:

  1. stringthis value로 둔다.
  2. CreateHTML(string, "sup", "", "")를 반환한다.

B.2.2.15 String.prototype.trimLeft ( )

Note

property "trimStart"가 preferred됩니다. "trimLeft" property는 principally old code와의 compatibility를 위해 provided됩니다. 새로운 ECMAScript code에서는 "trimStart" property를 사용하는 것이 recommended됩니다.

"trimLeft" property의 initial value는 22.1.3.34에서 defined된 %String.prototype.trimStart%입니다.

B.2.2.16 String.prototype.trimRight ( )

Note

property "trimEnd"가 preferred됩니다. "trimRight" property는 principally old code와의 compatibility를 위해 provided됩니다. 새로운 ECMAScript code에서는 "trimEnd" property를 사용하는 것이 recommended됩니다.

"trimRight" property의 initial value는 22.1.3.33에서 defined된 %String.prototype.trimEnd%입니다.

B.2.3 Date.prototype Object의 추가 Properties

B.2.3.1 Date.prototype.getYear ( )

Note

getFullYear method는 “year 2000 problem”을 avoid하기 때문에 거의 모든 purposes에서 preferred됩니다.

이 method는 called될 때 다음 steps를 수행합니다:

  1. dateObjthis value로 둔다.
  2. RequireInternalSlot(dateObj, [[DateValue]])를 수행한다.
  3. tvdateObj.[[DateValue]]로 둔다.
  4. tvNaN이면, NaN을 반환한다.
  5. YearFromTime(LocalTime(tv)) - 1900𝔽을 반환한다.

B.2.3.2 Date.prototype.setYear ( year )

Note

setFullYear method는 “year 2000 problem”을 avoid하기 때문에 거의 모든 purposes에서 preferred됩니다.

이 method는 called될 때 다음 steps를 수행합니다:

  1. dateObjthis value로 둔다.
  2. RequireInternalSlot(dateObj, [[DateValue]])를 수행한다.
  3. timedateObj.[[DateValue]]로 둔다.
  4. year를 ? ToNumber(year)로 둔다.
  5. timeNaN이면 time+0𝔽으로 설정한다; 그렇지 않으면 timeLocalTime(time)으로 설정한다.
  6. fullYearMakeFullYear(year)로 둔다.
  7. dayMakeDay(fullYear, MonthFromTime(time), DateFromTime(time))로 둔다.
  8. dateMakeDate(day, TimeWithinDay(time))로 둔다.
  9. utcTimestampTimeClip(UTC(date))로 둔다.
  10. dateObj.[[DateValue]]utcTimestamp로 설정한다.
  11. utcTimestamp를 반환한다.

B.2.3.3 Date.prototype.toGMTString ( )

Note

toUTCString method가 preferred됩니다. 이 method는 principally old code와의 compatibility를 위해 provided됩니다.

"toGMTString" property의 initial value는 21.4.4.43에서 defined된 %Date.prototype.toUTCString%입니다.

B.2.4 RegExp.prototype Object의 추가 Properties

B.2.4.1 RegExp.prototype.compile ( pattern, flags )

이 method는 called될 때 다음 steps를 수행합니다:

  1. objthis value로 둔다.
  2. RequireInternalSlot(obj, [[RegExpMatcher]])를 수행한다.
  3. pattern이 Object이고 pattern[[RegExpMatcher]] internal slot을 가지면, 다음을 수행한다.
    1. flagsundefined가 아니면, TypeError exception을 throw한다.
    2. flagspattern.[[OriginalFlags]]로 설정한다.
    3. patternpattern.[[OriginalSource]]로 설정한다.
  4. RegExpInitialize(obj, pattern, flags)를 반환한다.
Note

이 method는 this value RegExp를 새로운 pattern과 flags로 완전히 reinitializes합니다. implementation은 이 method의 use를 resulting RegExp object가 multiple times 사용될 것이며 따라서 extra optimization의 candidate라는 assertion으로 interpret할 수 있습니다.

B.3 기타 추가 기능

B.3.1 Labelled Function Declarations

ECMAScript 2015 이전에는 LabelledStatement의 specification이 statement label과 FunctionDeclaration의 association을 allow하지 않았습니다. 그러나 labelled FunctionDeclarationnon-strict code에 대한 allowable extension이었고 대부분의 browser-hosted ECMAScript implementations가 그 extension을 supported했습니다. ECMAScript 2015 이후에는 LabelledStatement에 대한 grammar production이 FunctionDeclarationLabelledItem으로 사용하는 것을 permits하지만, 14.13.1에는 그것이 발생하면 Syntax Error를 producing하는 Early Error rule이 포함됩니다. 그런 다음 host가 이 feature를 support하는 경우 non-strict code에서 Syntax Error를 suppress하도록 그 rule이 modified됩니다.

Note

WithStatement, IfStatement, 및 IterationStatement에 대한 early error rules는 이러한 statements가 non-strict code에서 labelled FunctionDeclaration을 containing하는 것을 prevent합니다.

B.3.2 Block-Level Function Declarations Web Legacy Compatibility Semantics

ECMAScript 2015 이전에는 ECMAScript specification이 Block statement의 StatementList의 element로서 FunctionDeclaration의 occurrence를 define하지 않았습니다. 그러나 그러한 form의 FunctionDeclaration에 대한 support는 allowable extension이었고 대부분의 browser-hosted ECMAScript implementations가 이를 permitted했습니다. 불행히도 그러한 declarations의 semantics는 implementations마다 다릅니다. 이러한 semantic differences 때문에 Block level function declarations를 사용하는 기존 web ECMAScript source text는 그 usage가 그러한 declarations에 대한 모든 browser implementations의 semantic intersection에만 depends하는 경우에만 browser implementations 간에 portable합니다. 다음은 그 intersection semantics에 속하는 use cases입니다:

  1. function이 declared되고 single block 내에서만 referenced됩니다.

    • BindingIdentifier가 이름 f인 하나 이상의 FunctionDeclarations가 enclosing function g의 function code 내에서 occur하고 그 declaration은 Block 내에 nested됩니다.
    • var declaration이 아닌 f의 다른 declaration은 g의 function code 내에서 occur하지 않습니다.
    • IdentifierReference로서의 f의 모든 occurrences는 f의 declaration을 containing하는 BlockStatementList 내에 있습니다.
  2. function이 single Block 내에서 declared되고 possibly used되지만, 동일한 Block 내에 contained되지 않은 inner function definition에 의해 also referenced됩니다.

    • BindingIdentifier가 이름 f인 하나 이상의 FunctionDeclarations가 enclosing function g의 function code 내에서 occur하고 그 declaration은 Block 내에 nested됩니다.
    • var declaration이 아닌 f의 다른 declaration은 g의 function code 내에서 occur하지 않습니다.
    • f의 declaration을 containing하는 BlockStatementList 내에 IdentifierReference로서 f의 occurrences가 있을 수 있습니다.
    • g 내에 nested된 또 다른 function h 내에 IdentifierReference로서 f의 occurrence가 적어도 하나 있으며, h 내에서 f에 대한 references를 shadow하는 f의 다른 declaration은 없습니다.
    • h의 모든 invocations는 f의 declaration이 evaluated된 후 occur합니다.
  3. function이 single block 내에서 declared되고 possibly used되지만, subsequent blocks 내에서도 referenced됩니다.

    • BindingIdentifier가 이름 f인 하나 이상의 FunctionDeclaration이 enclosing function g의 function code 내에서 occur하고 그 declaration은 Block 내에 nested됩니다.
    • var declaration이 아닌 f의 다른 declaration은 g의 function code 내에서 occur하지 않습니다.
    • f의 declaration을 containing하는 BlockStatementList 내에 IdentifierReference로서 f의 occurrences가 있을 수 있습니다.
    • f의 declaration을 containing하는 Block을 lexically follows하는 g의 function code 내에 IdentifierReference로서 f의 occurrence가 적어도 하나 있습니다.

첫 번째 use case는 ECMAScript 2015가 provided하는 Block level function declarations의 semantics와 interoperable합니다. 그 use case를 employing하는 pre-existing ECMAScript source text는 clauses 10, 14, 및 15에 의해 defined된 Block level function declarations semantics를 사용하여 operate할 것입니다.

두 번째 및 세 번째 use cases에 대한 ECMAScript 2015 interoperability는 clause 10, clause 15, clause 19.2.1 및 clause 16.1.7 semantics에 대한 다음 extensions를 requires합니다.

ECMAScript implementation이 diagnostic warning messages를 reporting하는 mechanism을 가지고 있으면, code가 이러한 compatibility semantics가 applied되고 non-compatibility semantics와 observable differences를 introduce하는 FunctionDeclaration을 contains할 때 warning이 produced되어야 합니다. 예를 들어 var binding이 early error를 create하기 때문에 introduced되지 않는 경우 warning message는 produced되지 않아야 합니다.

이 feature는 다음 points에서 special semantics를 involves합니다:

B.3.3 IfStatement Statement Clauses 안의 FunctionDeclarations

다음은 14.6IfStatement production을 augments합니다:

IfStatement[Yield, Await, Return] : if ( Expression[+In, ?Yield, ?Await] ) FunctionDeclaration[?Yield, ?Await, ~Default] else Statement[?Yield, ?Await, ?Return] if ( Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return] else FunctionDeclaration[?Yield, ?Await, ~Default] if ( Expression[+In, ?Yield, ?Await] ) FunctionDeclaration[?Yield, ?Await, ~Default] else FunctionDeclaration[?Yield, ?Await, ~Default] if ( Expression[+In, ?Yield, ?Await] ) FunctionDeclaration[?Yield, ?Await, ~Default] [lookahead ≠ else]

이 production은 non-strict code를 parsing할 때만 applies됩니다. 이 production에 의해 matched된 source text는, FunctionDeclaration[?Yield, ?Await, ~Default]의 각 matching occurrence가 source text에서 그 position을 occupying하는 BlockStatement의 sole StatementListItem인 것처럼 processed됩니다. 그러한 synthetic BlockStatement의 semantics는 B.3.2에 specified된 web legacy compatibility semantics를 포함합니다.

B.3.4 Catch Blocks 안의 VariableStatements

이 feature에서 Catch clause의 BlockCatchParameter에 의해 also bound되는 name을 bind하는 var declarations를 contain할 수 있습니다. 이는 14.15.1 Catch : catch ( CatchParameter ) Block 에 대한 early error rule을 modifying함으로써 accomplished됩니다.

Note

At runtime, 그러한 bindings는 VariableDeclarationEnvironment에서 instantiated됩니다. 그것들은 CatchParameter에 의해 introduced된 same-named bindings를 shadow하지 않으므로, 그러한 var declarations에 대한 Initializervar binding이 아니라 corresponding catch parameter에 assign됩니다.

이 modified behaviour는 Catch clause의 Block 내에 contained된 direct eval calls에 의해 introduced되는 varfunction declarations에도 applies됩니다. 이 change는 EvalDeclarationInstantiation의 steps 3.d.i.2.a.i13.b.ii.4.a.i.i를 modifying함으로써 accomplished됩니다.

B.3.5 ForIn Statement Heads 안의 Initializers

다음은 14.7.5ForInOfStatement production을 augments합니다:

ForInOfStatement[Yield, Await, Return] : for ( var BindingIdentifier[?Yield, ?Await] Initializer[~In, ?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]

이 production은 non-strict code를 parsing할 때만 applies됩니다.

8.3.1ContainsDuplicateLabels static semantics는 다음으로 augmented됩니다:

ForInOfStatement : for ( var BindingIdentifier Initializer in Expression ) Statement
  1. argument labelSet를 사용한 StatementContainsDuplicateLabels를 반환한다.

8.3.2ContainsUndefinedBreakTarget static semantics는 다음으로 augmented됩니다:

ForInOfStatement : for ( var BindingIdentifier Initializer in Expression ) Statement
  1. argument labelSet를 사용한 StatementContainsUndefinedBreakTarget을 반환한다.

8.3.3ContainsUndefinedContinueTarget static semantics는 다음으로 augmented됩니다:

ForInOfStatement : for ( var BindingIdentifier Initializer in Expression ) Statement
  1. arguments iterationSet 및 « »를 사용한 StatementContainsUndefinedContinueTarget을 반환한다.

14.7.5.2IsDestructuring static semantics는 다음으로 augmented됩니다:

BindingIdentifier : Identifier yield await
  1. false를 반환한다.

8.2.8VarDeclaredNames static semantics는 다음으로 augmented됩니다:

ForInOfStatement : for ( var BindingIdentifier Initializer in Expression ) Statement
  1. names1BindingIdentifierBoundNames로 둔다.
  2. names2StatementVarDeclaredNames로 둔다.
  3. names1names2list-concatenation을 반환한다.

8.2.9VarScopedDeclarations static semantics는 다음으로 augmented됩니다:

ForInOfStatement : for ( var BindingIdentifier Initializer in Expression ) Statement
  1. decls1을 « BindingIdentifier »로 둔다.
  2. decls2StatementVarScopedDeclarations로 둔다.
  3. decls1decls2list-concatenation을 반환한다.

14.7.5.5ForInOfLoopEvaluation runtime semantics는 다음으로 augmented됩니다:

ForInOfStatement : for ( var BindingIdentifier Initializer in Expression ) Statement
  1. bindingIdBindingIdentifierStringValue로 둔다.
  2. lhs를 ? ResolveBinding(bindingId)로 둔다.
  3. IsAnonymousFunctionDefinition(Initializer)가 true이면, 다음을 수행한다.
    1. value를 argument bindingId를 사용한 InitializerNamedEvaluation으로 둔다.
  4. Else,
    1. rhs를 ? Evaluation of Initializer로 둔다.
    2. value를 ? GetValue(rhs)로 둔다.
  5. PutValue(lhs, value)를 수행한다.
  6. keyResult를 ? ForIn/OfHeadEvaluation(« », Expression, enumerate)로 둔다.
  7. ForIn/OfBodyEvaluation(BindingIdentifier, Statement, keyResult, enumerate, var-binding, labelSet)를 반환한다.

B.3.6 [[IsHTMLDDA]] Internal Slot

[[IsHTMLDDA]] internal slothost-defined objects에 존재할 수 있습니다. [[IsHTMLDDA]] internal slot을 가진 objects는 ToBooleanIsLooselyEqual abstract operations에서, 그리고 typeof operator의 operand로 사용될 때 undefined처럼 behave합니다.

Note

[[IsHTMLDDA]] internal slot을 가진 objects는 이 specification에 의해 created되지 않습니다. 그러나 web browsers의 document.all object는 web compatibility purposes를 위해 존재하는 이 slot을 가진 host-defined exotic object입니다. 이 type의 object에 대한 다른 known examples는 없으며 implementations는 document.all을 제외하고 이를 create하지 않아야 합니다.

이 feature는 다음 points에서 special semantics를 involves합니다:

B.3.7 HostMakeJobCallback의 Non-default behaviour

HostMakeJobCallback abstract operation은 web browsers인 hosts가 non-default behaviour를 specify할 수 있게 합니다.

B.3.8 HostEnsureCanAddPrivateElement의 Non-default behaviour

HostEnsureCanAddPrivateElement abstract operation은 web browsers인 hosts가 non-default behaviour를 specify할 수 있게 합니다.

B.3.9 Function Call Assignment Targets에 대한 Runtime Errors

function call (13.3.6)이 non-strict code에서 assignment target으로 사용될 때, early error를 producing하는 대신 assignment의 evaluation 중에 ReferenceError exception이 thrown됩니다.

Note

assignment target이 AssignmentExpressionLeftHandSideExpression인 경우, assignment operator는 = 또는 AssignmentOperator여야 합니다. 특히 여기의 allowance는 logical assignment operators (??=, &&=, ||=)에는 apply되지 않습니다.

CallExpression : CoverCallExpressionAndAsyncArrowHead CallExpression : CallExpression Arguments 에 대한 AssignmentTargetType의 step 1을 참조하세요.