.entries() vs. the web
Andrea Giammarchi
andrea.giammarchi at gmail.com
Tue Jun 17 11:46:31 PDT 2014
FWIW I think this is a non issue and "how many" should not be relevant.
If developers understand the issue, the fix is straight forward.
instead of doing this
```javascript
if (obj.entries) {
// do stuff with entries
} else if(Array.isArray(obj)) {
// do stuff with obj
}
```
or this
`var entries = obj.entries || obj;`
we should just advocate this:
```javascript
if (Array.isArray(obj)) {
// do stuff with obj
} else if(obj.entries) {
// do stuff with entry property
}
```
or using `instanceof` when the realm is not a problem (if performance is a
concern and Array.isArray is the bottleneck which is rarely the case)
This also seems to be an API only related problem where both `Array` and `
Object` could be passed as parameter but yeah, objects with properties
named as `list`, `items`, or `entries` are quite common but I personally
prefer a future proof approach/small refactoring than a stopper for new
specs.
my 2 cents
On Tue, Jun 17, 2014 at 11:18 AM, Alex Russell <slightlyoff at google.com>
wrote:
> Right. Would love to know the size/traffic of the "number of sites"
> affected.
>
>
> On Tue, Jun 17, 2014 at 10:45 AM, Rick Waldron <waldron.rick at gmail.com>
> wrote:
>
>>
>>
>>
>> On Mon, Jun 16, 2014 at 11:11 PM, Brendan Eich <brendan at mozilla.org>
>> wrote:
>>
>>> Would .items fare better, I wonder.
>>>
>>
>> Or outreach to sites the break?
>>
>> Rick
>>
>>
>>>
>>> /be
>>>
>>> Oliver Hunt wrote:
>>>
>>>> It turns out there are a number of sites (such as mobile.twitter.com <
>>>> http://mobile.twitter.com>) that are property detecting .entries on
>>>> objects, and that means that they're breaking when Array.prototype.entries
>>>> is provided.
>>>>
>>>>
>>>> We're removing it from JSC now, until we can find a way to expose it
>>>> without causing site breakage, although this does seem like fixing it would
>>>> require bringing back the awful "pretend that you're undefined" horror.
>>>>
>>>> --Oliver
>>>>
>>>> _______________________________________________
>>>> es-discuss mailing list
>>>> es-discuss at mozilla.org
>>>> https://mail.mozilla.org/listinfo/es-discuss
>>>>
>>> _______________________________________________
>>> es-discuss mailing list
>>> es-discuss at mozilla.org
>>> https://mail.mozilla.org/listinfo/es-discuss
>>>
>>
>>
>> _______________________________________________
>> es-discuss mailing list
>> es-discuss at mozilla.org
>> https://mail.mozilla.org/listinfo/es-discuss
>>
>>
>
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20140617/07d3bc67/attachment.html>
More information about the es-discuss
mailing list