Nick Fitzgerald:

> In FF 3.6, Array.prototype's and Object.prototype's methods are all
> enumerable, however in Chrome 8.0.552.215, they aren't. Haven't tested any
> other browsers yet...

According to the specification they are not. I am not sure how you
have tested these, but in my instance of Firefox 3.6 browser
everything work in a way described by ECMA-262 standard. My version of
Firefox is 3.6.13 on Ubuntu.

> for (var key in Object.prototype) console.log(key);
> // Chrome logs nothing, FF logs pop, push, filter, map, etc...

I assume that you have tested in Firebug console tab. If I am correct,
your test depends on Firebug evaluation of your code and on the code
at the opened page at this browser tab. For example if you open:
<URL: http://www.prototypejs.org/>
There is included the prototype lib at this page. If you type at
Firebug's console:

for (var key in Array.prototype) console.log(key);

You will see many extensions added by the prototype lib to
`Array.prototype'.  This of course does not mean that all of these are
built-in methods. Javascript is dynamic language and when you are
going to test something you should be more precise.

This test can depend on Firebug's evaluation and execution context in
which has been evaluated your code. For example:

function evaluator(str) {
    var Array = {
        prototype : {
           splice : function (){},
           map    : function (){}
        }
    };
    return eval(str);
}

evaluator('for (var key in Array.prototype) console.log(key);');

This code will display `splice' and `map' but that definitely does not
mean that built-in Array.prototype has enumerable properties `splice'
and `map'.

Please tell us more about your tests and version of your Firefox. I
would like to suggest you to test this with an empty page.

Regards

_______________________________________________
JSMentors mailing list
[email protected]
http://jsmentors.com/mailman/listinfo/jsmentors_jsmentors.com

List Archive:
http://jsmentors.com/pipermail/jsmentors_jsmentors.com/

Reply via email to