diff --git a/index.bs b/index.bs
index 87a3f3a94..5e10b3c13 100644
--- a/index.bs
+++ b/index.bs
@@ -35,6 +35,7 @@ spec: dom; type: interface; text: Document
spec: ecma-262; type: dfn; for: /; text: internal method
spec: ecma-262; type: dfn; for: /; text: internal slot
spec: ecma-262; type: dfn; for: /; text:realm
+spec:html; type:dfn; for:environment settings object; text:module map
@@ -717,23 +726,15 @@ in later sections.
Within the set of [=IDL fragments=]
that a given implementation supports,
-the [=identifier=] of every
-[=interface=],
-[=namespace=],
-[=dictionary=],
-[=enumeration=],
-[=callback function=],
-[=callback interface=] and
-[=typedef=]
-must not
-be the same as the identifier of any other
-[=interface=],
-[=namespace=],
-[=dictionary=],
-[=enumeration=],
-[=callback function=],
-[=callback interface=] or
-[=typedef=].
+the [=list=] that is the concatenation of the following [=lists=] must not
+contain the same [=list/item=] more than once:
+* the [=interface/scoped identifier=] of every [=interface=],
+* the [=identifier=] of every [=namespace=],
+* the [=identifier=] of every [=dictionary=],
+* the [=identifier=] of every [=enumeration=],
+* the [=identifier=] of every [=callback function=],
+* the [=identifier=] of every [=callback interface=], and
+* the [=identifier=] of every [=typedef=].
Within an [=IDL fragment=], a reference
to a [=definition=] need not appear after
@@ -831,11 +832,32 @@ expected that an object that implements a particular IDL interface
provides ways to inspect and modify the object's state and to
invoke the behavior described by the interface.
+[=Interfaces=] and [=partial interfaces=] have an
enclosing
+module, which is a [=module=] or null.
+Unless otherwise specified, it is null.
+
+
+ [=Interfaces=] and [=partial interfaces=] have a
+ scoped identifier,
+ which uniquely identifies an [=interface=].
+
+ It is given by the result of the following steps:
+
+ 1. Let |definition| be the given [=interface=] or [=partial interface=].
+ 1. Let |identifier| be |definition|'s [=identifier=].
+ 1. Let |module| be |definition|'s [=enclosing module=].
+ 1. If |module| is null, then:
+ 1. Return |identifier|.
+ 1. Let |specifier| be |module|'s [=module/specifier=].
+ 1. Return the [=concatenation=] of « |specifier|, |identifier| » with
+ separator U+002E FULL STOP (".").
+
+
An interface can be defined to
inherit from another interface.
If the identifier of the interface is followed by a
U+003A COLON (":") character
-and an [=identifier=],
-then that identifier identifies the inherited interface.
+and a
scopedidentifier token,
+then that token is the [=interface/scoped identifier=] of the inherited interface.
An object that implements an interface that inherits from another
also implements that inherited interface. The object therefore will also
have members that correspond to the interface members from the inherited interface.
@@ -949,9 +971,9 @@ The IDL for interfaces can be split into multiple parts by using
partial interface definitions
(matching
partial interface
PartialInterfaceRest).
-The [=identifier=] of a partial
+The [=partial interface/scoped identifier=] of a partial
interface definition must be the same
-as the identifier of an interface definition. All of
+as the [=interface/scoped identifier=] of an interface definition. All of
the members that appear on each of the partial interfaces are considered to be
members of the interface itself.
@@ -998,6 +1020,7 @@ The following extended attributes are applicable to [=partial interfaces=]:
[=Interfaces=] which are not annotated
with a [{{NoInterfaceObject}}] [=extended attribute=]
+and whose [=interface/enclosing module=] is null,
must be annotated with an [{{Exposed}}] [=extended attribute=].
@@ -1010,6 +1033,10 @@ The qualified name of an [=interface=] |interface| is defined as foll
[=extended attribute=].
1. Return the [=concatenation=] of « |namespace|, |identifier| » with
separator U+002E FULL STOP (".").
+1. If |interface|'s [=interface/enclosing module=] is not null, then:
+ 1. Let |specifier| be |interface|'s [=interface/enclosing module=]'s [=module/specifier=].
+ 1. Return the [=concatenation=] of « |specifier|, |identifier| » with
+ separator U+002E FULL STOP (".").
1. Return |identifier|.
@@ -1041,6 +1068,7 @@ The
qualified name of an [=interface=] |interface| is defined as foll
"interface" PartialInterfaceOrPartialMixin
PartialDictionary
Namespace
+ PartialModule
@@ -1075,7 +1103,7 @@ The qualified name of an [=interface=] |interface| is defined as foll
Inheritance :
- ":" identifier
+ ":" scopedidentifier
ε
@@ -1455,15 +1483,16 @@ must be annotated with an [{{Exposed}}] [=extended attribute=].
Members
-[=Interfaces=], [=interface mixins=], and [=namespaces=] are specifications of a set of
+[=Interfaces=], [=interface mixins=], [=namespaces=], and [=modules=] are specifications of a set of
members (respectively matching
InterfaceMembers,
-MixinMembers, and
-NamespaceMembers),
+MixinMembers,
+NamespaceMembers, and
+ModuleMembers),
which are the [=constants=], [=attributes=], [=operations=], and
other declarations that appear between the braces of their declarations.
[=Attributes=] describe the state that an object
-implementing the [=interface=], [=interface mixin=], or [=namespace=] will expose,
+implementing the [=interface=], [=interface mixin=], [=namespace=], or [=module=] will expose,
and [=operations=] describe the behaviors that can be invoked on the object.
[=Constants=] declare named constant values
that are exposed as a convenience to users of objects in the system.
@@ -1485,10 +1514,9 @@ declared on or that [=includes=] the [=interface mixin=] the member is declared
[=Attribute=] setter's algorithm steps also have access to the given value,
which is an IDL value of the type the [=attribute=] is declared as.
-[=Interfaces=], [=interface mixins=], [=callback interfaces=] and [=namespaces=] each support a
-different set of [=members=],
-which are specified in [[#idl-interfaces]], [[#idl-interface-mixins]],
-[[#idl-callback-interfaces]], and [[#idl-namespaces]],
+[=Interfaces=], [=interface mixins=], [=callback interfaces=], [=namespaces=], and [=modules=] each
+support a different set of [=members=], which are specified in [[#idl-interfaces]],
+[[#idl-interface-mixins]], [[#idl-callback-interfaces]], [[#idl-namespaces]], and [[#idl-modules]]
and summarized in the following informative table:
@@ -1499,6 +1527,7 @@ and summarized in the following informative table:
[=Callback interfaces=] |
[=Interface mixins=] |
[=Namespaces=] |
+ [=Modules=] |
@@ -1508,6 +1537,7 @@ and summarized in the following informative table:
● |
● |
|
+ |
[=Regular attributes=] |
@@ -1515,6 +1545,7 @@ and summarized in the following informative table:
|
● |
Only [=read only=] attributes |
+ Only [=read only=] attributes |
[=Static attributes=] |
@@ -1522,6 +1553,7 @@ and summarized in the following informative table:
|
|
|
+ |
[=Regular Operations=] |
@@ -1529,6 +1561,7 @@ and summarized in the following informative table:
● |
● |
● |
+ ● |
[=Special Operations=] |
@@ -1536,6 +1569,7 @@ and summarized in the following informative table:
|
Only [=stringifiers=] |
|
+ |
[=Static Operations=] |
@@ -1543,6 +1577,7 @@ and summarized in the following informative table:
|
|
|
+ |
[=Iterable declarations=] |
@@ -1550,6 +1585,7 @@ and summarized in the following informative table:
|
|
|
+ |
[=Maplike declarations=] |
@@ -1557,6 +1593,7 @@ and summarized in the following informative table:
|
|
|
+ |
[=Setlike declarations=] |
@@ -1564,6 +1601,23 @@ and summarized in the following informative table:
|
|
|
+ |
+
+
+ [=Interfaces=] |
+ |
+ |
+ |
+ |
+ ● |
+
+
+ [=Partial interfaces=] |
+ |
+ |
+ |
+ |
+ ● |
@@ -1821,7 +1875,8 @@ be retrieved and (in some cases) changed. There are two kinds of attributes:
If an attribute has no
static keyword, then it declares a
regular attribute. Otherwise,
it declares a [=static attribute=]. Note that in addition to being [=interface members=],
-[=read only=] [=regular attributes=] can be [=namespace members=] as well.
+[=read only=] [=regular attributes=] can be [=namespace members=] or [=module
+members=] as well.
@@ -2046,7 +2101,8 @@ then it declares a special operation. A single operation can declare
both a regular operation and a special operation;
see [[#idl-special-operations]] for details on special operations.
Note that in addition to being [=interface members=],
-regular operations can also be [=callback interface members=] and [=namespace members=].
+regular operations can also be [=callback interface members=], [=namespace members, or
+[=module members=].
If an operation has no identifier,
then it must be declared to be a special operation
@@ -4399,6 +4455,243 @@ Of the extended attributes defined in this specification, only the [{{Exposed}}]
+
Modules
+
+
+This feature is a work in progress. Please
+file an issue
+before using it.
+
+
+A
module is a structure that exposes a collection of
+[=interfaces=], [=read only=] [=regular attributes=], and [=regular operations=] as a logical unit.
+A [=module=] has a
specifier that uniquely identifies it.
+
+
+A module has a [=list=] of
+
module members which are
+[=interfaces=], [=partial interfaces=], [=read only=] [=regular attributes=], and
+[=regular operations=].
+
+The [=module/module members=] of a [=module=] |module| are given by the following steps:
+
+ 1. Let |result| be « ».
+ 1. Let |specifier| be |module|'s [=module/specifier=].
+ 1. Let |declaration| be the [=module declaration=] whose [=module declaration/specifier=] is
+ |specifier|:
+ 1. For every member |member| in |declaration|'s [=module declaration/module declaration
+ members|members=]:
+ 1. [=list/Append=] |member| to |result|.
+ 1. Let |partials| be « ».
+ 1. For each [=partial module declaration=] |declaration| whose [=partial module
+ declaration/specifier=] is |specifier|:
+ 1. Let |partialMembers| be |declaration|'s [=partial module declaration/module
+ declaration members|members=].
+ 1. Assert: |partialMembers| is not [=list/is empty|empty=].
+ 1. [=list/Append=] |partialMembers| to |partials|.
+ 1. Sort |partials| lexicographically by the [=identifier=] of each [=list/item=]'s first
+ [=list/item=].
+ 1. [=list/iterate|For each=] |partialMembers| of |partials|:
+ 1. [=list/iterate|For each=] |member| of |partialMembers|:
+ 1. [=list/Append=] |member| to |result|.
+ 1. Return |result|.
+
+Note: The order that members appear in this list has significance for property enumeration in the
+
ECMAScript binding.
+
+
+For all [=modules=] |module|, all [=interfaces=] and [=partial interfaces=] that are in |module|'s
+[=module/module members=] have their [=interface/enclosing module=] set to |module|.
+
+
+ The url of a [=module=] |module| is given by the following steps:
+
+ 1. Let |specifier| be |module|'s [=module/specifier=].
+ 1. Let |url| be the [=concatenation=] of « "std:
", |specifier| ».
+ 1. Apply the [=URL parser=] to |url|, and return the result.
+
+Note: The exact result of this algorithm is subject to change, in response to decisions about the
+Import Maps proposal. [[IMPORT-MAPS]]
+
+
+Note that like [=namespaces=], [=modules=] do not create types.
+
+Rather than defining behavior when accessed, the [=attributes=] of a [=module=] act as a simple
+storage location. The relevant language binding defines the steps to "set a module attribute" to
+an IDL value of the type of the [=attribute=].
+
+Note: See the ECMAScript binding's definition of [=set a module attribute=].
+
+Each module may have
evaluation steps which are executed when the module is
+first imported.
+These steps have access to a
this module value, which is the [=module=] being
+evaluated, and a [=Realm=].
+They may throw an [=exception=], which prevents the module from being accessed.
+The [=module/evaluation steps=] for a module |m| must invoke the "set a module attribute"
+algorithm to initialize each [=attribute=] in |m|'s [=module/module members=].
+
+
+
+ The following [=IDL fragment=] defines a [=module=] exposing a function to get the current
+ timezone, which returns an instance of an interface exposed in the same module.
+
+
+ [Exposed=Window, SecureContext]
+ module temporal {
+ interface Timezone {
+ readonly attribute USVString name;
+ long long offsetMs(long long unixTime);
+ };
+ temporal.Timezone getCurrentTimezone();
+ readonly attribute temporal.Timezone initialTimezone;
+ };
+
+
+
+ The [=module/evaluation steps=] of the {{temporal}} module in |realm| are as follows:
+ 1. Let |initial| be a [=new=] {{Timezone}} in |realm|, representing the User
+ Agent's preferred time zone.
+ 1. [=set a module attribute|Set the attribute=] {{temporal/initialTimezone}} of
+ this module to |initial|.
+
+
+ An ECMAScript implementation would then expose a
"std:temporal"
+ module which includes an [=interface object=] for the interface and a function for the operation:
+
+
+ import * from "std:temporal" as temporal;
+ Object.keys(temporal); // Evaluates to ["Timezone", "getCurrentTimezone", "currentTimezone"]
+ typeof temporal.Timezone; // Evaluates to "function"
+ typeof temporal.getCurrentTimezone; // Evaluates to "function"
+ typeof temporal.initialTimezone; // Evaluates to "object"
+
+
+
+### Syntax ### {#idl-modules-syntax}
+
+
+ module example {
+ /* module_members... */
+ };
+
+ partial module example {
+ /* module_members... */
+ };
+
+
+The IDL for modules can be split into multiple parts by using [=partial module declarations=].
+
+Note: As with [=partial interface=] definitions, [=partial module declarations=] are
+intended for use as a specification editorial aide, allowing the definition
+of a module to be separated over more than one section of the document, and
+sometimes multiple documents.
+
+A
module declaration is a [=definition=] matching the
Module nonterminal symbol.
+Its
specifier is given by the
+
string immediately following the
module terminal symbol.
+It has a [=list=] of [=module declaration/module declaration members|members=].
+
+Of the [=extended attributes=] defined in this specification, only [{{Exposed}}] and
+[{{SecureContext}}] are applicable to [=module declarations=].
+
+[=Module declarations=] must be annotated with the [{{Exposed}}] [=extended attribute=].
+
+For each [=module declaration=] |declaration|, there must exist a [=module=] whose
+[=module/specifier=] is given by |declaration|'s [=module declaration/specifier=].
+This [=module=] is considered to have the [=extended attributes=] that are specified on
+|declaration|.
+
+A
partial module declaration is a [=definition=] matching the
PartialModule nonterminal symbol.
+Its
specifier is given by the
+
string immediately following the
module terminal symbol.
+It has a [=list=] of [=partial module declaration/module declaration members|members=].
+
+No [=extended attributes=] defined in this specification are applicable to
+[=partial module declarations=].
+
+For each [=partial module declaration=] |declaration|, there must be a [=module declaration=]
+whose [=module declaration/specifier=] is |declaration|'s
+[=partial module declaration/specifier=].
+
+The [=partial module declaration/module declaration members|members=] of a
+[=partial module declaration=] must not be [=list/is empty|empty=].
+
+[=Operations=] must not be [=overloaded=] across [=module declarations=] and [=partial module
+declarations=].
+
+[=Module members=] and [=interface members|members=] of [=interfaces=] whose
+[=interface/enclosing module=] is not null must not be annotated with the [{{Exposed}}] or
+[{{SecureContext}}] [=extended attributes=].
+
+Note: The restrictions on the [{{Exposed}}] and [{{SecureContext}}] [=extended attributes=] in
+this section could be relaxed if there is a sufficient use case;
+they are restricted here for simplicity of specification and implementation, and a
+lack of clear use cases. Please
+file an issue if you see a need for this feature.
+
+
+ The
members of a [=module declaration=] or [=partial module
+ declaration=] are defined as follows:
+
+ 1. Let |members| be « ».
+ 1. For each string |s| matching the
+
ModuleMember nonterminal symbol between
+ the braces of the [=definition=]:
+ 1. If |s| matches
interface
+
InterfaceRest:
+ 1. [=list/Append=] the [=interface=] defined by |s| to |members|.
+ 1. If |s| matches
partial interface
+
PartialInterfaceRest:
+ 1. [=list/Append=] the [=partial interface=] defined by |s| to |members|.
+ 1. If |s| matches
+
RegularOperation:
+ 1. Let |operation| be the [=operation=] defined by |s|.
+ 1. If |members| [=list/contains=] a [=/set=] of [=operations=] whose [=identifier=] is
+ |operation|'s [=identifier=], then:
+ 1. Let |set| be that [=/set=].
+ 1. Otherwise:
+ 1. Let |set| be a new [=/set=].
+ 1. [=list/Append=] |set| to |members|.
+ 1. [=set/Append=] |operation| to |set|.
+ 1. If |s| matches
readonly
+
AttributeRest:
+ 1. [=list/Append=] the [=attribute=] defined by |s| to |members|.
+ 1. Return |members|.
+
+
+
+
+
+
+
+ Module :
+ "module" identifier "{" ModuleMembers "}" ";"
+
+
+
+ PartialModule :
+ "module" identifier "{" ModuleMembers "}" ";"
+
+
+
+ ModuleMembers :
+ ExtendedAttributeList ModuleMember ModuleMembers
+ ε
+
+
+
+ ModuleMember :
+ "interface" InterfaceRest
+ "partial" "interface" PartialInterfaceRest
+ RegularOperation
+ "readonly" AttributeRest
+
+
+
Dictionaries
A
dictionary is a definition (matching
@@ -5407,7 +5700,7 @@ type.
PromiseType ε
PrimitiveType Null
StringType Null
- identifier Null
+ scopedidentifier Null
"sequence" "<" TypeWithExtendedAttributes ">" Null
"object" Null
"symbol" Null
@@ -5840,7 +6133,7 @@ The [=type name=] of the {{symbol}} type is "
Symbol
".
Interface types
-An [=identifier=] that
+A [=interface/scoped identifier=] that
identifies an [=interface=] is used to refer to
a type that corresponds to the set of all possible non-null references to objects that
implement that interface.
@@ -6434,6 +6727,7 @@ types as [=annotated types=],
[=interface mixin members=],
[=callback interface members=],
[=namespace members=],
+[=module members=],
[=dictionary members=],
and [=operation=] arguments, and
is used to control how language bindings will handle those constructs.
@@ -8467,7 +8761,8 @@ an [=interface=],
[=partial interface mixin=],
[=callback interface=],
[=namespace=],
-[=partial namespace=], or
+[=partial namespace=],
+[=module=],
an individual [=interface member=],
[=interface mixin member=], or
[=namespace member=],
@@ -8487,7 +8782,7 @@ This list of identifiers is known as the construct's
run the following steps:
1. Assert: |C| is an [=interface=], [=callback interface=], [=namespace=],
- [=interface member=], [=interface mixin member=], or [=namespace member=].
+ [=interface member=], [=interface mixin member=], [=namespace member=], or [=module=].
1. Let |H| be |C|'s [=host interface=] if |C| is an [=interface mixin member=], or null otherwise.
1. If |C| is an [=interface member=], [=interface mixin member=], or [=namespace member=], then:
1. If the [{{Exposed}}] [=extended attribute=] is specified on |C|, then:
@@ -8511,7 +8806,7 @@ This list of identifiers is known as the construct's
then return the [=set/intersection=] of |C|'s [=own exposure set=]
and |H|'s [=exposure set=].
1. Otherwise, set |C| to |H|.
- 1. Assert: |C| is an [=interface=], [=callback interface=] or [=namespace=].
+ 1. Assert: |C| is an [=interface=], [=callback interface=], [=namespace=], or [=module=].
1. Assert: The [{{Exposed}}] [=extended attribute=] is specified on |C|.
1. Return |C|'s [=own exposure set=].
@@ -8560,9 +8855,9 @@ with the the [=host interface=]'s [=exposure set=].
Otherwise, it is the [=host interface=]'s [=exposure set=].