Object.each doesn't address IE DontEnum bugs like Object.extend and others #2130

Closed
jdalton opened this Issue Nov 21, 2011 · 3 comments

Comments

Projects
None yet
3 participants
@jdalton

jdalton commented Nov 21, 2011

While your other object iterator methods handle IE's DontEnum bug Object.forEach seems to be missing support.
You can see a test case (view in IE < 9).

@jdalton

This comment has been minimized.

Show comment
Hide comment
@jdalton

jdalton Nov 21, 2011

Copying a bit of code from Function#overloadSetter:

Object.extend('forEach', function(object, fn, bind){
    for (var key in object){
        if (hasOwnProperty.call(object, key)) fn.call(bind, object[key], key, object);
    }
    if (enumerables) for (var i = enumerables.length; i--;){
        key = enumerables[i];
        if (hasOwnProperty.call(object, key)) fn.call(bind, object[key], key, object);
    }
});

jdalton commented Nov 21, 2011

Copying a bit of code from Function#overloadSetter:

Object.extend('forEach', function(object, fn, bind){
    for (var key in object){
        if (hasOwnProperty.call(object, key)) fn.call(bind, object[key], key, object);
    }
    if (enumerables) for (var i = enumerables.length; i--;){
        key = enumerables[i];
        if (hasOwnProperty.call(object, key)) fn.call(bind, object[key], key, object);
    }
});
@arian

This comment has been minimized.

Show comment
Hide comment
@arian

arian Nov 21, 2011

Member

yes, for 2.0 Base there is this ticket https://github.com/mootools/Base/issues/16 already.

Member

arian commented Nov 21, 2011

yes, for 2.0 Base there is this ticket https://github.com/mootools/Base/issues/16 already.

@ibolmo

This comment has been minimized.

Show comment
Hide comment
Member

ibolmo commented Nov 22, 2011

@ghost ghost assigned ibolmo Nov 23, 2011

@ibolmo ibolmo closed this in e6f2db9 Dec 19, 2011

@ibolmo ibolmo reopened this Dec 20, 2011

@ibolmo ibolmo closed this Mar 3, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment