-
Notifications
You must be signed in to change notification settings - Fork 166
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
Changes from 2 commits
05f32d3
85f1693
44cf513
7b0758c
d346eb0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -940,6 +940,7 @@ limitations. The following extended attributes must not | |
be specified on partial interface definitions: | ||
[{{Constructor}}], | ||
[{{LegacyArrayClass}}], | ||
[{{LegacyWindowAlias}}], | ||
[{{NamedConstructor}}], | ||
[{{NoInterfaceObject}}]. | ||
|
||
|
@@ -965,6 +966,7 @@ The following extended attributes are applicable to interfaces: | |
[{{Exposed}}], | ||
[{{Global}}], | ||
[{{LegacyArrayClass}}], | ||
[{{LegacyWindowAlias}}], | ||
[{{NamedConstructor}}], | ||
[{{NoInterfaceObject}}], | ||
[{{OverrideBuiltins}}], | ||
|
@@ -8725,6 +8727,71 @@ for the specific requirements that the use of | |
entails. | ||
|
||
|
||
<h4 id="LegacyWindowAlias" extended-attribute lt="LegacyWindowAlias">[LegacyWindowAlias]</h4> | ||
|
||
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, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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}}] | ||
|
@@ -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> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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:
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 | ||
|
There was a problem hiding this comment.
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: