[69] ArgumentNameKeyword →
+
@@ -1290,14 +1291,14 @@
3.2.1. Constants
[Exposed] .
-
[27] Const → "const" ConstType identifier "=" ConstValue ";" [28] ConstValue → BooleanLiteral |
+
@@ -1470,8 +1471,8 @@
3.2.2. Attributes
-
[41] Attribute → Inherit AttributeRest [42] AttributeRest → ReadOnly "attribute" Type identifier ";"[43] Inherit → "inherit" |
- ε [44] ReadOnly → "readonly" |
+
@@ -1841,26 +1842,26 @@
3.2.3. Operations
[TreatNullAs] .
-
[16] DefaultValue → ConstValue |
+
@@ -2208,7 +2210,7 @@ 3.2.4.2. Stringifiers
stringifier attribute DOMString identifier ;
- [37] Stringifier → "stringifier" StringifierRest [38] StringifierRest → AttributeRest |
+
@@ -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] SerializerRest → OperationRest |
+
@@ -2966,7 +2968,7 @@
3.2.5. Static attributes and operations
declared on
callback interfaces .
-
[39] StaticMember → "static" StaticMemberRest [40] StaticMemberRest → AttributeRest |
+
@@ -4066,10 +4068,10 @@
3.2.7. Iterators
defined in this specification are applicable to
iterator object
declarations.
-
[45] OperationOrIterator → ReturnType OperationOrIteratorRest |
- SpecialOperation [49] OperationOrIteratorRest → IteratorRest |
- OperationRest [50] IteratorRest → "iterator" OptionalIteratorInterfaceOrObject ";" [51] OptionalIteratorInterfaceOrObject → OptionalIteratorInterface |
- "object"[52] 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
@@ -4535,10 +4549,10 @@
3.4. Exceptions
No
extended attributes
defined in this specification are applicable to
exception fields .
-
+
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 .
-
@@ -4774,7 +4788,7 @@
3.7. Typedefs
defined in this specification are applicable to
typedefs .
-
+
@@ -4918,7 +4932,7 @@
3.8. Implements statements
implements statements .
-
+
@@ -5136,12 +5150,12 @@
3.10. Types
assign to the attribute.
-
[71] Type → SingleType |
- UnionType TypeSuffix [72] SingleType → NonAnyType |
- "any" TypeSuffixStartingWithArray [73] UnionType → "(" UnionMemberType "or" UnionMemberType UnionMemberTypes ")" [74] UnionMemberType → NonAnyType |
+
@@ -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] UnionMemberType → NonAnyType |
+ [76] UnionType → "(" UnionMemberType "or" UnionMemberType UnionMemberTypes ")" [77] UnionMemberType → NonAnyType |
UnionType TypeSuffix |
- "any" "[" "]" TypeSuffix [75] UnionMemberTypes → "or" UnionMemberType UnionMemberTypes |
- ε [76] NonAnyType → PrimitiveType TypeSuffix |
+ "any" "[" "]" TypeSuffix [78] UnionMemberTypes → "or" UnionMemberType UnionMemberTypes |
+ ε [79] NonAnyType → PrimitiveType 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] ExtendedAttributeRest → ExtendedAttribute |
- ε[67] ExtendedAttributeInner →
+ [69] ExtendedAttributeRest → ExtendedAttribute |
+ ε[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] OtherOrComma → Other |
- ","[89] IdentifierList → identifier Identifiers [90] Identifiers → "," identifier Identifiers |
- ε [91] ExtendedAttributeNoArgs → identifier [92] ExtendedAttributeArgList → identifier "(" ArgumentList ")"[93] ExtendedAttributeIdent → identifier "=" identifier [94] ExtendedAttributeIdentList → identifier "=" "(" IdentifierList ")"[95] ExtendedAttributeNamedArgList → identifier "=" identifier "(" ArgumentList ")"[96] ExtendedAttributeTypePair → identifier "(" Type "," Type ")"
+ [73] OtherOrComma → Other |
+ ","[92] IdentifierList → identifier Identifiers [93] Identifiers → "," identifier Identifiers |
+ ε [94] ExtendedAttributeNoArgs → identifier [95] ExtendedAttributeArgList → identifier "(" ArgumentList ")"[96] ExtendedAttributeIdent → identifier "=" identifier [97] ExtendedAttributeIdentList → identifier "=" "(" IdentifierList ")"[98] ExtendedAttributeNamedArgList → identifier "=" identifier "(" ArgumentList ")"[99] ExtendedAttributeTypePair → identifier "(" 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] InterfaceMembers → ExtendedAttributeList InterfaceMember InterfaceMembers |
ε[10] InterfaceMember → Const |
AttributeOrOperationOrIterator [11] Dictionary → "dictionary" identifier Inheritance "{" DictionaryMembers "}" ";" [12] DictionaryMembers → ExtendedAttributeList DictionaryMember DictionaryMembers |
- ε[13] DictionaryMember → Type identifier Default ";"[14] PartialDictionary → "dictionary" identifier "{" DictionaryMembers "}" ";" [15] Default → "=" DefaultValue |
- ε [16] DefaultValue → ConstValue |
+ ε[13] DictionaryMember → Required Type identifier Default ";"[14] Required → "required" |
+ ε [15] PartialDictionary → "dictionary" identifier "{" DictionaryMembers "}" ";" [16] Default → "=" DefaultValue |
+ ε [17] DefaultValue → ConstValue |
string |
- "[" "]"[17] Exception → "exception" identifier Inheritance "{" ExceptionMembers "}" ";" [18] ExceptionMembers → ExtendedAttributeList ExceptionMember ExceptionMembers |
- ε[19] Inheritance → ":" identifier |
- ε [20] Enum → "enum" identifier "{" EnumValueList "}" ";" [21] EnumValueList → string EnumValueListComma [22] EnumValueListComma → "," EnumValueListString |
- ε [23] EnumValueListString → string EnumValueListComma |
- ε[24] CallbackRest → identifier "=" ReturnType "(" ArgumentList ")" ";"[25] Typedef → "typedef" Type identifier ";" [26] ImplementsStatement → identifier "implements" identifier ";"[27] Const → "const" ConstType identifier "=" ConstValue ";" [28] ConstValue → BooleanLiteral |
+ "[" "]"[18] Exception → "exception" identifier Inheritance "{" ExceptionMembers "}" ";" [19] ExceptionMembers → ExtendedAttributeList ExceptionMember ExceptionMembers |
+ ε[20] Inheritance → ":" identifier |
+ ε [21] Enum → "enum" identifier "{" EnumValueList "}" ";" [22] EnumValueList → string EnumValueListComma [23] EnumValueListComma → "," EnumValueListString |
+ ε [24] EnumValueListString → string EnumValueListComma |
+ ε[25] CallbackRest → identifier "=" ReturnType "(" ArgumentList ")" ";"[26] Typedef → "typedef" Type identifier ";" [27] ImplementsStatement → identifier "implements" identifier ";"[28] Const → "const" ConstType identifier "=" ConstValue ";" [29] ConstValue → BooleanLiteral |
FloatLiteral |
integer |
- "null"[29] BooleanLiteral → "true" |
- "false" [30] FloatLiteral → float |
+ "null"[30] BooleanLiteral → "true" |
+ "false" [31] FloatLiteral → float |
"-Infinity" |
"Infinity" |
- "NaN"[31] AttributeOrOperationOrIterator → Serializer |
+ "NaN"[32] AttributeOrOperationOrIterator → Serializer |
Stringifier |
StaticMember |
Attribute |
- OperationOrIterator [32] Serializer → "serializer" SerializerRest [33] SerializerRest → OperationRest |
+ OperationOrIterator [33] Serializer → "serializer" SerializerRest [34] SerializerRest → OperationRest |
"=" 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] StringifierRest → AttributeRest |
+ ε[38] Stringifier → "stringifier" StringifierRest [39] StringifierRest → AttributeRest |
ReturnType OperationRest |
- ";"[39] StaticMember → "static" StaticMemberRest [40] StaticMemberRest → AttributeRest |
- ReturnType OperationRest [41] Attribute → Inherit AttributeRest [42] AttributeRest → ReadOnly "attribute" Type identifier ";"[43] Inherit → "inherit" |
- ε [44] ReadOnly → "readonly" |
- ε [45] OperationOrIterator → ReturnType OperationOrIteratorRest |
- SpecialOperation [46] SpecialOperation → Special Specials ReturnType OperationRest [47] Specials → Special Specials |
- ε[48] Special → "getter" |
+ ";" [40] StaticMember → "static" StaticMemberRest [41] StaticMemberRest → AttributeRest |
+ ReturnType OperationRest [42] Attribute → Inherit AttributeRest [43] AttributeRest → ReadOnly "attribute" Type AttributeName ";"[44] AttributeName → AttributeNameKeyword |
+ identifier [45] AttributeNameKeyword → "required" [46] Inherit → "inherit" |
+ ε [47] ReadOnly → "readonly" |
+ ε [48] OperationOrIterator → ReturnType OperationOrIteratorRest |
+ SpecialOperation [49] SpecialOperation → Special Specials ReturnType OperationRest [50] Specials → Special Specials |
+ ε[51] Special → "getter" |
"setter" |
"creator" |
"deleter" |
- "legacycaller" [49] OperationOrIteratorRest → IteratorRest |
- OperationRest [50] IteratorRest → "iterator" OptionalIteratorInterfaceOrObject ";" [51] OptionalIteratorInterfaceOrObject → OptionalIteratorInterface |
- "object"[52] OptionalIteratorInterface → "=" identifier |
- ε [53] OperationRest → OptionalIdentifier "(" ArgumentList ")" ";"[54] OptionalIdentifier → identifier |
- ε[55] ArgumentList → Argument Arguments |
- ε[56] Arguments → "," Argument Arguments |
- ε [57] Argument → ExtendedAttributeList OptionalOrRequiredArgument [58] OptionalOrRequiredArgument → "optional" Type ArgumentName Default |
- Type Ellipsis ArgumentName [59] ArgumentName → ArgumentNameKeyword |
- identifier [60] Ellipsis → "..." |
- ε [61] ExceptionMember → Const |
- ExceptionField [62] ExceptionField → Type identifier ";"[63] ExtendedAttributeList → "[" ExtendedAttribute ExtendedAttributes "]" |
- ε [64] ExtendedAttributes → "," ExtendedAttribute ExtendedAttributes |
- ε [65] ExtendedAttribute →
+ "legacycaller" [52] OperationOrIteratorRest → IteratorRest |
+ OperationRest [53] IteratorRest → "iterator" OptionalIteratorInterfaceOrObject ";" [54] OptionalIteratorInterfaceOrObject → OptionalIteratorInterface |
+ "object"[55] OptionalIteratorInterface → "=" identifier |
+ ε [56] OperationRest → OptionalIdentifier "(" ArgumentList ")" ";"[57] OptionalIdentifier → identifier |
+ ε[58] ArgumentList → Argument Arguments |
+ ε[59] Arguments → "," Argument Arguments |
+ ε [60] Argument → ExtendedAttributeList OptionalOrRequiredArgument [61] OptionalOrRequiredArgument → "optional" Type ArgumentName Default |
+ Type Ellipsis ArgumentName [62] ArgumentName → ArgumentNameKeyword |
+ identifier [63] Ellipsis → "..." |
+ ε [64] ExceptionMember → Const |
+ ExceptionField [65] ExceptionField → Type 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] ExtendedAttributeRest → ExtendedAttribute |
- ε[67] ExtendedAttributeInner →
+ [69] ExtendedAttributeRest → ExtendedAttribute |
+ ε[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] OtherOrComma → Other |
- ","[71] Type → SingleType |
- UnionType TypeSuffix [72] SingleType → NonAnyType |
- "any" TypeSuffixStartingWithArray [73] UnionType → "(" UnionMemberType "or" UnionMemberType UnionMemberTypes ")" [74] UnionMemberType → NonAnyType |
+ [73] OtherOrComma → Other |
+ ","[74] Type → SingleType |
+ UnionType TypeSuffix [75] SingleType → NonAnyType |
+ "any" TypeSuffixStartingWithArray [76] UnionType → "(" UnionMemberType "or" UnionMemberType UnionMemberTypes ")" [77] UnionMemberType → NonAnyType |
UnionType TypeSuffix |
- "any" "[" "]" TypeSuffix [75] UnionMemberTypes → "or" UnionMemberType UnionMemberTypes |
- ε [76] NonAnyType → PrimitiveType TypeSuffix |
+ "any" "[" "]" TypeSuffix [78] UnionMemberTypes → "or" UnionMemberType UnionMemberTypes |
+ ε [79] NonAnyType → PrimitiveType TypeSuffix |
PromiseType Null |
"ByteString" TypeSuffix |
"DOMString" TypeSuffix |
@@ -14464,23 +14489,23 @@ A. IDL grammar
"sequence" "<" Type ">" Null |
"object" TypeSuffix |
"Date" TypeSuffix |
- "RegExp" TypeSuffix [77] ConstType → PrimitiveType Null |
- identifier Null [78] PrimitiveType → UnsignedIntegerType |
+ "RegExp" TypeSuffix [80] ConstType → PrimitiveType Null |
+ identifier Null [81] PrimitiveType → UnsignedIntegerType |
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] ReturnType → Type |
- "void"[89] IdentifierList → identifier Identifiers [90] Identifiers → "," identifier Identifiers |
- ε [91] ExtendedAttributeNoArgs → identifier [92] ExtendedAttributeArgList → identifier "(" ArgumentList ")"[93] ExtendedAttributeIdent → identifier "=" identifier [94] ExtendedAttributeIdentList → identifier "=" "(" IdentifierList ")"[95] ExtendedAttributeNamedArgList → identifier "=" identifier "(" ArgumentList ")"[96] ExtendedAttributeTypePair → identifier "(" Type "," Type ")"
+ ε[89] TypeSuffixStartingWithArray → "[" "]" TypeSuffix |
+ ε [90] Null → "?" |
+ ε [91] ReturnType → Type |
+ "void"[92] IdentifierList → identifier Identifiers [93] Identifiers → "," identifier Identifiers |
+ ε [94] ExtendedAttributeNoArgs → identifier [95] ExtendedAttributeArgList → identifier "(" ArgumentList ")"[96] ExtendedAttributeIdent → identifier "=" identifier [97] ExtendedAttributeIdentList → identifier "=" "(" IdentifierList ")"[98] ExtendedAttributeNamedArgList → identifier "=" identifier "(" ArgumentList ")"[99] ExtendedAttributeTypePair → identifier "(" Type "," Type ")"
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;
+
+ 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 @@
- 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 →
+
@@ -1288,14 +1289,14 @@
3.2.1. Constants
[Exposed] .
-
[27] Const → "const" ConstType identifier "=" ConstValue ";" [28] ConstValue → BooleanLiteral |
+
@@ -1441,12 +1442,12 @@
3.2.2. Attributes
-
[31] AttributeOrOperation → "stringifier" StringifierAttributeOrOperation |
+
@@ -1802,24 +1803,24 @@
3.2.3. Operations
-
[16] DefaultValue → ConstValue |
- string [31] AttributeOrOperation → "stringifier" StringifierAttributeOrOperation |
+
@@ -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
@@ -3653,10 +3667,10 @@
3.4. Exceptions
No
extended attributes
defined in this specification are applicable to
exception fields .
-
+
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 .
-
@@ -3887,7 +3901,7 @@
3.7. Typedefs
defined in this specification are applicable to
typedefs .
-
+
@@ -4031,7 +4045,7 @@
3.8. Implements statements
implements statements .
-
+
@@ -4249,30 +4263,30 @@
3.10. Types
assign to the attribute.
-
[58] Type → SingleType |
- UnionType TypeSuffix [59] SingleType → NonAnyType |
- "any" TypeSuffixStartingWithArray [60] UnionType → "(" UnionMemberType "or" UnionMemberType UnionMemberTypes ")" [61] UnionMemberType → NonAnyType |
+
@@ -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] UnionMemberType → NonAnyType |
+ [63] UnionType → "(" UnionMemberType "or" UnionMemberType UnionMemberTypes ")" [64] UnionMemberType → NonAnyType |
UnionType TypeSuffix |
- "any" "[" "]" TypeSuffix [62] UnionMemberTypes → "or" UnionMemberType UnionMemberTypes |
- ε [63] NonAnyType → PrimitiveType TypeSuffix |
+ "any" "[" "]" TypeSuffix [65] UnionMemberTypes → "or" UnionMemberType UnionMemberTypes |
+ ε [66] NonAnyType → PrimitiveType 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.-->
-
@@ -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] InterfaceMembers → ExtendedAttributeList InterfaceMember InterfaceMembers |
ε[10] InterfaceMember → Const |
AttributeOrOperation [11] Dictionary → "dictionary" identifier Inheritance "{" DictionaryMembers "}" ";" [12] DictionaryMembers → ExtendedAttributeList DictionaryMember DictionaryMembers |
- ε[13] DictionaryMember → Type identifier Default ";"[14] PartialDictionary → "dictionary" identifier "{" DictionaryMembers "}" ";" [15] Default → "=" DefaultValue |
- ε [16] DefaultValue → ConstValue |
- string [17] Exception → "exception" identifier Inheritance "{" ExceptionMembers "}" ";" [18] ExceptionMembers → ExtendedAttributeList ExceptionMember ExceptionMembers |
- ε[19] Inheritance → ":" identifier |
- ε [20] Enum → "enum" identifier "{" EnumValueList "}" ";" [21] EnumValueList → string EnumValueListComma [22] EnumValueListComma → "," EnumValueListString |
- ε [23] EnumValueListString → string EnumValueListComma |
- ε[24] CallbackRest → identifier "=" ReturnType "(" ArgumentList ")" ";"[25] Typedef → "typedef" Type identifier ";" [26] ImplementsStatement → identifier "implements" identifier ";"[27] Const → "const" ConstType identifier "=" ConstValue ";" [28] ConstValue → BooleanLiteral |
+ ε[13] DictionaryMember → Required Type identifier Default ";"[14] Required → "required" |
+ ε [15] PartialDictionary → "dictionary" identifier "{" DictionaryMembers "}" ";" [16] Default → "=" DefaultValue |
+ ε [17] DefaultValue → ConstValue |
+ string [18] Exception → "exception" identifier Inheritance "{" ExceptionMembers "}" ";" [19] ExceptionMembers → ExtendedAttributeList ExceptionMember ExceptionMembers |
+ ε[20] Inheritance → ":" identifier |
+ ε [21] Enum → "enum" identifier "{" EnumValueList "}" ";" [22] EnumValueList → string EnumValueListComma [23] EnumValueListComma → "," EnumValueListString |
+ ε [24] EnumValueListString → string EnumValueListComma |
+ ε[25] CallbackRest → identifier "=" ReturnType "(" ArgumentList ")" ";"[26] Typedef → "typedef" Type identifier ";" [27] ImplementsStatement → identifier "implements" identifier ";"[28] Const → "const" ConstType identifier "=" ConstValue ";" [29] ConstValue → BooleanLiteral |
FloatLiteral |
integer |
- "null"[29] BooleanLiteral → "true" |
- "false" [30] FloatLiteral → float |
+ "null"[30] BooleanLiteral → "true" |
+ "false" [31] FloatLiteral → float |
"-Infinity" |
"Infinity" |
- "NaN"[31] AttributeOrOperation → "stringifier" StringifierAttributeOrOperation |
+ "NaN" [32] AttributeOrOperation → "stringifier" StringifierAttributeOrOperation |
Attribute |
- Operation [32] StringifierAttributeOrOperation → Attribute |
+ Operation [33] StringifierAttributeOrOperation → Attribute |
OperationRest |
- ";"[33] Attribute → Inherit ReadOnly "attribute" Type identifier ";"[34] Inherit → "inherit" |
- ε [35] ReadOnly → "readonly" |
- ε [36] Operation → Qualifiers OperationRest [37] Qualifiers → "static" |
- Specials [38] Specials → Special Specials |
- ε[39] Special → "getter" |
+ ";" [34] Attribute → Inherit ReadOnly "attribute" Type AttributeName ";"[35] AttributeName → AttributeNameKeyword |
+ identifier [36] AttributeNameKeyword → "required" [37] Inherit → "inherit" |
+ ε [38] ReadOnly → "readonly" |
+ ε [39] Operation → Qualifiers OperationRest [40] Qualifiers → "static" |
+ Specials [41] Specials → Special Specials |
+ ε[42] Special → "getter" |
"setter" |
"creator" |
"deleter" |
- "legacycaller" [40] OperationRest → ReturnType OptionalIdentifier "(" ArgumentList ")" ";"[41] OptionalIdentifier → identifier |
- ε[42] ArgumentList → Argument Arguments |
- ε[43] Arguments → "," Argument Arguments |
- ε [44] Argument → ExtendedAttributeList OptionalOrRequiredArgument [45] OptionalOrRequiredArgument → "optional" Type ArgumentName Default |
- Type Ellipsis ArgumentName [46] ArgumentName → ArgumentNameKeyword |
- identifier [47] Ellipsis → "..." |
- ε [48] ExceptionMember → Const |
- ExceptionField [49] ExceptionField → Type identifier ";"[50] ExtendedAttributeList → "[" ExtendedAttribute ExtendedAttributes "]" |
- ε [51] ExtendedAttributes → "," ExtendedAttribute ExtendedAttributes |
- ε [52] ExtendedAttribute →
+ "legacycaller" [43] OperationRest → ReturnType OptionalIdentifier "(" ArgumentList ")" ";"[44] OptionalIdentifier → identifier |
+ ε[45] ArgumentList → Argument Arguments |
+ ε[46] Arguments → "," Argument Arguments |
+ ε [47] Argument → ExtendedAttributeList OptionalOrRequiredArgument [48] OptionalOrRequiredArgument → "optional" Type ArgumentName Default |
+ Type Ellipsis ArgumentName [49] ArgumentName → ArgumentNameKeyword |
+ identifier [50] Ellipsis → "..." |
+ ε [51] ExceptionMember → Const |
+ ExceptionField [52] ExceptionField → Type 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] ExtendedAttributeRest → ExtendedAttribute |
- ε[54] ExtendedAttributeInner →
+ [56] ExtendedAttributeRest → ExtendedAttribute |
+ ε[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] OtherOrComma → Other |
- ","[58] Type → SingleType |
- UnionType TypeSuffix [59] SingleType → NonAnyType |
- "any" TypeSuffixStartingWithArray [60] UnionType → "(" UnionMemberType "or" UnionMemberType UnionMemberTypes ")" [61] UnionMemberType → NonAnyType |
+ [60] OtherOrComma → Other |
+ ","[61] Type → SingleType |
+ UnionType TypeSuffix [62] SingleType → NonAnyType |
+ "any" TypeSuffixStartingWithArray [63] UnionType → "(" UnionMemberType "or" UnionMemberType UnionMemberTypes ")" [64] UnionMemberType → NonAnyType |
UnionType TypeSuffix |
- "any" "[" "]" TypeSuffix [62] UnionMemberTypes → "or" UnionMemberType UnionMemberTypes |
- ε [63] NonAnyType → PrimitiveType TypeSuffix |
+ "any" "[" "]" TypeSuffix [65] UnionMemberTypes → "or" UnionMemberType UnionMemberTypes |
+ ε [66] NonAnyType → PrimitiveType TypeSuffix |
"DOMString" TypeSuffix |
identifier TypeSuffix |
"sequence" "<" Type ">" Null |
"object" TypeSuffix |
- "Date" TypeSuffix [64] ConstType → PrimitiveType Null |
- identifier Null [65] PrimitiveType → UnsignedIntegerType |
+ "Date" TypeSuffix [67] ConstType → PrimitiveType Null |
+ identifier Null [68] PrimitiveType → UnsignedIntegerType |
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] ReturnType → Type |
- "void"[75] IdentifierList → identifier Identifiers [76] Identifiers → "," identifier Identifiers |
- ε [77] ExtendedAttributeNoArgs → identifier [78] ExtendedAttributeArgList → identifier "(" ArgumentList ")"[79] ExtendedAttributeIdent → identifier "=" identifier [80] ExtendedAttributeIdentList → identifier "=" "(" IdentifierList ")"[81] ExtendedAttributeNamedArgList → identifier "=" identifier "(" ArgumentList ")"
+ ε[75] TypeSuffixStartingWithArray → "[" "]" TypeSuffix |
+ ε [76] Null → "?" |
+ ε [77] ReturnType → Type |
+ "void"[78] IdentifierList → identifier Identifiers [79] Identifiers → "," identifier Identifiers |
+ ε [80] ExtendedAttributeNoArgs → identifier [81] ExtendedAttributeArgList → identifier "(" ArgumentList ")"[82] ExtendedAttributeIdent → identifier "=" identifier [83] ExtendedAttributeIdentList → identifier "=" "(" IdentifierList ")"[84] ExtendedAttributeNamedArgList → identifier "=" identifier "(" ArgumentList ")"
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;
+
+ 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" | ε