Annex B (normative) Webブラウザー向け追加ECMAScript機能

このannexで定義されるECMAScript言語のsyntaxおよびsemanticsは、ECMAScript hostがweb browserである場合にrequiredである。このannexの内容はnormativeであるが、ECMAScript hostがweb browserでない場合はoptionalである。

このannexで定義される一部のfeaturesはこのannexでspecifiedされ、一部はこの文書のmain bodyでspecifiedされる。

featureがmain bodyでspecifiedされる場合、それが文書に影響する各pointは、coloured box内の“Normative Optional”というwordsでmarkedされる。さらに、そのfeatureがalgorithmまたはearly error rule内のparticular wordingに関わる場合、これは関連するfeatureを“the host supports”するというconditionによってguardされる。Web browsersはそのようなfeaturesをすべてsupportすることがrequiredである。

Note

このannexは、web browser ECMAScript hostsの様々なlegacy featuresおよびその他のcharacteristicsをdescribeする。このannexでspecifiedされるlanguage featuresおよびbehavioursはすべて、1つ以上の望ましくないcharacteristicsを持ち、legacy usageがなければこのspecificationからremovedされるものである。しかし、既存の大量のweb pagesによるこれらfeaturesのusageは、web browsersがそれらをsupportし続けなければならないことを意味する。このannexのspecificationsは、これらlegacy featuresのinteroperable implementationsのrequirementsをdefineする。

これらfeaturesはcore ECMAScript languageの一部とはconsideredされない。Programmersは新しいECMAScript codeを書くとき、これらfeaturesおよびbehavioursのexistenceを使用またはassumeすべきでない。ECMAScript implementationsは、そのimplementationがweb browserの一部である場合、またはweb browsersがencounterするものと同じlegacy ECMAScript codeをrunすることがrequiredされる場合を除き、これらfeaturesをimplementすることをdiscouragedされる。

B.1 追加Syntax

B.1.1 HTML-like Comments

12.4のsyntaxおよびsemanticsは以下のようにextendedされる。ただし、このextensionはgoal symbol Moduleを使用してsource textをparseする場合には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の目的ではLineTerminatorであるとconsideredされる。

B.1.2 Regular Expressions Patterns

22.2.1のsyntaxは以下のようにmodifiedおよびextendedされる。これらのchangesはambiguitiesをintroduceし、それらはgrammar productionsのorderingおよびcontextual informationによって解消される。以下のgrammarを使用してparsingする場合、各alternativeは、それ以前のproduction alternativesがmatchしない場合にのみconsideredされる。

このalternative pattern grammarおよびsemanticsは、BMP patternsのsyntaxおよびsemanticsのみをchangeする。以下のgrammar extensionsには[UnicodeMode] parameterでparameterizedされたproductionsが含まれる。しかし、これらextensionsのいずれも、goal symbol上に[UnicodeMode] parameterがpresentでparseするときにrecognizedされるUnicode patternsのsyntaxをchangeしない。

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の両方でoccurする場合、それはdisambiguation priorityをcontrolするためである。

B.1.2.1 Static Semantics: Early Errors

22.2.1.1のsemanticsは以下のようにextendedされる:

ExtendedAtom :: InvalidBracedQuantifier
  • このproductionによりsource textがmatchされる場合、それはSyntax Errorである。

さらに、以下のproductionsのrulesは、highlighted textのadditionによりmodifiedされる:

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

B.1.2.2 Static Semantics: CountLeftCapturingParensWithin and CountLeftCapturingParensBefore

CountLeftCapturingParensWithinおよびCountLeftCapturingParensBeforeのdefinitionsにおいて、“ Atom :: ( GroupSpecifieropt Disjunction ) ”へのreferencesは、“ Atom :: ( GroupSpecifieropt Disjunction ) ”または“ ExtendedAtom :: ( GroupSpecifieropt Disjunction ) ”をmeaningするものとして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によりmatchedされる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は、AtomQuantifiableAssertionでsubstitutedすることを除き、 Term :: Atom Quantifier の場合と同じである。

