From a77a67f11ce241b230c1f28ba9923d4942f0a2e4 Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Fri, 22 Aug 2014 20:05:53 -0400 Subject: [PATCH] Add a way to mark dictionary members as required. https://www.w3.org/Bugs/Public/show_bug.cgi?id=26303 --- index.html | 294 +++++++++++++++++++++++++++++------------------------ index.xml | 37 ++++++- v1.html | 260 +++++++++++++++++++++++++--------------------- v1.xml | 37 ++++++- 4 files changed, 373 insertions(+), 255 deletions(-) diff --git a/index.html b/index.html index 8bd43d4e..0c4f835b 100644 --- a/index.html +++ b/index.html @@ -19,7 +19,7 @@ -
W3C

Web IDL (Second Edition)

W3C Editor’s Draft 21 August 2014

This Version:
http://heycam.github.io/webidl/
Latest Version:
http://www.w3.org/TR/WebIDL/
Previous Versions:
http://www.w3.org/TR/2012/CR-WebIDL-20120419/
http://www.w3.org/TR/2012/WD-WebIDL-20120207/
http://www.w3.org/TR/2011/WD-WebIDL-20110927/
http://www.w3.org/TR/2011/WD-WebIDL-20110712/
http://www.w3.org/TR/2010/WD-WebIDL-20101021/
http://www.w3.org/TR/2008/WD-WebIDL-20081219/
http://www.w3.org/TR/2008/WD-WebIDL-20080829/
http://www.w3.org/TR/2008/WD-DOM-Bindings-20080410/
http://www.w3.org/TR/2007/WD-DOM-Bindings-20071017/
Participate:
+
@@ -72,7 +72,7 @@

Status of This Document

report can be found in the W3C technical reports index at http://www.w3.org/TR/.

- This document is the 21 August 2014 Editor’s Draft of the + This document is the 24 August 2014 Editor’s Draft of the Web IDL (Second Edition) specification. Please send comments about this document to @@ -494,7 +494,7 @@

3.1. Names

underscore.

return-type operation-identifier(argument-type argument-identifier, …);
-
[69]ArgumentNameKeyword +
[72]ArgumentNameKeyword "attribute"
 | "callback"
 | "const"
 | @@ -511,6 +511,7 @@

3.1. Names


 | "legacycaller"
 | "partial"
 | + "required"
 | "serializer"
 | "setter"
 | "static"
 | @@ -1011,7 +1012,7 @@

3.2. Interfaces

Interface
[5]Interface"interface" identifier Inheritance "{" InterfaceMembers "}" ";"
[6]Partial"partial" PartialDefinition
[7]PartialDefinitionPartialInterface
 | PartialDictionary
[8]PartialInterface"interface" identifier "{" InterfaceMembers "}" ";"
[9]InterfaceMembersExtendedAttributeList InterfaceMember InterfaceMembers
 | ε
[10]InterfaceMemberConst
 | - AttributeOrOperationOrIterator
[19]Inheritance":" identifier
 | + AttributeOrOperationOrIterator
[20]Inheritance":" identifier
 | ε
Example
@@ -1290,14 +1291,14 @@

3.2.1. Constants

[Exposed].

-
[27]Const"const" ConstType identifier "=" ConstValue ";"
[28]ConstValueBooleanLiteral
 | +
[28]Const"const" ConstType identifier "=" ConstValue ";"
[29]ConstValueBooleanLiteral
 | FloatLiteral
 | integer
 | - "null"
[29]BooleanLiteral"true"
 | - "false"
[30]FloatLiteralfloat
 | + "null"
[30]BooleanLiteral"true"
 | + "false"
[31]FloatLiteralfloat
 | "-Infinity"
 | "Infinity"
 | - "NaN"
[77]ConstTypePrimitiveType Null
 | + "NaN"
[80]ConstTypePrimitiveType Null
 | identifier Null
Example

@@ -1470,8 +1471,8 @@

3.2.2. Attributes

-
[41]AttributeInherit AttributeRest
[42]AttributeRestReadOnly "attribute" Type identifier ";"
[43]Inherit"inherit"
 | - ε
[44]ReadOnly"readonly"
 | +
[42]AttributeInherit AttributeRest
[43]AttributeRestReadOnly "attribute" Type AttributeName ";"
[46]Inherit"inherit"
 | + ε
[47]ReadOnly"readonly"
 | ε
Example
@@ -1841,26 +1842,26 @@

3.2.3. Operations

[TreatNullAs].

-
[16]DefaultValueConstValue
 | +
[17]DefaultValueConstValue
 | string
 | - "[" "]"
[31]AttributeOrOperationOrIteratorSerializer
 | + "[" "]"
[32]AttributeOrOperationOrIteratorSerializer
 | Stringifier
 | StaticMember
 | Attribute
 | - OperationOrIterator
[45]OperationOrIteratorReturnType OperationOrIteratorRest
 | - SpecialOperation
[46]SpecialOperationSpecial Specials ReturnType OperationRest
[47]SpecialsSpecial Specials
 | - ε
[48]Special"getter"
 | + OperationOrIterator
[48]OperationOrIteratorReturnType OperationOrIteratorRest
 | + SpecialOperation
[49]SpecialOperationSpecial Specials ReturnType OperationRest
[50]SpecialsSpecial Specials
 | + ε
[51]Special"getter"
 | "setter"
 | "creator"
 | "deleter"
 | - "legacycaller"
[49]OperationOrIteratorRestIteratorRest
 | - OperationRest
[53]OperationRestOptionalIdentifier "(" ArgumentList ")" ";"
[54]OptionalIdentifieridentifier
 | - ε
[55]ArgumentListArgument Arguments
 | - ε
[56]Arguments"," Argument Arguments
 | - ε
[57]ArgumentExtendedAttributeList OptionalOrRequiredArgument
[58]OptionalOrRequiredArgument"optional" Type ArgumentName Default
 | - Type Ellipsis ArgumentName
[59]ArgumentNameArgumentNameKeyword
 | - identifier
[60]Ellipsis"..."
 | - ε
[69]ArgumentNameKeyword + "legacycaller"
[52]OperationOrIteratorRestIteratorRest
 | + OperationRest
[56]OperationRestOptionalIdentifier "(" ArgumentList ")" ";"
[57]OptionalIdentifieridentifier
 | + ε
[58]ArgumentListArgument Arguments
 | + ε
[59]Arguments"," Argument Arguments
 | + ε
[60]ArgumentExtendedAttributeList OptionalOrRequiredArgument
[61]OptionalOrRequiredArgument"optional" Type ArgumentName Default
 | + Type Ellipsis ArgumentName
[62]ArgumentNameArgumentNameKeyword
 | + identifier
[63]Ellipsis"..."
 | + ε
[72]ArgumentNameKeyword "attribute"
 | "callback"
 | "const"
 | @@ -1877,6 +1878,7 @@

3.2.3. Operations


 | "legacycaller"
 | "partial"
 | + "required"
 | "serializer"
 | "setter"
 | "static"
 | @@ -1884,7 +1886,7 @@

3.2.3. Operations

"typedef"
 | "unrestricted" -
[88]ReturnTypeType
 | +
[91]ReturnTypeType
 | "void"
@@ -2208,7 +2210,7 @@
3.2.4.2. Stringifiers

stringifier attribute DOMString identifier;
-
[37]Stringifier"stringifier" StringifierRest
[38]StringifierRestAttributeRest
 | +
[38]Stringifier"stringifier" StringifierRest
[39]StringifierRestAttributeRest
 | ReturnType OperationRest
 | ";"
@@ -2541,16 +2543,16 @@
3.2.4.3. Serializers
the value returned from invoking the operation to a serialized value.

-
[32]Serializer"serializer" SerializerRest
[33]SerializerRestOperationRest
 | +
[33]Serializer"serializer" SerializerRest
[34]SerializerRestOperationRest
 | "=" SerializationPattern
 | - ε
[34]SerializationPattern"{" SerializationPatternMap "}"
 | + ε
[35]SerializationPattern"{" SerializationPatternMap "}"
 | "[" SerializationPatternList "]"
 | - identifier
[35]SerializationPatternMap"getter"
 | + identifier
[36]SerializationPatternMap"getter"
 | "inherit" Identifiers
 | identifier Identifiers
 | - ε
[36]SerializationPatternList"getter"
 | + ε
[37]SerializationPatternList"getter"
 | identifier Identifiers
 | - ε
[90]Identifiers"," identifier Identifiers
 | + ε
[93]Identifiers"," identifier Identifiers
 | ε
Example
@@ -2966,7 +2968,7 @@

3.2.5. Static attributes and operations

declared on callback interfaces.

-
[39]StaticMember"static" StaticMemberRest
[40]StaticMemberRestAttributeRest
 | +
[40]StaticMember"static" StaticMemberRest
[41]StaticMemberRestAttributeRest
 | ReturnType OperationRest
