> > Thank you very much! That was it.
> > [Object.prototype.objRef = null;]
> >
> > Any idea why that would have been done in the first place?
Probably because the person who wrote that code didn't know any better!
> > I ran into another issue that all my for loops in code I added to
> > mscross were returning a null objRef at the end of the loop
> > and I had to add code to detect that and break out of the loop.
> > This is all a little new to me and I'm still learning.
Yes, that is the same problem that broke jQuery. The Object.prototype.objRef
= null; assignment adds an objRef property to *every* object.
> Stephen, as I wrote in the other post, to avoid these
> problems, you should use these loops like this:
>
> for (propName in obj) {
> if (obj.hasOwnProperty(propName)) {
> // do something with property...
> }
> }
But not every browser supports hasOwnProperty. Safari doesn't. Does IE 5.5?
In the "Object.prototype is verboten" article someone posted a comment with
code to implement object.hasOwnProperty, but the code isn't exactly speedy.
(And it has one bug - it should use === for the comparison instead of ==.)
I wouldn't be too keen on adding this overhead to jQuery or my own code.
-Mike
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/