Term :: ExtendedAtom Quantifier のruleは、AtomExtendedAtomでsubstitutedすることを除き、 Term :: Atom Quantifier の場合と同じである。

Term :: ExtendedAtom のruleは、AtomExtendedAtomでsubstitutedすることを除き、 Term :: Atom の場合と同じである。

B.1.2.6 Runtime Semantics: CompileAssertion

Assertion :: (?= Disjunction ) および Assertion :: (?! Disjunction ) productionsのCompileAssertion rulesは、AssertionQuantifiableAssertionでsubstitutedすることを除き、QuantifiableAssertion productionsにも使用される。

B.1.2.7 Runtime Semantics: CompileAtom

Atom :: PatternCharacter を除くAtom productionsのCompileAtom rulesは、AtomExtendedAtomでsubstitutedすることを除き、ExtendedAtom productionsにも使用される。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される:

以下の2つのrulesは、CompileToCharSetのcorresponding rulesをreplaceする。

NonemptyClassRanges :: ClassAtom - ClassAtom ClassContents
  1. charSetをargument regexpRecordを伴うfirst ClassAtomCompileToCharSetとする。
  2. otherSetをargument regexpRecordを伴うsecond 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は、acceptable control characterが続かないcharacter class内のsequence \cからのみ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がexactly one characterをcontainしない、またはotherSetがexactly one characterをcontainしないなら、
      1. remainingSetをsingle character - U+002D (HYPHEN-MINUS)を含むCharSetとする。
      2. CharSets charSetotherSetおよびremainingSetの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(Boolean)、およびv(Boolean)を取る。呼び出されたとき、以下のstepsを実行する:

  1. vtrueでありutrueなら、
    1. parseResultを1つ以上のSyntaxError objectsを含むListとする。
  2. そうでなく、vtrueなら、
    1. parseResultParseText(patternText, Pattern[+UnicodeMode, +UnicodeSetsMode, +NamedCaptureGroups])とする。
  3. そうでなく、utrueなら、
    1. parseResultParseText(patternText, Pattern[+UnicodeMode, ~UnicodeSetsMode, +NamedCaptureGroups])とする。
  4. そうでなければ、
    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: Additional 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のnew versionをcomputesする。

numeric valueが0x00FF以下のcode unitをreplacingするとき、%xx形式のtwo-digit escape sequenceが使用される。numeric valueが0x00FFよりstrictly greaterであるcode unitをreplacingするとき、%uxxxx形式のfour-digit escape sequenceが使用される。

これは%escape% intrinsic objectである。

呼び出されたとき、以下のstepsを実行する:

  1. stringを ? ToString(string) に設定する。
  2. lengthstringのlengthとする。
  3. resultをempty Stringとする。
  4. unescapedSetをASCII word charactersと"@*+-./"string-concatenationとする。
  5. kを0とする。
  6. k < lengthである間、繰り返す:
    1. codeUnitstring内のindex kにあるcode unitとする。
    2. unescapedSetcodeUnitをcontainするなら、
      1. nextPartcodeUnitとする。
    3. そうでなければ、
      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. そうでなければ、
        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にpartly基づくが、このstandardでspecifiedされるentire 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のnew versionをcomputesする。

これは%unescape% intrinsic objectである。

呼び出されたとき、以下の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. hexDigitsstringk + 2からk + 6までのsubstringに設定する。
        2. optionalAdvanceを5に設定する。
      4. そうでなく、k + 3 ≤ lengthなら、
        1. hexDigitsstringk + 1からk + 3までのsubstringに設定する。
        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まで)runningする。startがnegativeなら、それはsourceLength + startとしてtreatedされる。ここでsourceLengthはStringのlengthである。resultはString valueであり、String objectではない。

