Enumeration of IE8 properties of replaced built-in properties (e.g. `toString`)

I ran into a very strange problem with the IE8 JS engine (possibly with previous versions, but not IE9 in IE8 mode, since the JS engine is not backing down). A simplified example:

var foo = { toString : 42, x : 22 };
for(var n in foo){ 
    console.log(n)
}

// result: "x"

In other words, the property toStringwill never be listed. Would not be valueOf, hasOwnPropertyetc. Orvar x = 5; x.toFixed = 42;

Thus, any property that originally exists cannot be listed, as far as I can tell, even after replacing it ...

My question is. Does anyone know how to access these?!? I need it because I'm going to prototype an object, but the function toStringdoes not receive.

+2
1

, , IE, - "JScript DontEnum Bug", IE8 .

IE < 9, JScript , , DontEnum.

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

+2

All Articles