Skip to content

Commit

Permalink
change grammar: mixin -> interface mixin
Browse files Browse the repository at this point in the history
  • Loading branch information
tobie committed Oct 1, 2017
1 parent eb01163 commit 8629d01
Showing 1 changed file with 49 additions and 39 deletions.
88 changes: 49 additions & 39 deletions index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ in [[#es-extended-attributes]].

<pre class="grammar" id="prod-Definition">
Definition :
CallbackOrInterface
CallbackOrInterfaceOrMixin
Namespace
Partial
Dictionary
Expand All @@ -436,12 +436,6 @@ in [[#es-extended-attributes]].
IncludesStatement
</pre>

<pre class="grammar" id="prod-CallbackOrInterface">
CallbackOrInterface :
"callback" CallbackRestOrInterface
Interface
</pre>

<div class="example">

The following is an example of an [=IDL fragment=].
Expand Down Expand Up @@ -726,8 +720,8 @@ 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 <dfn id="dfn-interface" export>interface</dfn> is a definition (matching
<emu-nt><a href="#prod-Interface">Interface</a></emu-nt> or
<emu-t>callback</emu-t> <emu-nt><a href="#prod-Interface">Interface</a></emu-nt>) that declares some
<emu-t>interface</emu-t> <emu-nt><a href="#prod-InterfaceRest">InterfaceRest</a></emu-nt> or
<emu-t>callback</emu-t> <emu-t>interface</emu-t> <emu-nt><a href="#prod-InterfaceRest">InterfaceRest</a></emu-nt>) that declares some
state and behavior that an object implementing that interface will expose.

<pre highlight="webidl" class="syntax">
Expand Down Expand Up @@ -1023,17 +1017,27 @@ The following extended attributes are applicable to interfaces:
[{{PrimaryGlobal}}], and
[{{SecureContext}}].

<div data-fill-with="grammar-CallbackOrInterface"></div>
<pre class="grammar" id="prod-CallbackOrInterfaceOrMixin">
CallbackOrInterfaceOrMixin :
"callback" CallbackRestOrInterface
"interface" InterfaceOrMixin
</pre>

<pre class="grammar" id="prod-CallbackRestOrInterface">
CallbackRestOrInterface :
CallbackRest
Interface
"interface" InterfaceRest
</pre>

<pre class="grammar" id="prod-Interface">
Interface :
"interface" identifier Inheritance "{" InterfaceMembers "}" ";"
<pre class="grammar" id="prod-InterfaceOrMixin">
InterfaceOrMixin :
InterfaceRest
MixinRest
</pre>

<pre class="grammar" id="prod-InterfaceRest">
InterfaceRest :
identifier Inheritance "{" InterfaceMembers "}" ";"
</pre>

<pre class="grammar" id="prod-Partial">
Expand All @@ -1043,15 +1047,20 @@ The following extended attributes are applicable to interfaces:

<pre class="grammar" id="prod-PartialDefinition">
PartialDefinition :
PartialInterface
PartialMixin
"interface" PartialInterfaceOrPartialMixin
PartialDictionary
Namespace
</pre>

<pre class="grammar" id="prod-PartialInterfaceOrPartialMixin">
PartialInterfaceOrPartialMixin :
PartialInterface
MixinRest
</pre>

<pre class="grammar" id="prod-PartialInterface">
PartialInterface :
"interface" identifier "{" InterfaceMembers "}" ";"
identifier "{" InterfaceMembers "}" ";"
</pre>

<pre class="grammar" id="prod-InterfaceMembers">
Expand Down Expand Up @@ -1160,12 +1169,12 @@ The following extended attributes are applicable to interfaces:

<h3 id="idl-mixins">Mixins</h3>

A <dfn export>mixin</dfn> is a definition (matching <emu-nt><a href="#prod-Mixin">Mixin</a></emu-nt>)
A <dfn export>mixin</dfn> is a definition (matching <emu-t>interface</emu-t> <emu-nt><a href="#prod-MixinRest">MixinRest</a></emu-nt>)
that declares state and behavior that can be [=included=] by one or more [=interfaces=],
and that are exposed by objects that implement an [=interface=] that [=includes=] the [=mixin=].

<pre class="webidl" class="syntax">
mixin identifier {
interface mixin identifier {
/* mixin_members... */
};
</pre>
Expand All @@ -1186,17 +1195,17 @@ as if they were specified on the [=interface=] that [=includes=] them.

As with interfaces, the IDL for mixins can be split into multiple parts by using
<dfn export>partial mixin</dfn> definitions
(matching <emu-t>partial</emu-t> <emu-nt><a href="#prod-Mixin">Mixin</a></emu-nt>).
(matching <emu-t>partial</emu-t> <emu-t>interface</emu-t> <emu-nt><a href="#prod-MixinRest">MixinRest</a></emu-nt>).
The [=identifier=] of a partial mixin definition must be the same as the identifier of a mixin definition.
All of the [=mixin members|members=] that appear on each of the partial mixin definitions
are considered to be members of the mixin itself.

<pre class="webidl" class="syntax">
mixin <mark>SomeMixin</mark> {
interface mixin <mark>SomeMixin</mark> {
/* mixin_members... */
};

partial mixin <mark>SomeMixin</mark> {
partial interface mixin <mark>SomeMixin</mark> {
/* mixin_members... */
};
</pre>
Expand Down Expand Up @@ -1251,7 +1260,7 @@ No [=extended attributes=] defined in this specification are applicable to [=inc
// ...
};

mixin Observable {
interface mixin Observable {
void addEventListener(DOMString type,
EventListener listener,
boolean useCapture);
Expand Down Expand Up @@ -1282,7 +1291,7 @@ No [=extended attributes=] defined in this specification are applicable to [=inc
For example, instead of:

<pre class="webidl">
mixin WindowSessionStorage {
interface mixin WindowSessionStorage {
readonly attribute Storage sessionStorage;
};
Window includes WindowSessionStorage;
Expand All @@ -1304,7 +1313,7 @@ No [=extended attributes=] defined in this specification are applicable to [=inc
For example, instead of the common but verbose:

<pre class="webidl">
mixin GlobalCrypto {
interface mixin GlobalCrypto {
[Throws] readonly attribute Crypto crypto;
};

Expand All @@ -1315,23 +1324,24 @@ No [=extended attributes=] defined in this specification are applicable to [=inc
you can extend the {{WindowOrWorkerGlobalScope}} [=mixin=] using a [=partial mixin|partial=]:

<pre class="webidl">
partial mixin WindowOrWorkerGlobalScope {
partial interface mixin WindowOrWorkerGlobalScope {
[Throws] readonly attribute Crypto crypto;
};
</pre>
</div>

<div data-fill-with="grammar-CallbackOrInterfaceOrMixin"></div>

<div data-fill-with="grammar-CallbackRestOrInterfaceOrMixin"></div>

<div data-fill-with="grammar-InterfaceOrMixin"></div>

<div data-fill-with="grammar-Partial"></div>

<div data-fill-with="grammar-PartialDefinition"></div>

<pre class="grammar" id="prod-Mixin">
Mixin :
"mixin" identifier "{" MixinMembers "}" ";"
</pre>

<pre class="grammar" id="prod-PartialMixin">
PartialMixin :
<pre class="grammar" id="prod-MixinRest">
MixinRest :
"mixin" identifier "{" MixinMembers "}" ";"
</pre>

Expand Down Expand Up @@ -5029,9 +5039,9 @@ be used as the type of a [=constant=].
The following extended attribute is applicable to callback functions:
[{{TreatNonObjectAsNull}}].

<div data-fill-with="grammar-CallbackOrInterface"></div>
<div data-fill-with="grammar-CallbackOrInterfaceOrMixin"></div>

<div data-fill-with="grammar-CallbackRestOrInterface"></div>
<div data-fill-with="grammar-CallbackRestOrInterfaceOrMixin"></div>

<pre class="grammar" id="prod-CallbackRest">
CallbackRest :
Expand Down Expand Up @@ -11292,20 +11302,20 @@ The [=return type=] of the [=default toJSON operation=] must be {{object}}.
attribute DOMString c;
};

mixin M1 {
interface mixin M1 {
attribute DOMString m1;
};

mixin M2 {
interface mixin M2 {
[Default] object toJSON();
attribute DOMString m2;
};

mixin M3 {
interface mixin M3 {
attribute DOMString m3;
};

mixin M4 {
interface mixin M4 {
attribute DOMString m4;
};

Expand Down

0 comments on commit 8629d01

Please sign in to comment.