呼び出されたとき、以下のstepsを実行する:

  1. objthis valueとする。
  2. RequireObjectCoercible(obj)を実行する。
  3. stringを ? ToString(obj) とする。
  4. sizestringのlengthとする。
  5. intStartを ? ToIntegerOrInfinity(start) とする。
  6. intStart = -∞なら、intStartを0に設定する。
  7. そうでなく、intStart < 0なら、intStartmax(size + intStart, 0)に設定する。
  8. そうでなければ、intStartmin(intStart, size)に設定する。
  9. lengthundefinedなら、intLengthsizeとする;そうでなければ、intLengthを ? ToIntegerOrInfinity(length) とする。
  10. intLengthを0とsizeの間にclampingしたresultに設定する。
  11. intEndmin(intStart + intLength, size)とする。
  12. stringintStartからintEndまでのsubstringを返す。
Note

このmethodはintentionally genericである;そのthis valueがString objectであることをrequireしない。したがって、methodとして使用するために他のkinds of objectsへtransferredできる。

B.2.2.2 String.prototype.anchor ( name )

このmethodは呼び出されたとき、以下の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. escapedAttrValueを、attrValueString内のcode unit 0x0022 (QUOTATION MARK)の各occurrenceがsix code unit sequence "&quot;"でreplacedされたことを除きattrValueStringと同じ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は呼び出されたとき、以下のstepsを実行する:

  1. stringthis valueとする。
  2. CreateHTML(string, "big", "", "")を返す。

B.2.2.4 String.prototype.blink ( )

このmethodは呼び出されたとき、以下のstepsを実行する:

  1. stringthis valueとする。
  2. CreateHTML(string, "blink", "", "")を返す。

B.2.2.5 String.prototype.bold ( )

このmethodは呼び出されたとき、以下のstepsを実行する:

  1. stringthis valueとする。
  2. CreateHTML(string, "b", "", "")を返す。

B.2.2.6 String.prototype.fixed ( )

このmethodは呼び出されたとき、以下のstepsを実行する:

  1. stringthis valueとする。
  2. CreateHTML(string, "tt", "", "")を返す。

B.2.2.7 String.prototype.fontcolor ( colour )

このmethodは呼び出されたとき、以下のstepsを実行する:

  1. stringthis valueとする。
  2. CreateHTML(string, "font", "color", colour)を返す。

B.2.2.8 String.prototype.fontsize ( size )

このmethodは呼び出されたとき、以下のstepsを実行する:

  1. stringthis valueとする。
  2. CreateHTML(string, "font", "size", size)を返す。

B.2.2.9 String.prototype.italics ( )

このmethodは呼び出されたとき、以下のstepsを実行する:

  1. stringthis valueとする。
  2. CreateHTML(string, "i", "", "")を返す。

B.2.2.10 String.prototype.link ( url )

このmethodは呼び出されたとき、以下のstepsを実行する:

  1. stringthis valueとする。
  2. CreateHTML(string, "a", "href", url)を返す。

B.2.2.11 String.prototype.small ( )

このmethodは呼び出されたとき、以下のstepsを実行する:

  1. stringthis valueとする。
  2. CreateHTML(string, "small", "", "")を返す。

B.2.2.12 String.prototype.strike ( )

このmethodは呼び出されたとき、以下のstepsを実行する:

  1. stringthis valueとする。
  2. CreateHTML(string, "strike", "", "")を返す。

B.2.2.13 String.prototype.sub ( )

このmethodは呼び出されたとき、以下のstepsを実行する:

  1. stringthis valueとする。
  2. CreateHTML(string, "sub", "", "")を返す。

B.2.2.14 String.prototype.sup ( )

このmethodは呼び出されたとき、以下のstepsを実行する:

  1. stringthis valueとする。
  2. CreateHTML(string, "sup", "", "")を返す。

B.2.2.15 String.prototype.trimLeft ( )

Note

"trimStart" propertyがpreferredである。"trimLeft" propertyは主に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

"trimEnd" propertyがpreferredである。"trimRight" propertyは主に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するため、ほぼすべての目的でpreferredされる。

このmethodは呼び出されたとき、以下の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するため、ほぼすべての目的でpreferredされる。

