On Oct 23, 6:25 am, buda <[email protected]> wrote:
> I've noticed that library's isArray not worked properly sometimes.

When? A statement like that really requires data. I suspect where you
haven't seen it work, the object genuinely isn't an array.

Prototype's `Object.isArray` function relies on the JavaScript engine
correctly implementing the specification for
`Object.prototype.toString` (Section 15.2.4.2[1]). I've never met an
engine that didn't implement that correctly. In contrast, your
implementation gives false negatives on any browser that hasn't yet
implemented the new `forEach` array prototype method from ECMAScript5
(so, IE8 and downward), and gives false positives on any object that
just happens to have a property called `forEach`. Respectfully, the
Prototype implementation is much more robust.

[1] http://es5.github.com/#x15.2.4.2
--
T.J. Crowder
Independent Software Engineer
tj / crowder software / com
www / crowder software / com

-- 
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.

Reply via email to