Example
@@ -4066,10 +4068,10 @@

3.2.7. Iterators

defined in this specification are applicable to iterator object declarations.

-
[45]OperationOrIteratorReturnType OperationOrIteratorRest
 | - SpecialOperation
[49]OperationOrIteratorRestIteratorRest
 | - OperationRest
[50]IteratorRest"iterator" OptionalIteratorInterfaceOrObject ";"
[51]OptionalIteratorInterfaceOrObjectOptionalIteratorInterface
 | - "object"
[52]OptionalIteratorInterface"=" identifier
 | +
[48]OperationOrIteratorReturnType OperationOrIteratorRest
 | + SpecialOperation
[52]OperationOrIteratorRestIteratorRest
 | + OperationRest
[53]IteratorRest"iterator" OptionalIteratorInterfaceOrObject ";"
[54]OptionalIteratorInterfaceOrObjectOptionalIteratorInterface
 | + "object"
[55]OptionalIteratorInterface"=" identifier
 | ε
@@ -4123,7 +4125,8 @@

3.3. Dictionaries

A dictionary value of type D can have key–value pairs corresponding to the dictionary members defined on D and on any of D’s inherited dictionaries. - On a given dictionary value, the presence of each dictionary member is optional. + On a given dictionary value, the presence of each dictionary member + is optional, unless that member is specified as required. When specified in the dictionary value, a dictionary member is said to be present, otherwise it is not present. Dictionary members can also optionally have a default value, which is @@ -4179,6 +4182,17 @@

3.3. Dictionaries

default value if specified MUST be one of the enumeration’s values.

+

+ If the type of the dictionary member is preceded by the + required keyword, the member is considered a + required dictionary member + and must be present on the dictionary. A + required dictionary + member MUST NOT have a default value. +

+
dictionary identifier {
+  required type identifier;
+};

The type of a dictionary member MUST NOT include the dictionary it appears on. A type includes a dictionary D @@ -4304,10 +4318,10 @@

3.3. Dictionaries

[6]Partial"partial" PartialDefinition
[7]PartialDefinitionPartialInterface
 | PartialDictionary
[11]Dictionary"dictionary" identifier Inheritance "{" DictionaryMembers "}" ";"
[12]DictionaryMembersExtendedAttributeList DictionaryMember DictionaryMembers
 | - ε
[13]DictionaryMemberType identifier Default ";"
[14]PartialDictionary"dictionary" identifier "{" DictionaryMembers "}" ";"
[15]Default"=" DefaultValue
 | - ε
[16]DefaultValueConstValue
 | + ε
[13]DictionaryMemberRequired Type identifier Default ";"
[15]PartialDictionary"dictionary" identifier "{" DictionaryMembers "}" ";"
[16]Default"=" DefaultValue
 | + ε
[17]DefaultValueConstValue
 | string
 | - "[" "]"
[19]Inheritance":" identifier
 | + "[" "]"
[20]Inheritance":" identifier
 | ε
Example

@@ -4535,10 +4549,10 @@

3.4. Exceptions

No extended attributes defined in this specification are applicable to exception fields.

-
[17]Exception"exception" identifier Inheritance "{" ExceptionMembers "}" ";"
[18]ExceptionMembersExtendedAttributeList ExceptionMember ExceptionMembers
 | - ε
[19]Inheritance":" identifier
 | - ε
[61]ExceptionMemberConst
 | - ExceptionField
[62]ExceptionFieldType identifier ";"
+
[18]Exception"exception" identifier Inheritance "{" ExceptionMembers "}" ";"
[19]ExceptionMembersExtendedAttributeList ExceptionMember ExceptionMembers
 | + ε
[20]Inheritance":" identifier
 | + ε
[64]ExceptionMemberConst
 | + ExceptionField
[65]ExceptionFieldType identifier ";"
Example

The following example demonstrates how a reduced version of DOM Core’s @@ -4650,8 +4664,8 @@

3.5. Enumerations

defined in this specification are applicable to enumerations.

-
[20]Enum"enum" identifier "{" EnumValueList "}" ";"
[21]EnumValueListstring EnumValueListComma
[22]EnumValueListComma"," EnumValueListString
 | - ε
[23]EnumValueListStringstring EnumValueListComma
 | +
[21]Enum"enum" identifier "{" EnumValueList "}" ";"
[22]EnumValueListstring EnumValueListComma
[23]EnumValueListComma"," EnumValueListString
 | + ε
[24]EnumValueListStringstring EnumValueListComma
 | ε
Example
@@ -4723,7 +4737,7 @@

3.6. Callback functions

[3]CallbackOrInterface"callback" CallbackRestOrInterface
 | Interface
[4]CallbackRestOrInterfaceCallbackRest
 | - Interface
[24]CallbackRestidentifier "=" ReturnType "(" ArgumentList ")" ";"
+ Interface
[25]CallbackRestidentifier "=" ReturnType "(" ArgumentList ")" ";"
Example

@@ -4774,7 +4788,7 @@

3.7. Typedefs

defined in this specification are applicable to typedefs.

-
[25]Typedef"typedef" Type identifier ";"
+
[26]Typedef"typedef" Type identifier ";"
Example

@@ -4918,7 +4932,7 @@

3.8. Implements statements

implements statements.

-
[26]ImplementsStatementidentifier "implements" identifier ";"
+
[27]ImplementsStatementidentifier "implements" identifier ";"
Example

@@ -5136,12 +5150,12 @@

3.10. Types

assign to the attribute.

-
[71]TypeSingleType
 | - UnionType TypeSuffix
[72]SingleTypeNonAnyType
 | - "any" TypeSuffixStartingWithArray
[73]UnionType"(" UnionMemberType "or" UnionMemberType UnionMemberTypes ")"
[74]UnionMemberTypeNonAnyType
 | +
[74]TypeSingleType
 | + UnionType TypeSuffix
[75]SingleTypeNonAnyType
 | + "any" TypeSuffixStartingWithArray
[76]UnionType"(" UnionMemberType "or" UnionMemberType UnionMemberTypes ")"
[77]UnionMemberTypeNonAnyType
 | UnionType TypeSuffix
 | - "any" "[" "]" TypeSuffix
[75]UnionMemberTypes"or" UnionMemberType UnionMemberTypes
 | - ε
[76]NonAnyTypePrimitiveType TypeSuffix
 | + "any" "[" "]" TypeSuffix
[78]UnionMemberTypes"or" UnionMemberType UnionMemberTypes
 | + ε
[79]NonAnyTypePrimitiveType TypeSuffix
 | PromiseType Null
 | "ByteString" TypeSuffix
 | "DOMString" TypeSuffix
 | @@ -5149,20 +5163,20 @@

3.10. Types

"sequence" "<" Type ">" Null
 | "object" TypeSuffix
 | "Date" TypeSuffix
 | - "RegExp" TypeSuffix
[77]ConstTypePrimitiveType Null
 | - identifier Null
[78]PrimitiveTypeUnsignedIntegerType
 | + "RegExp" TypeSuffix
[80]ConstTypePrimitiveType Null
 | + identifier Null
[81]PrimitiveTypeUnsignedIntegerType
 | UnrestrictedFloatType
 | "boolean"
 | "byte"
 | - "octet"
[79]UnrestrictedFloatType"unrestricted" FloatType
 | - FloatType
[80]FloatType"float"
 | - "double"
[81]UnsignedIntegerType"unsigned" IntegerType
 | - IntegerType
[82]IntegerType"short"
 | - "long" OptionalLong
[83]OptionalLong"long"
 | - ε
[84]PromiseType"Promise" "<" ReturnType ">"
[85]TypeSuffix"[" "]" TypeSuffix
 | + "octet"
[82]UnrestrictedFloatType"unrestricted" FloatType
 | + FloatType
[83]FloatType"float"
 | + "double"
[84]UnsignedIntegerType"unsigned" IntegerType
 | + IntegerType
[85]IntegerType"short"
 | + "long" OptionalLong
[86]OptionalLong"long"
 | + ε
[87]PromiseType"Promise" "<" ReturnType ">"
[88]TypeSuffix"[" "]" TypeSuffix
 | "?" TypeSuffixStartingWithArray
 | - ε
[86]TypeSuffixStartingWithArray"[" "]" TypeSuffix
 | - ε
[87]Null"?"
 | + ε
[89]TypeSuffixStartingWithArray"[" "]" TypeSuffix
 | + ε
[90]Null"?"
 | ε
@@ -5986,10 +6000,10 @@

3.10.26. Union types

type is formed by taking the type names of each member type, in order, and joining them with the string “Or”.

-
[73]UnionType"(" UnionMemberType "or" UnionMemberType UnionMemberTypes ")"
[74]UnionMemberTypeNonAnyType
 | +
[76]UnionType"(" UnionMemberType "or" UnionMemberType UnionMemberTypes ")"
[77]UnionMemberTypeNonAnyType
 | UnionType TypeSuffix
 | - "any" "[" "]" TypeSuffix
