Skip to content

Commit b82af55

Browse files
Ms2gerTimothyGu
andauthored
Editorial: better explanation of the Global extended attribute
Closes #748. Co-authored-by: Timothy Gu <[email protected]>
1 parent 350fb2a commit b82af55

File tree

1 file changed

+25
-21
lines changed

1 file changed

+25
-21
lines changed

index.bs

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -9437,12 +9437,31 @@ for the specific requirements that the use of
94379437
<h4 oldids="PrimaryGlobal" id="Global" extended-attribute lt="Global">[Global]</h4>
94389438

94399439
If the [{{Global}}] [=extended attribute=] appears on an [=interface=],
9440-
it indicates that objects implementing this interface can
9441-
be used as the global object in a [=Realm=],
9442-
and that the structure of the prototype chain and how
9443-
properties corresponding to [=interface members=]
9444-
will be reflected on the prototype objects will be different from other
9445-
interfaces. Specifically:
9440+
it indicates that objects implementing this interface will
9441+
be used as the global object in a [=Realm=].
9442+
9443+
The [{{Global}}] [=extended attribute=] also defines the
9444+
<dfn id="dfn-global-name" export>global names</dfn> for the [=interface=]:
9445+
9446+
<dl class="switch">
9447+
: If the [{{Global}}] [=extended attribute=] [=takes an identifier=]
9448+
:: « the given [=identifier=] »
9449+
: If the [{{Global}}] [=extended attribute=] [=takes an identifier list=]
9450+
:: the identifier list
9451+
</dl>
9452+
9453+
The [{{Global}}] extended attribute must be one of the forms given above.
9454+
9455+
Note: The [=global names=] for the [=interface=] are the [=identifiers=] that can be used to
9456+
reference it in the [{{Exposed}}] [=extended attribute=].
9457+
A single name can be shared across multiple different global interfaces,
9458+
allowing an interface to more easily use [{{Exposed}}] to expose itself to all of them at once.
9459+
For example, "<code>Worker</code>" is used to refer to several distinct types of threading-related
9460+
global interfaces.
9461+
9462+
For these global [=interfaces=], the structure of the prototype chain and how properties
9463+
corresponding to [=interface members=] will be reflected on the prototype objects will be different
9464+
from other interfaces. Specifically:
94469465

94479466
1. Any [=named properties=]
94489467
will be exposed on an object in the prototype chain – the
@@ -9524,21 +9543,6 @@ across those interfaces.
95249543
Note: This is because all of the [=members=] of the interface
95259544
get flattened down on to the object that [=implements=] the interface.
95269545

9527-
The [{{Global}}] extended attribute
9528-
can also be used to give a name to one or more global interfaces,
9529-
which can then be referenced by the [{{Exposed}}]
9530-
extended attribute.
9531-
9532-
The [{{Global}}] extended attribute must either
9533-
[=takes an identifier|take an identifier=] or
9534-
[=takes an identifier list|take an identifier list=].
9535-
9536-
The identifier argument or identifier list argument the [{{Global}}] [=extended attribute=] is declared with
9537-
define the interface’s <dfn id="dfn-global-name" export>global names</dfn>.
9538-
9539-
Note: The identifier argument list exists so that more than one global interface can
9540-
be addressed with a single name in an [{{Exposed}}] [=extended attribute=].
9541-
95429546
See [[#named-properties-object]] for the specific requirements
95439547
that the use of [{{Global}}] entails for [=named properties=],
95449548
and [[#es-constants]], [[#es-attributes]] and [[#es-operations]]

0 commit comments

Comments
 (0)