[Project_owners] Defining new array methods (SeaMonkey vsFirefox).
Philip Chee
philip.chee at gmail.com
Sat Jun 24 03:22:37 EDT 2006
On Fri, 23 Jun 2006 13:49:48 +0400, Peter B. Shalimoff wrote:
> That for-in loop must be placed _after_ you're done adding your own
> functions to Array.prototype. Anyway, that workaround is not really good,
> because it brings (a little) overhead. Instead of looping through properties
> of Array.prototype, it's better to define substr() method once - in
> Object.prototype:
>
> Object.prototype.substr = function(){return "...";};
Thanks for the info. While your solution fixes the error that crops up
in SeaMonkey js. This doesn't protect against random extensions using
the for...in operator. Since in the Firefly code there is only one
consumer (tree.xbl) for the inArray method, I've moved the code into the
tree.xbl as an additional method of the XBL widget.
Phil
--
Philip Chee <philip at aleytys.pc.my>, <philip.chee at gmail.com>
http://flashblock.mozdev.org/ http://xsidebar.mozdev.org
Guard us from the she-wolf and the wolf, and guard us from the thief,
oh Night, and so be good for us to pass.
[ ]When you discover you are dead, avoid driving a car.
* TagZilla 0.059
More information about the Project_owners
mailing list