diff --git a/index.bs b/index.bs
index 108ae4e3..bbd2d484 100644
--- a/index.bs
+++ b/index.bs
@@ -444,6 +444,8 @@ The different kinds of definitions that can appea
[=partial interface|partial interface definitions=],
[=interface mixins=],
[=partial interface mixin|partial mixin definitions=],
+[=callback functions=],
+[=callback interfaces=],
[=namespaces=],
[=partial namespace|partial namespace definitions=],
[=dictionary|dictionaries=],
@@ -552,7 +554,8 @@ Every [=interface=],
[=dictionary=],
[=partial dictionary|partial dictionary definition=],
[=enumeration=],
-[=callback function=] and
+[=callback function=],
+[=callback interface=] and
[=typedef=] (together called named definitions)
and every [=constant=],
[=attribute=],
@@ -578,6 +581,7 @@ in the declaration:
partial dictionary dictionary_identifier { /* dictionary_members... */ };
enum enumeration_identifier { "enum", "values" /* , ... */ };
callback callback_identifier = return_type (/* arguments... */);
+ callback interface callback_interface_identifier { /* interface_members... */ };
* For [=attributes=],
[=typedefs=]
@@ -692,7 +696,8 @@ the [=identifier=] of every
[=namespace=],
[=dictionary=],
[=enumeration=],
-[=callback function=] and
+[=callback function=],
+[=callback interface=] and
[=typedef=]
must not
be the same as the identifier of any other
@@ -700,7 +705,8 @@ be the same as the identifier of any other
[=namespace=],
[=dictionary=],
[=enumeration=],
-[=callback function=] or
+[=callback function=],
+[=callback interface=] or
[=typedef=].
Within an [=IDL fragment=], a reference
@@ -778,8 +784,7 @@ across [=IDL fragments=].
describe object oriented systems. In such systems, objects are entities
that have identity and which are encapsulations of state and behavior.
An interface is a definition (matching
-
@@ -914,52 +919,6 @@ which can control how the interface member will be handled in language bindings.
};
-A callback interface is
-an [=interface=]
-that uses the
- callback interface identifier {
- /* interface_members... */
- };
-
-
-Note: See also the similarly named [=callback function=] definition.
-
-[=Callback interfaces=]
-must not [=interface/inherit=]
-from any interfaces, and non-callback interfaces must not
-inherit from any callback interfaces.
-Callback interfaces must not [=include=] any [=interface mixins=].
-
-[=Regular attributes=],
-[=static attributes=] and
-[=static operations=] must not
-be defined on a [=callback interface=].
-
-[=Callback interfaces=] must define exactly one [=regular operation=].
-
-EventListener as a
- [=callback interface=]
- is an example of an existing API that needs to allow
- objects with a
- given property (in this case handleEvent) to be considered to implement the interface.
- For new APIs, and those for which there are no compatibility concerns,
- using a [=callback function=] will allow
- only a [=function object=] (in the ECMAScript
- language binding).
-
-- CallbackRestOrInterface : - CallbackRest - "interface" InterfaceRest --
InterfaceOrMixin :
InterfaceRest
@@ -1130,8 +1082,8 @@ The qualified name of an [=interface=] |interface| is defined as foll
The following [=IDL fragment=] defines
- simplified versions of a few DOM [=interfaces=], one of which
- is a [=callback interface=].
+ simplified versions of a DOM [=interfaces=]
+ and a [=callback interface=].
[Exposed=Window]
@@ -1147,9 +1099,8 @@ The qualified name of an [=interface=] |interface| is defined as foll
};
- Since the EventListener interface is annotated
- callback interface, plain objects
- can implement it:
+ Plain objects can implement a [=callback interface=] like
+ EventListener:
var node = getNode(); // Obtain an instance of Node.
@@ -1164,7 +1115,8 @@ The qualified name of an [=interface=] |interface| is defined as foll
node.addEventListener("click", function() { ... }); // As does this.
- It is not possible for such an object to implement Node, however:
+ It is not possible for such an object to implement an [=interface=] like
+ Node, however:
var node = getNode(); // Obtain an instance of Node.
@@ -1259,7 +1211,7 @@ must additionally include the [=interface mixin member|members=] of [=interface
interface_identifier includes mixin_indentifier;
-The first [=identifier=] must reference a [=callback interface|non-callback=] [=interface=] |I|.
+The first [=identifier=] must reference a [=interface=] |I|.
The second identifier must reference an [=interface mixin=] |M|.
Each [=interface mixin member|member=] of |M| is considered to be
@@ -1408,6 +1360,73 @@ you can extend the {{WindowOrWorkerGlobalScope}} [=interface mixin=] using a [=p
};
+
+Callback interfaces
+
+A callback interface is a [=definition=] matching
+callback interface InterfaceRest .
+It can be implemented by any object, as described in [[#idl-objects]].
+
+Note: A [=callback interface=] is not an [=interface=]. The name and syntax are left over from
+earlier versions of this standard, where these concepts had more in common.
+
+A [=callback interface=] is a specification of a set of
+callback interface members
+(matching CallbackInterfaceMembers ).
+These are the [=members=] that appear between the braces in the interface declaration.
+
+
+ callback interface identifier {
+ /* interface_members... */
+ };
+
+
+Note: See also the similarly named [=callback function=] definition.
+
+[=Callback interfaces=] must define exactly one [=regular operation=].
+
+
+
+ Specification authors should not define
+ [=callback interfaces=]
+ unless required to describe the requirements of existing APIs.
+ Instead, a [=callback function=] should be used.
+
+ The definition of EventListener as a
+ [=callback interface=]
+ is an example of an existing API that needs to allow
+ objects with a
+ given property (in this case handleEvent) to be considered to implement the interface.
+ For new APIs, and those for which there are no compatibility concerns,
+ using a [=callback function=] will allow
+ only a [=function object=] (in the ECMAScript
+ language binding).
+
+
+
+[=Callback interfaces=] which declare [=constants=]
+must be annotated with an [{{Exposed}}] [=extended attribute=].
+
+
+
+ CallbackRestOrInterface :
+ CallbackRest
+ "interface" identifier "{" CallbackInterfaceMembers "}" ";"
+
+
+
+ CallbackInterfaceMembers :
+ ExtendedAttributeList CallbackInterfaceMember CallbackInterfaceMember
+ ε
+
+
+
+ CallbackInterfaceMember :
+ Const
+ RegularOperation
+
+
+
Members
[=Interfaces=], [=interface mixins=], and [=namespaces=] are specifications of a set of
@@ -1432,15 +1451,18 @@ that are exposed as a convenience to users of objects in the system.
-Every [=regular operation=], [=regular attribute=] getter, and [=regular attribute=] setter's
-algorithm steps have access to a this value, which is an IDL value of the type
-the member is declared on.
+The algorithm steps for every [=regular operation=], [=regular attribute=] getter, and
+[=regular attribute=] setter's defined on an [=interface=] or [=interface mixin=] have access to a
+this value, which is an IDL value of the [=interface=] type that the member is
+declared on or that [=includes=] the [=interface mixin=] the member is declared on.
[=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=], and [=namespaces=] each support a different set of [=members=],
-which are specified in [[#idl-interfaces]], [[#idl-interface-mixins]], and [[#idl-namespaces]],
+[=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]],
and summarized in the following informative table: