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

Normative: specify web reality for Array.prototype.join with cyclic values #1518

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all 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
11 changes: 10 additions & 1 deletion spec.html
Original file line number Diff line number Diff line change
Expand Up @@ -32143,6 +32143,9 @@ <h1>Array.prototype.join ( _separator_ )</h1>
<emu-note>
<p>The elements of the array are converted to Strings, and these Strings are then concatenated, separated by occurrences of the _separator_. If no separator is provided, a single comma is used as the separator.</p>
</emu-note>
<emu-note>
The `join` method has a [[SeenObjects]] internal slot whose value is a new empty List.
</emu-note>
<p>The `join` method takes one argument, _separator_, and performs the following steps:</p>
<emu-alg>
1. Let _O_ be ? ToObject(*this* value).
Expand All @@ -32151,12 +32154,18 @@ <h1>Array.prototype.join ( _separator_ )</h1>
1. Else, let _sep_ be ? ToString(_separator_).
1. Let _R_ be the empty String.
1. Let _k_ be 0.
1. Let _seen_ be %Array.prototype.join%.[[SeenObjects]].
1. Repeat, while _k_ &lt; _len_
1. If _k_ &gt; 0, set _R_ to the string-concatenation of _R_ and _sep_.
1. Let _element_ be ? Get(_O_, ! ToString(_k_)).
1. If _element_ is *undefined* or *null*, let _next_ be the empty String; otherwise, let _next_ be ? ToString(_element_).
1. If Type(_element_) is Object and _seen_ contains _element_, then
1. Let _next_ be the empty String.
1. Else,
1. If Type(_element_) is Object, append _element_ to _seen_.
1. If _element_ is *undefined* or *null*, let _next_ be the empty String; otherwise, let _next_ be ? ToString(_element_).
1. Set _R_ to the string-concatenation of _R_ and _next_.
1. Increase _k_ by 1.
1. Set %Array.prototype.join%.[[SeenObjects]] to a new empty List.
1. Return _R_.
</emu-alg>
ljharb marked this conversation as resolved.
Show resolved Hide resolved
<emu-note>
Expand Down