Bug Tracker

Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#7467 closed bug (patchwelcome)

$.each, $.extend, etc. should take care of JScript DontEnum bug

Reported by: timmolendijk Owned by:
Priority: undecided Milestone: 1.5
Component: core Version: 1.4.3
Keywords: Cc:
Blocked by: Blocking:

Description

See https://developer.mozilla.org/en/ECMAScript_DontEnum_attribute#JScript_DontEnum_Bug

Take this code:

$.each({a: 1, toString: 'x'}, function(k, v) {
  console.log(k);
});

This should log:

a
toString

This works in all browsers expect IE (I tested in version 8), in which it logs:

a

Change History (8)

comment:1 Changed 9 years ago by dmethvin

Component: unfiledcore
Resolution: patchwelcome
Status: newclosed

The page referenced does not provide any workaround that I could find. If you know of one, reopen the ticket and we will consider it.

comment:4 Changed 9 years ago by Rick Waldron

Yikes! that was the link to the patch file. Thanks Dave.

comment:5 Changed 9 years ago by timmolendijk

Yep I'm currently successfully using a similar work-around.

comment:6 Changed 9 years ago by snover

#5523 is a duplicate of this ticket.

comment:7 Changed 9 years ago by asmecher

This affects JQuery's extend function in that it will sometimes enumerate "prototype" in the copy loop. With my FireFox 3.5.15, the JS example at http://jsfiddle.net/hBbJg/ will show a pop-up (thus buggy enumeration behavior). The "for ( name in options )" loop in "extend" falls prey to the same problem.

comment:8 Changed 9 years ago by timmolendijk

Discussion on the same topic at Underscore.js: https://github.com/documentcloud/underscore/issues/issue/60

Note: See TracTickets for help on using tickets.