Array.prototype.contains

Joshua Bell jsbell at chromium.org
Fri Nov 2 10:31:06 PDT 2012


On Fri, Nov 2, 2012 at 9:14 AM, Rick Waldron <waldron.rick at gmail.com> wrote:

>
> On Fri, Nov 2, 2012 at 11:25 AM, Allen Wirfs-Brock <allen at wirfs-brock.com>wrote:
>
>> There is also the compat issue with Mootools  with String contains...
>>
>> If we decided we needed to rename String contains then it might also
>> impact what we call a similar Array method
>>
>
> Perhaps it should be "has" instead of "contains"? Consistent with the
> other "collections".
>
>
If you dig back far enough in this thread [1], you'll see that one of the
motivations for suggesting this was to be able to obsolete DOMStringList
[2] and quietly switch existing methods to returning plain old Arrays. That
would argue for keeping the name as "contains".

But given that DOMStringList also has an explicit "items" method, and the
implications of the restriction to strings - e.g. calling d.contains(1) or
d.contains(undefined) follow WebIDL rules for stringifying the argument -
it is probably too late to actually remove DOMStringList from the platform.

[1] https://mail.mozilla.org/pipermail/es-discuss/2012-February/020726.html
[2] http://www.w3.org/TR/DOM-Level-3-Core/core.html#DOMStringList
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20121102/a641d991/attachment.html>


More information about the es-discuss mailing list