tc39 / proposal-set-methods

Proposal for new Set methods in JS
https://tc39.github.io/proposal-set-methods/
Other
655 stars 15 forks source link

Set.prototype.difference removes the wrong element #103

Closed Ms2ger closed 11 months ago

Ms2ger commented 11 months ago

In step 6:

i. Let e be resultSetData[index].
ii. Set index to index + 1.
iii. If e is not empty, then

    1. Let inOther be ToBoolean(? Call(otherRec.[[Has]], otherRec.[[Set]], « e »)).
    2. If inOther is true, then
        a. Set resultSetData[index] to empty.

substeps ii. and iii. should be swapped to avoid erasing the element after the matching one.