このmethodは呼び出されたとき、以下の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は主に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は呼び出されたとき、以下のstepsを実行する:

  1. objthis valueとする。
  2. RequireInternalSlot(obj, [[RegExpMatcher]])を実行する。
  3. patternがObjectであり、pattern[[RegExpMatcher]] internal slotを持つなら、
    1. flagsundefinedでないなら、TypeError例外をthrowする。
    2. flagspattern.[[OriginalFlags]]に設定する。
    3. patternpattern.[[OriginalSource]]に設定する。
  4. RegExpInitialize(obj, pattern, flags)を返す。
Note

このmethodはthis value RegExpをnew patternおよびflagsで完全にreinitializesする。Implementationは、このmethodの使用を、resulting RegExp objectが複数回使用されるためextra optimizationのcandidateであるというassertionとしてinterpretしてもよい。

B.3 その他の追加Features

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をsupportしていた。ECMAScript 2015以降、LabelledStatementのgrammar productionはLabelledItemとしてFunctionDeclarationの使用をpermitするが、14.13.1には、それがoccurする場合にSyntax ErrorをproduceするEarly Error ruleが含まれる。そのruleは、このfeatureをhostがsupportする場合、non-strict codeにおいてSyntax Errorをsuppressするようにmodifiedされる。

Note

WithStatementIfStatement、およびIterationStatementearly error rulesは、これらstatementsがnon-strict code内でlabelled FunctionDeclarationをcontainすることを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にのみ依存する場合に限り、browser implementations間でportableである。以下は、そのintersection semantics内に入るuse casesである:

  1. functionがdeclaredされ、single block内でのみreferencedされる。

    • BindingIdentifierがname fである1つ以上のFunctionDeclarationsが、enclosing function gのfunction code内にoccurし、そのdeclarationがBlock内にnestedされている。
    • fの他のdeclarationで、var declarationでないものは、gのfunction code内にoccurしない。
    • IdentifierReferenceとしてのfのすべてのoccurrencesは、fのdeclarationをcontainするBlockStatementList内にある。
  2. functionがdeclaredされ、single Block内でpossibly usedされるが、同じBlock内にcontainedされないinner function definitionによってalso referencedされる。

    • BindingIdentifierがname fである1つ以上のFunctionDeclarationsが、enclosing function gのfunction code内にoccurし、そのdeclarationがBlock内にnestedされている。
    • fの他のdeclarationで、var declarationでないものは、gのfunction code内にoccurしない。
    • fのdeclarationをcontainするBlockStatementList内に、IdentifierReferenceとしてのfのoccurrencesがあってもよい。
    • g内にnestedされた別のfunction h内に、IdentifierReferenceとしてのfのoccurrenceが少なくとも1つあり、h内からのfへのreferencesをshadowするfの他のdeclarationがない。
    • hのすべてのinvocationsは、fのdeclarationがevaluatedされた後にoccurする。
  3. functionがdeclaredされ、single block内でpossibly usedされるが、subsequent blocks内でもreferencedされる。

    • BindingIdentifierがname fである1つ以上のFunctionDeclarationが、enclosing function gのfunction code内にoccurし、そのdeclarationがBlock内にnestedされている。
    • fの他のdeclarationで、var declarationでないものは、gのfunction code内にoccurしない。
    • fのdeclarationをcontainするBlockStatementList内に、IdentifierReferenceとしてのfのoccurrencesがあってもよい。
    • fのdeclarationをcontainするBlockにlexically followsするgのfunction code内に、IdentifierReferenceとしてのfのoccurrenceが少なくとも1つある。

first use caseは、ECMAScript 2015によってprovidedされるBlock level function declarationsのsemanticsとinteroperableである。そのuse caseをemployするpre-existing ECMAScript source textは、clauses 1014、および15によってdefinedされるBlock level function declarations semanticsを使用してoperateする。

secondおよびthird use casesのECMAScript 2015 interoperabilityは、clause 10、clause 15、clause 19.2.1およびclause 16.1.7 semanticsへの以下のextensionsをrequireする。

