Skip to content

Commit 50fc7e9

Browse files
committed
Fix forEach algorithm of interfaces with indexed props.
1 parent 8b14740 commit 50fc7e9

File tree

2 files changed

+20
-19
lines changed

2 files changed

+20
-19
lines changed

index.bs

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11176,21 +11176,22 @@ If the interface defines an [=indexed property getter=],
1117611176
then the <emu-val>Function</emu-val> object is
1117711177
the initial value of the “forEach” data property of [=%ArrayPrototype%=].
1117811178

11179-
If the interface has a [=pair iterator=],
11180-
then the <emu-val>Function</emu-val> must
11181-
have the same behavior as one that would exist
11182-
assuming the interface had this [=operation=]
11183-
instead of the [=iterable declaration=]:
11184-
11185-
<pre highlight="webidl">
11186-
interface Iterable {
11187-
void forEach(Function callback, optional any thisArg);
11188-
};
11189-
</pre>
11179+
<div algorithm="to invoke the forEach method of interfaces with indexed properties">
1119011180

11191-
with the following prose definition:
11181+
If the interface has a [=pair iterator=],
11182+
then the <emu-val>Function</emu-val> must have the same behavior,
11183+
when invoked with argument |callback| and optional argument |thisArg|,
11184+
as one that would exist assuming the interface had this [=operation=]
11185+
instead of the [=iterable declaration=]:
11186+
11187+
<pre highlight="webidl">
11188+
interface Iterable {
11189+
void forEach(Function callback, optional any thisArg);
11190+
};
11191+
</pre>
11192+
11193+
with the following prose definition:
1119211194

11193-
<div algorithm="to invoke the forEach method of interfaces with indexed properties">
1119411195
1. Let |O| be the <strong>this</strong> value.
1119511196
1. Let |pairs| be the list of [=value pairs to iterate over=].
1119611197
1. Let |i| be 0.

index.html

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10645,16 +10645,16 @@ <h5 class="heading settled" data-level="3.6.8.2" id="es-forEach"><span class="se
1064510645
<p>If the interface defines an <a data-link-type="dfn" href="#dfn-indexed-property-getter" id="ref-for-dfn-indexed-property-getter-7">indexed property getter</a>,
1064610646
then the <emu-val>Function</emu-val> object is
1064710647
the initial value of the “forEach” data property of <a data-link-type="dfn" href="https://tc39.github.io/ecma262/#sec-well-known-intrinsic-objects">%ArrayPrototype%</a>.</p>
10648-
<p>If the interface has a <a data-link-type="dfn" href="#dfn-pair-iterator" id="ref-for-dfn-pair-iterator-6">pair iterator</a>,
10649-
then the <emu-val>Function</emu-val> must
10650-
have the same behavior as one that would exist
10651-
assuming the interface had this <a data-link-type="dfn" href="#dfn-operation" id="ref-for-dfn-operation-73">operation</a> instead of the <a data-link-type="dfn" href="#dfn-iterable-declaration" id="ref-for-dfn-iterable-declaration-12">iterable declaration</a>:</p>
10648+
<div class="algorithm" data-algorithm="to invoke the forEach method of interfaces with indexed properties">
10649+
<p>If the interface has a <a data-link-type="dfn" href="#dfn-pair-iterator" id="ref-for-dfn-pair-iterator-6">pair iterator</a>,
10650+
then the <emu-val>Function</emu-val> must have the same behavior,
10651+
when invoked with argument <var>callback</var> and optional argument <var>thisArg</var>,
10652+
as one that would exist assuming the interface had this <a data-link-type="dfn" href="#dfn-operation" id="ref-for-dfn-operation-73">operation</a> instead of the <a data-link-type="dfn" href="#dfn-iterable-declaration" id="ref-for-dfn-iterable-declaration-12">iterable declaration</a>:</p>
1065210653
<pre class="highlight"><span class="kt">interface</span> <span class="nv">Iterable</span> {
1065310654
<span class="kt">void</span> <span class="nv">forEach</span>(<span class="n">Function</span> <span class="nv">callback</span>, <span class="kt">optional</span> <span class="kt">any</span> <span class="nv">thisArg</span>);
1065410655
};
1065510656
</pre>
10656-
<p>with the following prose definition:</p>
10657-
<div class="algorithm" data-algorithm="to invoke the forEach method of interfaces with indexed properties">
10657+
<p>with the following prose definition:</p>
1065810658
<ol>
1065910659
<li data-md="">
1066010660
<p>Let <var>O</var> be the <strong>this</strong> value.</p>

0 commit comments

Comments
 (0)