[75]UnionMemberTypes"or" UnionMemberType UnionMemberTypes
 | - ε
[76]NonAnyTypePrimitiveType TypeSuffix
 | + "any" "[" "]" TypeSuffix
[78]UnionMemberTypes"or" UnionMemberType UnionMemberTypes
 | + ε
[79]NonAnyTypePrimitiveType TypeSuffix
 | PromiseType Null
 | "ByteString" TypeSuffix
 | "DOMString" TypeSuffix
 | @@ -6174,9 +6188,9 @@

3.11. Extended attributes

are ambiguous, no extended attribute defined in this document takes both of those forms.-->

-
[63]ExtendedAttributeList"[" ExtendedAttribute ExtendedAttributes "]"
 | - ε
[64]ExtendedAttributes"," ExtendedAttribute ExtendedAttributes
 | - ε
[65]ExtendedAttribute +
[66]ExtendedAttributeList"[" ExtendedAttribute ExtendedAttributes "]"
 | + ε
[67]ExtendedAttributes"," ExtendedAttribute ExtendedAttributes
 | + ε
[68]ExtendedAttribute "(" ExtendedAttributeInner ")" ExtendedAttributeRest
 | "[" ExtendedAttributeInner "]" ExtendedAttributeRest @@ -6184,8 +6198,8 @@

3.11. Extended attributes

"{" ExtendedAttributeInner "}" ExtendedAttributeRest
 | Other ExtendedAttributeRest -
[66]ExtendedAttributeRestExtendedAttribute
 | - ε
[67]ExtendedAttributeInner +
[69]ExtendedAttributeRestExtendedAttribute
 | + ε
[70]ExtendedAttributeInner "(" ExtendedAttributeInner ")" ExtendedAttributeInner
 | "[" ExtendedAttributeInner "]" ExtendedAttributeInner @@ -6195,7 +6209,7 @@

3.11. Extended attributes

OtherOrComma ExtendedAttributeInner
 | ε -
[68]Other +
[71]Other integer
 | float
 | identifier
 | @@ -6240,9 +6254,9 @@

3.11. Extended attributes

"void"
 | ArgumentNameKeyword -
[70]OtherOrCommaOther
 | - ","
[89]IdentifierListidentifier Identifiers
[90]Identifiers"," identifier Identifiers
 | - ε
[91]ExtendedAttributeNoArgsidentifier
[92]ExtendedAttributeArgListidentifier "(" ArgumentList ")"
[93]ExtendedAttributeIdentidentifier "=" identifier
[94]ExtendedAttributeIdentListidentifier "=" "(" IdentifierList ")"
[95]ExtendedAttributeNamedArgListidentifier "=" identifier "(" ArgumentList ")"
[96]ExtendedAttributeTypePairidentifier "(" Type "," Type ")"
+
[73]OtherOrCommaOther
 | + ","
[92]IdentifierListidentifier Identifiers
[93]Identifiers"," identifier Identifiers
 | + ε
[94]ExtendedAttributeNoArgsidentifier
[95]ExtendedAttributeArgListidentifier "(" ArgumentList ")"
[96]ExtendedAttributeIdentidentifier "=" identifier
[97]ExtendedAttributeIdentListidentifier "=" "(" IdentifierList ")"
[98]ExtendedAttributeNamedArgListidentifier "=" identifier "(" ArgumentList ")"
[99]ExtendedAttributeTypePairidentifier "(" Type "," Type ")"
@@ -7405,6 +7419,14 @@