ECMAScript implementationがdiagnostic warning messagesをreportするmechanismを持つ場合、これらcompatibility semanticsがappliedされ、non-compatibility semanticsからobservable differencesをintroduceするFunctionDeclarationをcodeがcontainするとき、warningがproducedされるべきである。例えば、var bindingのintroductionがearly errorをcreateするためにintroducedされない場合、warning messageはproducedされるべきでない。

このfeatureは以下のpointsでspecial semanticsをinvolvesする:

B.3.3 IfStatement Statement Clauses内のFunctionDeclarations

以下は14.6内のIfStatement 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のBlockは、CatchParameterによってもboundされるnameをbindするvar declarationsをcontainしてもよい。これは、14.15.1内の Catch : catch ( CatchParameter ) Block に関するearly error ruleをmodifyingすることによってaccomplishedされる。

Note

runtimeでは、そのようなbindingsはVariableDeclarationEnvironment内でinstantiatedされる。それらはCatchParameterによってintroducedされるsame-named bindingsをshadowせず、したがってそのようなvar declarationsのInitializerは、var bindingではなくcorresponding catch parameterへassignする。

このmodified behaviourは、Catch clauseのBlock内にcontainedされるdirect eval callsによってintroducedされるvarおよびfunction declarationsにもappliesする。このchangeは、EvalDeclarationInstantiation内のsteps 3.d.i.2.a.iおよび13.b.ii.4.a.i.iをmodifyingすることによってaccomplishedされる。

B.3.5 ForIn Statement Heads内のInitializers

以下は14.7.5内のForInOfStatement 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.1内のContainsDuplicateLabelsstatic semanticsは以下でaugmentedされる:

ForInOfStatement : for ( var BindingIdentifier Initializer in Expression ) Statement
  1. argument labelSetを伴うStatementContainsDuplicateLabelsを返す。

8.3.2内のContainsUndefinedBreakTargetstatic semanticsは以下でaugmentedされる:

ForInOfStatement : for ( var BindingIdentifier Initializer in Expression ) Statement
  1. argument labelSetを伴うStatementContainsUndefinedBreakTargetを返す。

8.3.3内のContainsUndefinedContinueTargetstatic semanticsは以下でaugmentedされる:

ForInOfStatement : for ( var BindingIdentifier Initializer in Expression ) Statement
  1. arguments iterationSetおよび « » を伴うStatementContainsUndefinedContinueTargetを返す。

14.7.5.2内のIsDestructuringstatic semanticsは以下でaugmentedされる:

BindingIdentifier : Identifier yield await
  1. falseを返す。

8.2.8内のVarDeclaredNamesstatic semanticsは以下でaugmentedされる:

ForInOfStatement : for ( var BindingIdentifier Initializer in Expression ) Statement
  1. names1BindingIdentifierBoundNamesとする。
  2. names2StatementVarDeclaredNamesとする。
  3. names1names2list-concatenationを返す。

8.2.9内のVarScopedDeclarationsstatic semanticsは以下でaugmentedされる:

ForInOfStatement : for ( var BindingIdentifier Initializer in Expression ) Statement
  1. decls1を « BindingIdentifier » とする。
  2. decls2StatementVarScopedDeclarationsとする。
  3. decls1decls2list-concatenationを返す。

14.7.5.5内のForInOfLoopEvaluationの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. そうでなければ、
    1. rhsを ? InitializerEvaluation とする。
    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上にexistしてもよい。[[IsHTMLDDA]] internal slotを持つObjectsは、ToBooleanおよびIsLooselyEqual 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のexceptionを除き、これを持つものを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をproduceする代わりに、assignmentのevaluation中にReferenceError例外がthrownされる。

Note

assignment targetがAssignmentExpressionLeftHandSideExpressionである場合、assignment operatorは=またはAssignmentOperatorでなければならない;特に、ここでのallowanceはlogical assignment operators(??=&&=||=)にはapplyしない。

CallExpression : CoverCallExpressionAndAsyncArrowHead および CallExpression : CallExpression Arguments に関するAssignmentTargetTypeのstep 1を参照。