rzel / joose-js

Automatically exported from code.google.com/p/joose-js
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Type validation for Array might fail #9

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Just a small suggestion for improvement:
Type.Array in Joose/Types.js in version 2.0rc1 uses "A instanceof Array"
for validating if A is an Array. In some occasions this expression can
fail, e.g. when scripting across frames. The following blog entry describes
the issue quite well:
http://thinkweb2.com/projects/prototype/instanceof-considered-harmful-or-how-to-
write-a-robust-isarray/

You might want to change the code to something like 
Object.prototype.toString.call(o) === '[object Array]'

Best
Silvan

Original issue reported on code.google.com by silvango...@gmail.com on 13 Jan 2009 at 11:32

GoogleCodeExporter commented 9 years ago
Thank You,

fixed in trunk.

Original comment by malte.ubl on 15 Jan 2009 at 9:52