4.2.20. Dictionary types

  • Set the dictionary member on dict with key name key to the value idlValue. This dictionary member is considered to be present.
  • +
  • + Otherwise, if value is + undefined and the + dictionary + member is a + required dictionary + member, then throw a TypeError. +
  • @@ -14312,57 +14334,59 @@

    A. IDL grammar

    PartialDictionary
    [8]PartialInterface"interface" identifier "{" InterfaceMembers "}" ";"
    [9]InterfaceMembersExtendedAttributeList InterfaceMember InterfaceMembers
     | ε
    [10]InterfaceMemberConst
     | AttributeOrOperationOrIterator
    [11]Dictionary"dictionary" identifier Inheritance "{" DictionaryMembers "}" ";"
    [12]DictionaryMembersExtendedAttributeList DictionaryMember DictionaryMembers
     | - ε
    [13]DictionaryMemberType identifier Default ";"
    [14]PartialDictionary"dictionary" identifier "{" DictionaryMembers "}" ";"
    [15]Default"=" DefaultValue
     | - ε
    [16]DefaultValueConstValue
     | + ε
    [13]DictionaryMemberRequired Type identifier Default ";"
    [14]Required"required"
     | + ε
    [15]PartialDictionary"dictionary" identifier "{" DictionaryMembers "}" ";"
    [16]Default"=" DefaultValue
     | + ε
    [17]DefaultValueConstValue
     | string
     | - "[" "]"
    [17]Exception"exception" identifier Inheritance "{" ExceptionMembers "}" ";"
    [18]ExceptionMembersExtendedAttributeList ExceptionMember ExceptionMembers
     | - ε
    [19]Inheritance":" identifier
     | - ε
    [20]Enum"enum" identifier "{" EnumValueList "}" ";"
    [21]EnumValueListstring EnumValueListComma
    [22]EnumValueListComma"," EnumValueListString
     | - ε
    [23]EnumValueListStringstring EnumValueListComma
     | - ε
    [24]CallbackRestidentifier "=" ReturnType "(" ArgumentList ")" ";"
    [25]Typedef"typedef" Type identifier ";"
    [26]ImplementsStatementidentifier "implements" identifier ";"
    [27]Const"const" ConstType identifier "=" ConstValue ";"
    [28]ConstValueBooleanLiteral
     | + "[" "]"
    [18]Exception"exception" identifier Inheritance "{" ExceptionMembers "}" ";"
    [19]ExceptionMembersExtendedAttributeList ExceptionMember ExceptionMembers
     | + ε
    [20]Inheritance":" identifier
     | + ε
    [21]Enum"enum" identifier "{" EnumValueList "}" ";"
    [22]EnumValueListstring EnumValueListComma
    [23]EnumValueListComma"," EnumValueListString
     | + ε
    [24]EnumValueListStringstring EnumValueListComma
     | + ε
    [25]CallbackRestidentifier "=" ReturnType "(" ArgumentList ")" ";"
    [26]Typedef"typedef" Type identifier ";"
    [27]ImplementsStatementidentifier "implements" identifier ";"
    [28]Const"const" ConstType identifier "=" ConstValue ";"
    [29]ConstValueBooleanLiteral
     | FloatLiteral
     | integer
     | - "null"
    [29]BooleanLiteral"true"
     | - "false"
    [30]FloatLiteralfloat
     | + "null"
    [30]BooleanLiteral"true"
     | + "false"
    [31]FloatLiteralfloat
     | "-Infinity"
     | "Infinity"
     | - "NaN"
    [31]AttributeOrOperationOrIteratorSerializer
     | + "NaN"
    [32]AttributeOrOperationOrIteratorSerializer
     | Stringifier
     | StaticMember
     | Attribute
     | - OperationOrIterator
    [32]Serializer"serializer" SerializerRest
    [33]SerializerRestOperationRest
     | + OperationOrIterator
    [33]Serializer"serializer" SerializerRest
    [34]SerializerRestOperationRest
     | "=" SerializationPattern
     | - ε
    [34]SerializationPattern"{" SerializationPatternMap "}"
     | + ε
    [35]SerializationPattern"{" SerializationPatternMap "}"
     | "[" SerializationPatternList "]"
     | - identifier
    [35]SerializationPatternMap"getter"
     | + identifier
    [36]SerializationPatternMap"getter"
     | "inherit" Identifiers
     | identifier Identifiers
     | - ε
    [36]SerializationPatternList"getter"
     | + ε
    [37]SerializationPatternList"getter"
     | identifier Identifiers
     | - ε
    [37]Stringifier"stringifier" StringifierRest
    [38]StringifierRestAttributeRest
     | + ε
    [38]Stringifier"stringifier" StringifierRest
    [39]StringifierRestAttributeRest
     | ReturnType OperationRest
     | - ";"
    [39]StaticMember"static" StaticMemberRest
    [40]StaticMemberRestAttributeRest
     | - ReturnType OperationRest
    [41]AttributeInherit AttributeRest
    [42]AttributeRestReadOnly "attribute" Type identifier ";"
    [43]Inherit"inherit"
     | - ε
    [44]ReadOnly"readonly"
     | - ε
    [45]OperationOrIteratorReturnType OperationOrIteratorRest
     | - SpecialOperation
    [46]SpecialOperationSpecial Specials ReturnType OperationRest
    [47]SpecialsSpecial Specials
     | - ε
    [48]Special"getter"
     | + ";"
    [40]StaticMember"static" StaticMemberRest
    [41]StaticMemberRestAttributeRest
     | + ReturnType OperationRest
    [42]AttributeInherit AttributeRest
    [43]AttributeRestReadOnly "attribute" Type AttributeName ";"
    [44]AttributeNameAttributeNameKeyword
     | + identifier
    [45]AttributeNameKeyword"required"
    [46]Inherit"inherit"
     | + ε
    [47]ReadOnly"readonly"
     | + ε
    [48]OperationOrIteratorReturnType OperationOrIteratorRest
     | + SpecialOperation
    [49]SpecialOperationSpecial Specials ReturnType OperationRest
    [50]SpecialsSpecial Specials
     | + ε
    [51]Special"getter"
     | "setter"
     | "creator"
     | "deleter"
     | - "legacycaller"
    [49]OperationOrIteratorRestIteratorRest
     | - OperationRest
    [50]IteratorRest"iterator" OptionalIteratorInterfaceOrObject ";"
    [51]OptionalIteratorInterfaceOrObjectOptionalIteratorInterface
     | - "object"
    [52]OptionalIteratorInterface"=" identifier
     | - ε
    [53]OperationRestOptionalIdentifier "(" ArgumentList ")" ";"
    [54]OptionalIdentifieridentifier
     | - ε
    [55]ArgumentListArgument Arguments
     | - ε
    [56]Arguments"," Argument Arguments
     | - ε
    [57]ArgumentExtendedAttributeList OptionalOrRequiredArgument
    [58]OptionalOrRequiredArgument"optional" Type ArgumentName Default
     | - Type Ellipsis ArgumentName
    [59]ArgumentNameArgumentNameKeyword
     | - identifier
    [60]Ellipsis"..."
     | - ε
    [61]ExceptionMemberConst
     | - ExceptionField
    [62]ExceptionFieldType identifier ";"
    [63]ExtendedAttributeList"[" ExtendedAttribute ExtendedAttributes "]"
     | - ε
    [64]ExtendedAttributes"," ExtendedAttribute ExtendedAttributes
     | - ε
    [65]ExtendedAttribute + "legacycaller"
    [52]OperationOrIteratorRestIteratorRest
     | + OperationRest
    [53]IteratorRest"iterator" OptionalIteratorInterfaceOrObject ";"
    [54]OptionalIteratorInterfaceOrObjectOptionalIteratorInterface
     | + "object"
    [55]OptionalIteratorInterface"=" identifier
     | + ε
    [56]OperationRestOptionalIdentifier "(" ArgumentList ")" ";"
    [57]OptionalIdentifieridentifier
     | + ε
    [58]ArgumentListArgument Arguments
     | + ε
    [59]Arguments"," Argument Arguments
     | + ε
    [60]ArgumentExtendedAttributeList OptionalOrRequiredArgument
    [61]OptionalOrRequiredArgument"optional" Type ArgumentName Default
     | + Type Ellipsis ArgumentName
    [62]ArgumentNameArgumentNameKeyword
     | + identifier
    [63]Ellipsis"..."
     | + ε
    [64]ExceptionMemberConst
     | + ExceptionField
    [65]ExceptionFieldType identifier ";"
    [66]ExtendedAttributeList"[" ExtendedAttribute ExtendedAttributes "]"
     | + ε
    [67]ExtendedAttributes"," ExtendedAttribute ExtendedAttributes
     | + ε
    [68]ExtendedAttribute "(" ExtendedAttributeInner ")" ExtendedAttributeRest
     | "[" ExtendedAttributeInner "]" ExtendedAttributeRest @@ -14370,8 +14394,8 @@

    A. IDL grammar

    "{" ExtendedAttributeInner "}" ExtendedAttributeRest
     | Other ExtendedAttributeRest -
    [66]ExtendedAttributeRestExtendedAttribute
     | - ε
    [67]ExtendedAttributeInner +
    [69]ExtendedAttributeRestExtendedAttribute
     | + ε
    [70]ExtendedAttributeInner "(" ExtendedAttributeInner ")" ExtendedAttributeInner
     | "[" ExtendedAttributeInner "]" ExtendedAttributeInner @@ -14381,7 +14405,7 @@

    A. IDL grammar

    OtherOrComma ExtendedAttributeInner
     | ε -
    [68]Other +
    [71]Other integer
     | float
     | identifier
     | @@ -14426,7 +14450,7 @@

    A. IDL grammar

    "void"
     | ArgumentNameKeyword -
    [69]ArgumentNameKeyword +
    [72]ArgumentNameKeyword "attribute"
     | "callback"
     | "const"
     | @@ -14443,6 +14467,7 @@

    A. IDL grammar


     | "legacycaller"
     | "partial"
     | + "required"
     | "serializer"
     | "setter"
     | "static"
     | @@ -14450,13 +14475,13 @@

    A. IDL grammar

    "typedef"
     | "unrestricted" -
    [70]OtherOrCommaOther
     | - ","
    [71]TypeSingleType
     | - UnionType TypeSuffix
    [72]SingleTypeNonAnyType
     | - "any" TypeSuffixStartingWithArray
    [73]UnionType"(" UnionMemberType "or" UnionMemberType UnionMemberTypes ")"
    [74]UnionMemberTypeNonAnyType
     | +
    [73]OtherOrCommaOther
     | + ","
    [74]TypeSingleType
     | + UnionType TypeSuffix
    [75]SingleTypeNonAnyType
     | + "any" TypeSuffixStartingWithArray
    [76]UnionType"(" UnionMemberType "or" UnionMemberType UnionMemberTypes ")"
    [77]UnionMemberTypeNonAnyType
     | UnionType TypeSuffix
     | - "any" "[" "]" TypeSuffix
    [75]UnionMemberTypes"or" UnionMemberType UnionMemberTypes
     | - ε
    [76]NonAnyTypePrimitiveType TypeSuffix
     | + "any" "[" "]" TypeSuffix
    [78]UnionMemberTypes"or" UnionMemberType UnionMemberTypes
     | + ε
    [79]NonAnyTypePrimitiveType TypeSuffix
     | PromiseType Null
     | "ByteString" TypeSuffix
     | "DOMString" TypeSuffix
     | @@ -14464,23 +14489,23 @@

    A. IDL grammar

    "sequence" "<" Type ">" Null
     | "object" TypeSuffix
     | "Date" TypeSuffix
     | - "RegExp" TypeSuffix
    [77]ConstTypePrimitiveType Null
     | - identifier Null
    [78]PrimitiveTypeUnsignedIntegerType
     | + "RegExp" TypeSuffix
    [80]ConstTypePrimitiveType Null
     | + identifier Null
    [81]PrimitiveTypeUnsignedIntegerType
     | UnrestrictedFloatType
     | "boolean"
     | "byte"
     | - "octet"
    [79]UnrestrictedFloatType"unrestricted" FloatType
     | - FloatType
    [80]FloatType"float"
     | - "double"
    [81]UnsignedIntegerType"unsigned" IntegerType
     | - IntegerType
    [82]IntegerType"short"
     | - "long" OptionalLong
    [83]OptionalLong"long"
     | - ε
    [84]PromiseType"Promise" "<" ReturnType ">"
    [85]TypeSuffix"[" "]" TypeSuffix
     | + "octet"
    [82]UnrestrictedFloatType"unrestricted" FloatType
     | + FloatType
    [83]FloatType"float"
     | + "double"
    [84]UnsignedIntegerType"unsigned" IntegerType
     | + IntegerType
    [85]IntegerType"short"
     | + "long" OptionalLong
    [86]OptionalLong"long"
     | + ε
    [87]PromiseType"Promise" "<" ReturnType ">"
    [88]TypeSuffix"[" "]" TypeSuffix
     | "?" TypeSuffixStartingWithArray
     | - ε
    [86]TypeSuffixStartingWithArray"[" "]" TypeSuffix
     | - ε
    [87]Null"?"
     | - ε
    [88]ReturnTypeType
     | - "void"
    [89]IdentifierListidentifier Identifiers
    [90]Identifiers"," identifier Identifiers
     | - ε
    [91]ExtendedAttributeNoArgsidentifier
    [92]ExtendedAttributeArgListidentifier "(" ArgumentList ")"
    [93]ExtendedAttributeIdentidentifier "=" identifier
    [94]ExtendedAttributeIdentListidentifier "=" "(" IdentifierList ")"
    [95]ExtendedAttributeNamedArgListidentifier "=" identifier "(" ArgumentList ")"
    [96]ExtendedAttributeTypePairidentifier "(" Type "," Type ")"
    + ε
    [89]TypeSuffixStartingWithArray"[" "]" TypeSuffix
     | + ε
    [90]Null"?"
     | + ε
    [91]ReturnTypeType
     | + "void"
    [92]IdentifierListidentifier Identifiers
    [93]Identifiers"," identifier Identifiers
     | + ε
    [94]ExtendedAttributeNoArgsidentifier
    [95]ExtendedAttributeArgListidentifier "(" ArgumentList ")"
    [96]ExtendedAttributeIdentidentifier "=" identifier
    [97]ExtendedAttributeIdentListidentifier "=" "(" IdentifierList ")"
    [98]ExtendedAttributeNamedArgListidentifier "=" identifier "(" ArgumentList ")"
    [99]ExtendedAttributeTypePairidentifier "(" Type "," Type ")"
    Note

    The Other @@ -14774,6 +14799,11 @@

    C. Changes

    +
  • +

    + Added a way to mark dictionary members as required. +

    +
  • Allowed hyphens in identifiers after the first character. diff --git a/index.xml b/index.xml index 516bad0b..8a3dd11d 100644 --- a/index.xml +++ b/index.xml @@ -4053,7 +4053,8 @@ dictionary Derived : Base { A dictionary value of type D can have key–value pairs corresponding to the dictionary members defined on D and on any of D’s inherited dictionaries. - On a given dictionary value, the presence of each dictionary member is optional. + On a given dictionary value, the presence of each dictionary member + is optional, unless that member is specified as required. When specified in the dictionary value, a dictionary member is said to be present, otherwise it is not present. Dictionary members can also optionally have a default value, which is @@ -4109,6 +4110,17 @@ dictionary Derived : Base { default value if specified MUST be one of the enumeration’s values.

    +

    + If the type of the dictionary member is preceded by the + required keyword, the member is considered a + required dictionary member + and must be present on the dictionary. A + required dictionary + member MUST NOT have a default value. +

    +
    dictionary identifier {
    +  required type identifier;
    +};

    The type of a dictionary member MUST NOT include the dictionary it appears on. A type includes a dictionary D @@ -7216,6 +7228,15 @@ iframe.appendChild instanceof w.Function; // Evaluates to

  • Set the dictionary member on dict with key name key to the value idlValue. This dictionary member is considered to be present.
  • +
  • + Otherwise, if value is + undefined and the + dictionary + member is a + required dictionary + member, then throw a TypeError. +
  • @@ -14125,7 +14146,8 @@ d.type = et; Const | AttributeOrOperationOrIterator "dictionary" identifier Inheritance "{" DictionaryMembers "}" ";" ExtendedAttributeList DictionaryMember DictionaryMembers | ε - Type identifier Default ";" + Required Type identifier Default ";" + "required" | ε "dictionary" identifier "{" DictionaryMembers "}" ";" "=" DefaultValue | ε ConstValue | string | "[" "]" @@ -14154,7 +14176,9 @@ d.type = et; "static" StaticMemberRest AttributeRest | ReturnType OperationRest Inherit AttributeRest - ReadOnly "attribute" Type identifier ";" + ReadOnly "attribute" Type AttributeName ";" + AttributeNameKeyword | identifier + "required" "inherit" | ε "readonly" | ε +
  • +

    + Added a way to mark dictionary members as required. +

    +
  • Allowed hyphens in identifiers after the first character. diff --git a/v1.html b/v1.html index 5b9977ad..8f87c770 100644 --- a/v1.html +++ b/v1.html @@ -19,7 +19,7 @@ -

    W3C

    Web IDL

    W3C Editor’s Draft 5 August 2014

    This Version:
    http://heycam.github.io/webidl/v1.html
    Latest Version:
    http://www.w3.org/TR/WebIDL/
    Previous Versions:
    http://www.w3.org/TR/2012/CR-WebIDL-20120419/
    http://www.w3.org/TR/2012/WD-WebIDL-20120207/
    http://www.w3.org/TR/2011/WD-WebIDL-20110927/
    http://www.w3.org/TR/2011/WD-WebIDL-20110712/
    http://www.w3.org/TR/2010/WD-WebIDL-20101021/
    http://www.w3.org/TR/2008/WD-WebIDL-20081219/
    http://www.w3.org/TR/2008/WD-WebIDL-20080829/
    http://www.w3.org/TR/2008/WD-DOM-Bindings-20080410/
    http://www.w3.org/TR/2007/WD-DOM-Bindings-20071017/
    Participate:
    +
    @@ -72,7 +72,7 @@

    Status of This Document

    report can be found in the W3C technical reports index at http://www.w3.org/TR/.

    - This document is the 5 August 2014 Editor’s Draft of the + This document is the 24 August 2014 Editor’s Draft of the Web IDL specification. Please send comments about this document to @@ -516,7 +516,7 @@

    3.1. Names

    underscore.

    return-type operation-identifier(argument-type argument-identifier, …);
    -
    [56]ArgumentNameKeyword +
    [59]ArgumentNameKeyword "attribute"
     | "callback"
     | "const"
     | @@ -533,6 +533,7 @@

    3.1. Names


     | "legacycaller"
     | "partial"
     | + "required"
     | "setter"
     | "static"
     | "stringifier"
     | @@ -1010,7 +1011,7 @@

    3.2. Interfaces

    Interface
    [5]Interface"interface" identifier Inheritance "{" InterfaceMembers "}" ";"
    [6]Partial"partial" PartialDefinition
    [7]PartialDefinitionPartialInterface
     | PartialDictionary
    [8]PartialInterface"interface" identifier "{" InterfaceMembers "}" ";"
    [9]InterfaceMembersExtendedAttributeList InterfaceMember InterfaceMembers
     | ε
    [10]InterfaceMemberConst
     | - AttributeOrOperation
    [19]Inheritance":" identifier
     | + AttributeOrOperation
    [20]Inheritance":" identifier
     | ε
    Example
    @@ -1288,14 +1289,14 @@

    3.2.1. Constants

    [Exposed].

    -
    [27]Const"const" ConstType identifier "=" ConstValue ";"
    [28]ConstValueBooleanLiteral
     | +
    [28]Const"const" ConstType identifier "=" ConstValue ";"
    [29]ConstValueBooleanLiteral
     | FloatLiteral
     | integer
     | - "null"
    [29]BooleanLiteral"true"
     | - "false"
    [30]FloatLiteralfloat
     | + "null"
    [30]BooleanLiteral"true"
     | + "false"
    [31]FloatLiteralfloat
     | "-Infinity"
     | "Infinity"
     | - "NaN"
    [64]ConstTypePrimitiveType Null
     | + "NaN"
    [67]ConstTypePrimitiveType Null
     | identifier Null
    Example

    @@ -1441,12 +1442,12 @@

    3.2.2. Attributes

    -
    [31]AttributeOrOperation"stringifier" StringifierAttributeOrOperation
     | +
    [32]AttributeOrOperation"stringifier" StringifierAttributeOrOperation
     | Attribute
     | - Operation
    [32]StringifierAttributeOrOperationAttribute
     | + Operation
    [33]StringifierAttributeOrOperationAttribute
     | OperationRest
     | - ";"
    [33]AttributeInherit ReadOnly "attribute" Type identifier ";"
    [34]Inherit"inherit"
     | - ε
    [35]ReadOnly"readonly"
     | + ";"
    [34]AttributeInherit ReadOnly "attribute" Type AttributeName ";"
    [37]Inherit"inherit"
     | + ε
    [38]ReadOnly"readonly"
     | ε
    Example
    @@ -1802,24 +1803,24 @@

    3.2.3. Operations

    -
    [16]DefaultValueConstValue
     | - string
    [31]AttributeOrOperation"stringifier" StringifierAttributeOrOperation
     | +
    [17]DefaultValueConstValue
     | + string
    [32]AttributeOrOperation"stringifier" StringifierAttributeOrOperation
     | Attribute
     | - Operation
    [32]StringifierAttributeOrOperationAttribute
     | + Operation
    [33]StringifierAttributeOrOperationAttribute
     | OperationRest
     | - ";"
    [36]OperationQualifiers OperationRest
    [37]Qualifiers"static"
     | - Specials
    [38]SpecialsSpecial Specials
     | - ε
    [39]Special"getter"
     | + ";"
    [39]OperationQualifiers OperationRest
    [40]Qualifiers"static"
     | + Specials
    [41]SpecialsSpecial Specials
     | + ε
    [42]Special"getter"
     | "setter"
     | "creator"
     | "deleter"
     | - "legacycaller"
    [40]OperationRestReturnType OptionalIdentifier "(" ArgumentList ")" ";"
    [41]OptionalIdentifieridentifier
     | - ε
    [42]ArgumentListArgument Arguments
     | - ε
    [43]Arguments"," Argument Arguments
     | - ε
    [44]ArgumentExtendedAttributeList OptionalOrRequiredArgument
    [45]OptionalOrRequiredArgument"optional" Type ArgumentName Default
     | - Type Ellipsis ArgumentName
    [46]ArgumentNameArgumentNameKeyword
     | - identifier
    [47]Ellipsis"..."
     | - ε
    [56]ArgumentNameKeyword + "legacycaller"
    [43]OperationRestReturnType OptionalIdentifier "(" ArgumentList ")" ";"
    [44]OptionalIdentifieridentifier
     | + ε
    [45]ArgumentListArgument Arguments
     | + ε
    [46]Arguments"," Argument Arguments
     | + ε
    [47]ArgumentExtendedAttributeList OptionalOrRequiredArgument
    [48]OptionalOrRequiredArgument"optional" Type ArgumentName Default
     | + Type Ellipsis ArgumentName
    [49]ArgumentNameArgumentNameKeyword
     | + identifier
    [50]Ellipsis"..."
     | + ε
    [59]ArgumentNameKeyword "attribute"
     | "callback"
     | "const"
     | @@ -1836,13 +1837,14 @@

    3.2.3. Operations


     | "legacycaller"
     | "partial"
     | + "required"
     | "setter"
     | "static"
     | "stringifier"
     | "typedef"
     | "unrestricted" -
    [74]ReturnTypeType
     | +
    [77]ReturnTypeType
     | "void"
    @@ -3244,7 +3246,8 @@

    3.3. Dictionaries

    A dictionary value of type D can have key–value pairs corresponding to the dictionary members defined on D and on any of D’s inherited dictionaries. - On a given dictionary value, the presence of each dictionary member is optional. + On a given dictionary value, the presence of each dictionary member + is optional, unless that member is specified as required. When specified in the dictionary value, a dictionary member is said to be present, otherwise it is not present. Dictionary members can also optionally have a default value, which is @@ -3299,6 +3302,17 @@

    3.3. Dictionaries

    default value if specified MUST be one of the enumeration’s values.

    +

    + If the type of the dictionary member is preceded by the + required keyword, the member is considered a + required dictionary member + and must be present on the dictionary. A + required dictionary + member MUST NOT have a default value. +

    +
    dictionary identifier {
    +  required type identifier;
    +};

    The type of a dictionary member MUST NOT include the dictionary it appears on. A type includes a dictionary D @@ -3423,9 +3437,9 @@

    3.3. Dictionaries

    [6]Partial"partial" PartialDefinition
    [7]PartialDefinitionPartialInterface
     | PartialDictionary
    [11]Dictionary"dictionary" identifier Inheritance "{" DictionaryMembers "}" ";"
    [12]DictionaryMembersExtendedAttributeList DictionaryMember DictionaryMembers
     | - ε
    [13]DictionaryMemberType identifier Default ";"
    [14]PartialDictionary"dictionary" identifier "{" DictionaryMembers "}" ";"
    [15]Default"=" DefaultValue
     | - ε
    [16]DefaultValueConstValue
     | - string
    [19]Inheritance":" identifier
     | + ε
    [13]DictionaryMemberRequired Type identifier Default ";"
    [15]PartialDictionary"dictionary" identifier "{" DictionaryMembers "}" ";"
    [16]Default"=" DefaultValue
     | + ε
    [17]DefaultValueConstValue
     | + string
    [20]Inheritance":" identifier
     | ε
    Example

    @@ -3653,10 +3667,10 @@

    3.4. Exceptions

    No extended attributes defined in this specification are applicable to exception fields.

    -
    [17]Exception"exception" identifier Inheritance "{" ExceptionMembers "}" ";"
    [18]ExceptionMembersExtendedAttributeList ExceptionMember ExceptionMembers
     | - ε
    [19]Inheritance":" identifier
     | - ε
    [48]ExceptionMemberConst
     | - ExceptionField
    [49]ExceptionFieldType identifier ";"
    +
    [18]Exception"exception" identifier Inheritance "{" ExceptionMembers "}" ";"
    [19]ExceptionMembersExtendedAttributeList ExceptionMember ExceptionMembers
     | + ε
    [20]Inheritance":" identifier
     | + ε
    [51]ExceptionMemberConst
     | + ExceptionField
    [52]ExceptionFieldType identifier ";"
    Example

    The following example demonstrates how a reduced version of DOM Core’s @@ -3768,8 +3782,8 @@

    3.5. Enumerations

    defined in this specification are applicable to enumerations.

    -
    [20]Enum"enum" identifier "{" EnumValueList "}" ";"
    [21]EnumValueListstring EnumValueListComma
    [22]EnumValueListComma"," EnumValueListString
     | - ε
    [23]EnumValueListStringstring EnumValueListComma
     | +
    [21]Enum"enum" identifier "{" EnumValueList "}" ";"
    [22]EnumValueListstring EnumValueListComma
    [23]EnumValueListComma"," EnumValueListString
     | + ε
    [24]EnumValueListStringstring EnumValueListComma
     | ε
    Example
    @@ -3836,7 +3850,7 @@

    3.6. Callback functions

    [3]CallbackOrInterface"callback" CallbackRestOrInterface
     | Interface
    [4]CallbackRestOrInterfaceCallbackRest
     | - Interface
    [24]CallbackRestidentifier "=" ReturnType "(" ArgumentList ")" ";"
    + Interface
    [25]CallbackRestidentifier "=" ReturnType "(" ArgumentList ")" ";"
    Example

    @@ -3887,7 +3901,7 @@

    3.7. Typedefs

    defined in this specification are applicable to typedefs.

    -
    [25]Typedef"typedef" Type identifier ";"
    +
    [26]Typedef"typedef" Type identifier ";"
    Example

    @@ -4031,7 +4045,7 @@

    3.8. Implements statements

    implements statements.

    -
    [26]ImplementsStatementidentifier "implements" identifier ";"
    +
    [27]ImplementsStatementidentifier "implements" identifier ";"
    Example

    @@ -4249,30 +4263,30 @@

    3.10. Types

    assign to the attribute.

    -
    [58]TypeSingleType
     | - UnionType TypeSuffix
    [59]SingleTypeNonAnyType
     | - "any" TypeSuffixStartingWithArray
    [60]UnionType"(" UnionMemberType "or" UnionMemberType UnionMemberTypes ")"
    [61]UnionMemberTypeNonAnyType
     | +
    [61]TypeSingleType
     | + UnionType TypeSuffix
    [62]SingleTypeNonAnyType
     | + "any" TypeSuffixStartingWithArray
    [63]UnionType"(" UnionMemberType "or" UnionMemberType UnionMemberTypes ")"
    [64]UnionMemberTypeNonAnyType
     | UnionType TypeSuffix
     | - "any" "[" "]" TypeSuffix
    [62]UnionMemberTypes"or" UnionMemberType UnionMemberTypes
     | - ε
    [63]NonAnyTypePrimitiveType TypeSuffix
     | + "any" "[" "]" TypeSuffix
    [65]UnionMemberTypes"or" UnionMemberType UnionMemberTypes
     | + ε
    [66]NonAnyTypePrimitiveType TypeSuffix
     | "DOMString" TypeSuffix
     | identifier TypeSuffix
     | "sequence" "<" Type ">" Null
     | "object" TypeSuffix
     | - "Date" TypeSuffix
    [64]ConstTypePrimitiveType Null
     | - identifier Null
    [65]PrimitiveTypeUnsignedIntegerType
     | + "Date" TypeSuffix
    [67]ConstTypePrimitiveType Null
     | + identifier Null
    [68]PrimitiveTypeUnsignedIntegerType
     | UnrestrictedFloatType
     | "boolean"
     | "byte"
     | - "octet"
    [66]UnrestrictedFloatType"unrestricted" FloatType
     | - FloatType
    [67]FloatType"float"
     | - "double"
    [68]UnsignedIntegerType"unsigned" IntegerType
     | - IntegerType
    [69]IntegerType"short"
     | - "long" OptionalLong
    [70]OptionalLong"long"
     | - ε
    [71]TypeSuffix"[" "]" TypeSuffix
     | + "octet"
    [69]UnrestrictedFloatType"unrestricted" FloatType
     | + FloatType
    [70]FloatType"float"
     | + "double"
    [71]UnsignedIntegerType"unsigned" IntegerType
     | + IntegerType
    [72]IntegerType"short"
     | + "long" OptionalLong
    [73]OptionalLong"long"
     | + ε
    [74]TypeSuffix"[" "]" TypeSuffix
     | "?" TypeSuffixStartingWithArray
     | - ε
    [72]TypeSuffixStartingWithArray"[" "]" TypeSuffix
     | - ε
    [73]Null"?"
     | + ε
    [75]TypeSuffixStartingWithArray"[" "]" TypeSuffix
     | + ε
    [76]Null"?"
     | ε
    @@ -5040,10 +5054,10 @@

    3.10.24. Union types

    type is formed by taking the type names of each member type, in order, and joining them with the string “Or”.

    -
    [60]UnionType"(" UnionMemberType "or" UnionMemberType UnionMemberTypes ")"
    [61]UnionMemberTypeNonAnyType
     | +
    [63]UnionType"(" UnionMemberType "or" UnionMemberType UnionMemberTypes ")"
    [64]UnionMemberTypeNonAnyType
     | UnionType TypeSuffix
     | - "any" "[" "]" TypeSuffix
    [62]UnionMemberTypes"or" UnionMemberType UnionMemberTypes
     | - ε
    [63]NonAnyTypePrimitiveType TypeSuffix
     | + "any" "[" "]" TypeSuffix
    [65]UnionMemberTypes"or" UnionMemberType UnionMemberTypes
     | + ε
    [66]NonAnyTypePrimitiveType TypeSuffix
     | "DOMString" TypeSuffix
     | identifier TypeSuffix
     | "sequence" "<" Type ">" Null
     | @@ -5195,9 +5209,9 @@

    3.11. Extended attributes

    are ambiguous, no extended attribute defined in this document takes both of those forms.-->

    -
    [50]ExtendedAttributeList"[" ExtendedAttribute ExtendedAttributes "]"
     | - ε
    [51]ExtendedAttributes"," ExtendedAttribute ExtendedAttributes
     | - ε
    [52]ExtendedAttribute +
    [53]ExtendedAttributeList"[" ExtendedAttribute ExtendedAttributes "]"
     | + ε
    [54]ExtendedAttributes"," ExtendedAttribute ExtendedAttributes
     | + ε
    [55]ExtendedAttribute "(" ExtendedAttributeInner ")" ExtendedAttributeRest
     | "[" ExtendedAttributeInner "]" ExtendedAttributeRest @@ -5205,8 +5219,8 @@

    3.11. Extended attributes

    "{" ExtendedAttributeInner "}" ExtendedAttributeRest
     | Other ExtendedAttributeRest -
    [53]ExtendedAttributeRestExtendedAttribute
     | - ε
    [54]ExtendedAttributeInner +
    [56]ExtendedAttributeRestExtendedAttribute
     | + ε
    [57]ExtendedAttributeInner "(" ExtendedAttributeInner ")" ExtendedAttributeInner
     | "[" ExtendedAttributeInner "]" ExtendedAttributeInner @@ -5216,7 +5230,7 @@

    3.11. Extended attributes

    OtherOrComma ExtendedAttributeInner
     | ε -
    [55]Other +
    [58]Other integer
     | float
     | identifier
     | @@ -5259,9 +5273,9 @@

    3.11. Extended attributes

    "void"
     | ArgumentNameKeyword -
    [57]OtherOrCommaOther
     | - ","
    [75]IdentifierListidentifier Identifiers
    [76]Identifiers"," identifier Identifiers
     | - ε
    [77]ExtendedAttributeNoArgsidentifier
    [78]ExtendedAttributeArgListidentifier "(" ArgumentList ")"
    [79]ExtendedAttributeIdentidentifier "=" identifier
    [80]ExtendedAttributeIdentListidentifier "=" "(" IdentifierList ")"
    [81]ExtendedAttributeNamedArgListidentifier "=" identifier "(" ArgumentList ")"
    +
    [60]OtherOrCommaOther
     | + ","
    [78]IdentifierListidentifier Identifiers
    [79]Identifiers"," identifier Identifiers
     | + ε
    [80]ExtendedAttributeNoArgsidentifier
    [81]ExtendedAttributeArgListidentifier "(" ArgumentList ")"
    [82]ExtendedAttributeIdentidentifier "=" identifier
    [83]ExtendedAttributeIdentListidentifier "=" "(" IdentifierList ")"
    [84]ExtendedAttributeNamedArgListidentifier "=" identifier "(" ArgumentList ")"
    @@ -6370,6 +6384,14 @@

    4.2.19. Dictionary types

  • Set the dictionary member on dict with key name key to the value idlValue. This dictionary member is considered to be present.
  • +
  • + Otherwise, if value is + undefined and the + dictionary + member is a + required dictionary + member, then throw a TypeError. +
  • @@ -11879,41 +11901,43 @@

    A. IDL grammar

    PartialDictionary
    [8]PartialInterface"interface" identifier "{" InterfaceMembers "}" ";"
    [9]InterfaceMembersExtendedAttributeList InterfaceMember InterfaceMembers
     | ε
    [10]InterfaceMemberConst
     | AttributeOrOperation
    [11]Dictionary"dictionary" identifier Inheritance "{" DictionaryMembers "}" ";"
    [12]DictionaryMembersExtendedAttributeList DictionaryMember DictionaryMembers
     | - ε
    [13]DictionaryMemberType identifier Default ";"
    [14]PartialDictionary"dictionary" identifier "{" DictionaryMembers "}" ";"
    [15]Default"=" DefaultValue
     | - ε
    [16]DefaultValueConstValue
     | - string
    [17]Exception"exception" identifier Inheritance "{" ExceptionMembers "}" ";"
    [18]ExceptionMembersExtendedAttributeList ExceptionMember ExceptionMembers
     | - ε
    [19]Inheritance":" identifier
     | - ε
    [20]Enum"enum" identifier "{" EnumValueList "}" ";"
    [21]EnumValueListstring EnumValueListComma
    [22]EnumValueListComma"," EnumValueListString
     | - ε
    [23]EnumValueListStringstring EnumValueListComma
     | - ε
    [24]CallbackRestidentifier "=" ReturnType "(" ArgumentList ")" ";"
    [25]Typedef"typedef" Type identifier ";"
    [26]ImplementsStatementidentifier "implements" identifier ";"
    [27]Const"const" ConstType identifier "=" ConstValue ";"
    [28]ConstValueBooleanLiteral
     | + ε
    [13]DictionaryMemberRequired Type identifier Default ";"
    [14]Required"required"
     | + ε
    [15]PartialDictionary"dictionary" identifier "{" DictionaryMembers "}" ";"
    [16]Default"=" DefaultValue
     | + ε
    [17]DefaultValueConstValue
     | + string
    [18]Exception"exception" identifier Inheritance "{" ExceptionMembers "}" ";"
    [19]ExceptionMembersExtendedAttributeList ExceptionMember ExceptionMembers
     | + ε
    [20]Inheritance":" identifier
     | + ε
    [21]Enum"enum" identifier "{" EnumValueList "}" ";"
    [22]EnumValueListstring EnumValueListComma
    [23]EnumValueListComma"," EnumValueListString
     | + ε
    [24]EnumValueListStringstring EnumValueListComma
     | + ε
    [25]CallbackRestidentifier "=" ReturnType "(" ArgumentList ")" ";"
    [26]Typedef"typedef" Type identifier ";"
    [27]ImplementsStatementidentifier "implements" identifier ";"
    [28]Const"const" ConstType identifier "=" ConstValue ";"
    [29]ConstValueBooleanLiteral
     | FloatLiteral
     | integer
     | - "null"
    [29]BooleanLiteral"true"
     | - "false"
    [30]FloatLiteralfloat
     | + "null"
    [30]BooleanLiteral"true"
     | + "false"
    [31]FloatLiteralfloat
     | "-Infinity"
     | "Infinity"
     | - "NaN"
    [31]AttributeOrOperation"stringifier" StringifierAttributeOrOperation
     | + "NaN"
    [32]AttributeOrOperation"stringifier" StringifierAttributeOrOperation
     | Attribute
     | - Operation
    [32]StringifierAttributeOrOperationAttribute
     | + Operation
    [33]StringifierAttributeOrOperationAttribute
     | OperationRest
     | - ";"
    [33]AttributeInherit ReadOnly "attribute" Type identifier ";"
    [34]Inherit"inherit"
     | - ε
    [35]ReadOnly"readonly"
     | - ε
    [36]OperationQualifiers OperationRest
    [37]Qualifiers"static"
     | - Specials
    [38]SpecialsSpecial Specials
     | - ε
    [39]Special"getter"
     | + ";"
    [34]AttributeInherit ReadOnly "attribute" Type AttributeName ";"
    [35]AttributeNameAttributeNameKeyword
     | + identifier
    [36]AttributeNameKeyword"required"
    [37]Inherit"inherit"
     | + ε
    [38]ReadOnly"readonly"
     | + ε
    [39]OperationQualifiers OperationRest
    [40]Qualifiers"static"
     | + Specials
    [41]SpecialsSpecial Specials
     | + ε
    [42]Special"getter"
     | "setter"
     | "creator"
     | "deleter"
     | - "legacycaller"
    [40]OperationRestReturnType OptionalIdentifier "(" ArgumentList ")" ";"
    [41]OptionalIdentifieridentifier
     | - ε
    [42]ArgumentListArgument Arguments
     | - ε
    [43]Arguments"," Argument Arguments
     | - ε
    [44]ArgumentExtendedAttributeList OptionalOrRequiredArgument
    [45]OptionalOrRequiredArgument"optional" Type ArgumentName Default
     | - Type Ellipsis ArgumentName
    [46]ArgumentNameArgumentNameKeyword
     | - identifier
    [47]Ellipsis"..."
     | - ε
    [48]ExceptionMemberConst
     | - ExceptionField
    [49]ExceptionFieldType identifier ";"
    [50]ExtendedAttributeList"[" ExtendedAttribute ExtendedAttributes "]"
     | - ε
    [51]ExtendedAttributes"," ExtendedAttribute ExtendedAttributes
     | - ε
    [52]ExtendedAttribute + "legacycaller"
    [43]OperationRestReturnType OptionalIdentifier "(" ArgumentList ")" ";"
    [44]OptionalIdentifieridentifier
     | + ε
    [45]ArgumentListArgument Arguments
     | + ε
    [46]Arguments"," Argument Arguments
     | + ε
    [47]ArgumentExtendedAttributeList OptionalOrRequiredArgument
    [48]OptionalOrRequiredArgument"optional" Type ArgumentName Default
     | + Type Ellipsis ArgumentName
    [49]ArgumentNameArgumentNameKeyword
     | + identifier
    [50]Ellipsis"..."
     | + ε
    [51]ExceptionMemberConst
     | + ExceptionField
    [52]ExceptionFieldType identifier ";"
    [53]ExtendedAttributeList"[" ExtendedAttribute ExtendedAttributes "]"
     | + ε
    [54]ExtendedAttributes"," ExtendedAttribute ExtendedAttributes
     | + ε
    [55]ExtendedAttribute "(" ExtendedAttributeInner ")" ExtendedAttributeRest
     | "[" ExtendedAttributeInner "]" ExtendedAttributeRest @@ -11921,8 +11945,8 @@

    A. IDL grammar

    "{" ExtendedAttributeInner "}" ExtendedAttributeRest
     | Other ExtendedAttributeRest -
    [53]ExtendedAttributeRestExtendedAttribute
     | - ε
    [54]ExtendedAttributeInner +
    [56]ExtendedAttributeRestExtendedAttribute
     | + ε
    [57]ExtendedAttributeInner "(" ExtendedAttributeInner ")" ExtendedAttributeInner
     | "[" ExtendedAttributeInner "]" ExtendedAttributeInner @@ -11932,7 +11956,7 @@

    A. IDL grammar

    OtherOrComma ExtendedAttributeInner
     | ε -
    [55]Other +
    [58]Other integer
     | float
     | identifier
     | @@ -11975,7 +11999,7 @@

    A. IDL grammar

    "void"
     | ArgumentNameKeyword -
    [56]ArgumentNameKeyword +
    [59]ArgumentNameKeyword "attribute"
     | "callback"
     | "const"
     | @@ -11992,40 +12016,41 @@

    A. IDL grammar


     | "legacycaller"
     | "partial"
     | + "required"
     | "setter"
     | "static"
     | "stringifier"
     | "typedef"
     | "unrestricted" -
    [57]OtherOrCommaOther
     | - ","
    [58]TypeSingleType
     | - UnionType TypeSuffix
    [59]SingleTypeNonAnyType
     | - "any" TypeSuffixStartingWithArray
    [60]UnionType"(" UnionMemberType "or" UnionMemberType UnionMemberTypes ")"
    [61]UnionMemberTypeNonAnyType
     | +
    [60]OtherOrCommaOther
     | + ","
    [61]TypeSingleType
     | + UnionType TypeSuffix
    [62]SingleTypeNonAnyType
     | + "any" TypeSuffixStartingWithArray
    [63]UnionType"(" UnionMemberType "or" UnionMemberType UnionMemberTypes ")"
    [64]UnionMemberTypeNonAnyType
     | UnionType TypeSuffix
     | - "any" "[" "]" TypeSuffix
    [62]UnionMemberTypes"or" UnionMemberType UnionMemberTypes
     | - ε
    [63]NonAnyTypePrimitiveType TypeSuffix
     | + "any" "[" "]" TypeSuffix
    [65]UnionMemberTypes"or" UnionMemberType UnionMemberTypes
     | + ε
    [66]NonAnyTypePrimitiveType TypeSuffix
     | "DOMString" TypeSuffix
     | identifier TypeSuffix
     | "sequence" "<" Type ">" Null
     | "object" TypeSuffix
     | - "Date" TypeSuffix
    [64]ConstTypePrimitiveType Null
     | - identifier Null
    [65]PrimitiveTypeUnsignedIntegerType
     | + "Date" TypeSuffix
    [67]ConstTypePrimitiveType Null
     | + identifier Null
    [68]PrimitiveTypeUnsignedIntegerType
     | UnrestrictedFloatType
     | "boolean"
     | "byte"
     | - "octet"
    [66]UnrestrictedFloatType"unrestricted" FloatType
     | - FloatType
    [67]FloatType"float"
     | - "double"
    [68]UnsignedIntegerType"unsigned" IntegerType
     | - IntegerType
    [69]IntegerType"short"
     | - "long" OptionalLong
    [70]OptionalLong"long"
     | - ε
    [71]TypeSuffix"[" "]" TypeSuffix
     | + "octet"
    [69]UnrestrictedFloatType"unrestricted" FloatType
     | + FloatType
    [70]FloatType"float"
     | + "double"
    [71]UnsignedIntegerType"unsigned" IntegerType
     | + IntegerType
    [72]IntegerType"short"
     | + "long" OptionalLong
    [73]OptionalLong"long"
     | + ε
    [74]TypeSuffix"[" "]" TypeSuffix
     | "?" TypeSuffixStartingWithArray
     | - ε
    [72]TypeSuffixStartingWithArray"[" "]" TypeSuffix
     | - ε
    [73]Null"?"
     | - ε
    [74]ReturnTypeType
     | - "void"
    [75]IdentifierListidentifier Identifiers
    [76]Identifiers"," identifier Identifiers
     | - ε
    [77]ExtendedAttributeNoArgsidentifier
    [78]ExtendedAttributeArgListidentifier "(" ArgumentList ")"
    [79]ExtendedAttributeIdentidentifier "=" identifier
    [80]ExtendedAttributeIdentListidentifier "=" "(" IdentifierList ")"
    [81]ExtendedAttributeNamedArgListidentifier "=" identifier "(" ArgumentList ")"
    + ε
    [75]TypeSuffixStartingWithArray"[" "]" TypeSuffix
     | + ε
    [76]Null"?"
     | + ε
    [77]ReturnTypeType
     | + "void"
    [78]IdentifierListidentifier Identifiers
    [79]Identifiers"," identifier Identifiers
     | + ε
    [80]ExtendedAttributeNoArgsidentifier
    [81]ExtendedAttributeArgListidentifier "(" ArgumentList ")"
    [82]ExtendedAttributeIdentidentifier "=" identifier
    [83]ExtendedAttributeIdentListidentifier "=" "(" IdentifierList ")"
    [84]ExtendedAttributeNamedArgListidentifier "=" identifier "(" ArgumentList ")"
    Note

    The Other @@ -12218,6 +12243,11 @@

    D. Changes

    Current editor’s draft
      +
    • +

      + Added a way to mark dictionary members as required. +

      +
    • Allowed hyphens in identifiers after the first character. diff --git a/v1.xml b/v1.xml index b7cca4d4..fcd9e9a5 100644 --- a/v1.xml +++ b/v1.xml @@ -3186,7 +3186,8 @@ dictionary Derived : Base { A dictionary value of type D can have key–value pairs corresponding to the dictionary members defined on D and on any of D’s inherited dictionaries. - On a given dictionary value, the presence of each dictionary member is optional. + On a given dictionary value, the presence of each dictionary member + is optional, unless that member is specified as required. When specified in the dictionary value, a dictionary member is said to be present, otherwise it is not present. Dictionary members can also optionally have a default value, which is @@ -3241,6 +3242,17 @@ dictionary Derived : Base { default value if specified MUST be one of the enumeration’s values.

      +

      + If the type of the dictionary member is preceded by the + required keyword, the member is considered a + required dictionary member + and must be present on the dictionary. A + required dictionary + member MUST NOT have a default value. +

      +
      dictionary identifier {
      +  required type identifier;
      +};

      The type of a dictionary member MUST NOT include the dictionary it appears on. A type includes a dictionary D @@ -6202,6 +6214,15 @@ iframe.appendChild instanceof w.Function; // Evaluates to

    • Set the dictionary member on dict with key name key to the value idlValue. This dictionary member is considered to be present.
    • +
    • + Otherwise, if value is + undefined and the + dictionary + member is a + required dictionary + member, then throw a TypeError. +
    • @@ -11713,7 +11734,8 @@ d.type = et; Const | AttributeOrOperation "dictionary" identifier Inheritance "{" DictionaryMembers "}" ";" ExtendedAttributeList DictionaryMember DictionaryMembers | ε - Type identifier Default ";" + Required Type identifier Default ";" + "required" | ε "dictionary" identifier "{" DictionaryMembers "}" ";" "=" DefaultValue | ε ConstValue | string @@ -11736,7 +11758,9 @@ d.type = et; - Inherit ReadOnly "attribute" Type identifier ";" + Inherit ReadOnly "attribute" Type AttributeName ";" + AttributeNameKeyword | identifier + "required" "inherit" | ε "readonly" | ε