#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 12 years ago by
Component: | unfiled → core |
---|---|
Resolution: | → patchwelcome |
Status: | new → closed |
comment:2 Changed 12 years ago by
I know Prototype.js does this, but I think their implementation suffers performance.
comment:7 Changed 12 years ago by
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 12 years ago by
Discussion on the same topic at Underscore.js: https://github.com/documentcloud/underscore/issues/issue/60
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.