The following IDL defines an interface that uses the
- [{{NamedConstructor}}] extended
+ [{{LegacyFactoryFunction}}] extended
attribute.
[Exposed=Window,
- NamedConstructor=Audio,
- NamedConstructor=Audio(DOMString src)]
+ LegacyFactoryFunction=Audio(DOMString src)]
interface HTMLAudioElement : HTMLMediaElement {
// ...
};
@@ -9992,18 +9987,21 @@ are to be implemented.
An ECMAScript implementation that supports this interface will
allow the construction of HTMLAudioElement
- objects using the Audio
[=constructor=].
+ objects using the Audio
function.
typeof Audio; // Evaluates to 'function'.
- var a1 = new Audio(); // Creates a new object that implements
- // HTMLAudioElement, using the zero-argument
- // constructor.
-
var a2 = new Audio('a.flac'); // Creates an HTMLAudioElement using the
// one-argument constructor.
+
+ As an additional legacy quirk, these factory functions will have a prototype
+ property equal to the prototype
of the original interface:
+
+
+ console.assert(Audio.prototype === HTMLAudioElement.prototype);
+
@@ -10109,7 +10107,7 @@ The [{{NoInterfaceObject}}] extended attribute
must not be specified on an interface that has any
[=constructors=] or [=static operations=] defined on it.
-Note: Combining the [{{NoInterfaceObject}}] and [{{NamedConstructor}}] extended attribute is not
+Note: Combining the [{{NoInterfaceObject}}] and [{{LegacyFactoryFunction}}] extended attribute is not
forbidden, however.
An interface that does not have the [{{NoInterfaceObject}}] extended
@@ -11269,12 +11267,12 @@ there exists a corresponding property on the {{Window}} global object.
The name of the property is the given [=LegacyWindowAlias identifier|identifier=],
and its value is a reference to the [=interface object=] for the [=interface=].
-In addition, for every [{{NamedConstructor}}] extended attribute on an [=exposed=] interface,
+In addition, for every [{{LegacyFactoryFunction}}] extended attribute on an [=exposed=] interface,
a corresponding property exists on the ECMAScript global object.
-The name of the property is the [{{NamedConstructor}}]'s [=NamedConstructor identifier|identifier=],
-and its value is an object called a
- The [=named constructor=] with [=NamedConstructor identifier|identifier=] |id|
+ The [=legacy factory function=] with [=LegacyFactoryFunction identifier|identifier=] |id|
for a given [=interface=] |I| in Realm |realm|
- is
created as follows:
+ is
created as follows:
1. Let |steps| be the following steps:
1. If {{NewTarget}} is
undefined, then
[=ECMAScript/throw=] a {{ECMAScript/TypeError}}.
1. Let |args| be the passed arguments.
1. Let |n| be the [=list/size=] of |args|.
- 1. [=Compute the effective overload set=] for named constructors with [=identifier=] |id|
+ 1. [=Compute the effective overload set=] for legacy factory functions with [=identifier=] |id|
on [=interface=] |I| and with argument count |n|, and let |S| be the result.
1. Let <|constructor|, |values|> be the result of passing |S| and
|args| to the [=overload resolution algorithm=].
@@ -11413,7 +11411,7 @@ implement the interface on which the
1. Return |O|.
1. Let |F| be [=!=]
CreateBuiltinFunction(|steps|, « », |realm|).
1. Perform [=!=]
SetFunctionName(|F|, |id|).
- 1. [=Compute the effective overload set=] for named constructors with [=identifier=] |id|
+ 1. [=Compute the effective overload set=] for legacy factory functions with [=identifier=] |id|
on [=interface=] |I| and with argument count 0, and let |S| be the result.
1. Let |length| be the length of the shortest argument list of the entries in |S|.
1. Perform [=!=]
SetFunctionLength(|F|, |length|).
@@ -13255,13 +13253,14 @@ the Realm given as an argument.
1. [=list/iterate|For every=] [=LegacyWindowAlias identifier|identifier=] |id| in
[{{LegacyWindowAlias}}]'s [=LegacyWindowAlias identifier|identifiers=]:
1. Perform [=!=] [$CreateMethodProperty$](|target|, |id|, |interfaceObject|).
- 1. If the |interface| is declared with a [{{NamedConstructor}}] [=extended attribute=],
+ 1. If the |interface| is declared with a [{{LegacyFactoryFunction}}] [=extended attribute=],
then:
- 1. [=list/iterate|For every=] [=NamedConstructor identifier|identifier=] |id| in
- [{{NamedConstructor}}]'s [=NamedConstructor identifier|identifiers=]:
- 1. Let |namedConstructor| be the result of [=create a named constructor|creating
- a named constructor=] with |id| for |interface| in |realm|.
- 1. Perform [=!=] [$CreateMethodProperty$](|target|, |id|, |namedConstructor|).
+ 1. [=list/iterate|For every=] [=LegacyFactoryFunction identifier|identifier=] |id| in
+ [{{LegacyFactoryFunction}}]'s [=LegacyFactoryFunction identifier|identifiers=]:
+ 1. Let |legacyFactoryFunction| be the result of
+ [=create a legacy factory function|creating a legacy factory function=] with
+ |id| for |interface| in |realm|.
+ 1. Perform [=!=] [$CreateMethodProperty$](|target|, |id|, |legacyFactoryFunction|).
1. [=list/iterate|For every=] [=callback interface=] |interface| that is [=exposed=] in
|realm| and on which [=constants=] are defined:
1. Let |id| be |interface|'s [=identifier=].
@@ -14912,7 +14911,7 @@ terminal symbol
const, an
"
A
" is distinct from one named "
a
", and an
[=extended attribute=]
[
namedconstructor
] will not be recognized as
-the [{{NamedConstructor}}]
+the [{{LegacyFactoryFunction}}]
extended attribute.
Implicitly, any number of
whitespace and