Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add [LegacyWindowAlias] extended attribute for WebKitCSSMatrix et al #364

Merged
merged 5 commits into from
May 18, 2017
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 82 additions & 0 deletions index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -940,6 +940,7 @@ limitations. The following extended attributes must not
be specified on partial interface definitions:
[{{Constructor}}],
[{{LegacyArrayClass}}],
[{{LegacyWindowAlias}}],
[{{NamedConstructor}}],
[{{NoInterfaceObject}}].

Expand All @@ -965,6 +966,7 @@ The following extended attributes are applicable to interfaces:
[{{Exposed}}],
[{{Global}}],
[{{LegacyArrayClass}}],
[{{LegacyWindowAlias}}],
[{{NamedConstructor}}],
[{{NoInterfaceObject}}],
[{{OverrideBuiltins}}],
Expand Down Expand Up @@ -8725,6 +8727,71 @@ for the specific requirements that the use of
entails.


<h4 id="LegacyWindowAlias" extended-attribute lt="LegacyWindowAlias">[LegacyWindowAlias]</h4>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you also need to add a number of restrictions around the identifiers and also amend the NamedConstructor description accordingly:

  1. [LegacyWindowAlias] identifiers can't be the same as that of an interface that has an interface object.
  2. [LegacyWindowAlias] identifiers can't be the same as that of a [NamedConstructor].
  3. [LegacyWindowAlias] identifiers can't be the same as that of a [LegacyWindowAlias] used on another interface.
  4. [LegacyWindowAlias] identifiers must not be one of the reserved identifiers.


If the [{{LegacyWindowAlias}}] [=extended attribute=] appears on an [=interface=],
it indicates that the [=primary global interface=] will have a property
for each identifier mentioned in the extended attribute,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Eventually, link identifier.

whose value is the [=interface object=] for the interface.

The [{{LegacyWindowAlias}}] [=extended attribute=] must either
[=takes an identifier|take an identifier=] or
[=takes an identifier list|take an identifier list=].

The [{{LegacyWindowAlias}}] and [{{NoInterfaceObject}}]
extended attributes must not be specified on the same interface.

The [{{LegacyWindowAlias}}] extended attribute must not be specified
on an interface that does not include the [=primary global interface=]
in its [=exposure set=].

The [{{LegacyWindowAlias}}] extended attribute must not be specified
on a [=callback interface=].

An interface must not have more than one [{{LegacyWindowAlias}}] extended attributes specified.

See [[#legacy-window-alias]] for details on how legacy window aliases
are to be implemented.

<p class="advisement">
[{{LegacyWindowAlias}}] extended attributes are an undesirable feature.
They exist only so that legacy Web platform features can be specified.
They should not be used in specifications
unless required to specify the behavior of legacy APIs.
</p>

<div class="example">

The following IDL defines an interface that uses the
[{{LegacyWindowAlias}}] extended attribute.

<pre highlight="webidl">
[Constructor,
LegacyWindowAlias=WebKitCSSMatrix]
interface DOMMatrix : DOMMatrixReadOnly {
// ...
};
</pre>

An ECMAScript implementation that supports this interface will
expose two properties on the {{Window}} object with the same value
and the same characteristics;
one for exposing the [=interface object=] normally,
and one for exposing it with a legacy name.

<pre highlight="js">
WebKitCSSMatrix === DOMMatrix; // Evaluates to true.

var m = new WebKitCSSMatrix(); // Creates a new object that
// implements DOMMatrix.

m.constructor === DOMMatrix; // Evaluates to true.
m.constructor === WebKitCSSMatrix; // Evaluates to true.
{}.toString.call(m); // Evaluates to '[object DOMMatrix]'.
</pre>
</div>


<h4 id="LenientSetter" extended-attribute lt="LenientSetter">[LenientSetter]</h4>

If the [{{LenientSetter}}]
Expand Down Expand Up @@ -10202,6 +10269,21 @@ the <code>typeof</code> operator will return "function" when applied to an inter
</div>


<h4 id="legacy-window-alias">Legacy window alias</h4>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd move that whole section up in to the introductory section of §3.6 either as second or third ¶ and turn it into something like this:

If the [{{LegacyWindowAlias}}] extended attribute was specified on an interface,
then for each [=identifier=] mentioned in the extended attribute,
there must be a corresponding property on the [=primary global interface=],
known as the <dfn id="dfn-legacy-window-alias" export>legacy window alias</dfn>.
The name of the property is the [=legacy window alias=]'s [=identifier=],
and its value is a reference to the [=interface object=] for the [=interface=].
The property has attributes
{ \[[Writable]]: <emu-val>true</emu-val>, \[[Enumerable]]: <emu-val>false</emu-val>, \[[Configurable]]: <emu-val>true</emu-val> }.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. Only changed "The property has attributes" to "The property has the attributes" for consistency with the surrounding paragraphs.


If the [{{LegacyWindowAlias}}] extended attribute was specified on an interface,
then for each identifier |id| mentioned in the extended attribute,
there must be a corresponding property,
known as the <dfn id="dfn-legacy-window-alias" export>legacy window alias</dfn>,
on the [=primary global interface=].
The property has the following characteristics:

* The name of the property is |id|.
* The value of the property is a reference to the [=interface object=] for the interface.
* The property has attributes
{ \[[Writable]]: <emu-val>true</emu-val>, \[[Enumerable]]: <emu-val>false</emu-val>, \[[Configurable]]: <emu-val>true</emu-val> }.


<h4 id="named-constructors">Named constructors</h4>

A [=named constructor=] that exists due to one or more
Expand Down