On Fri, Jan 7, 2011 at 12:04 AM, Garrett Smith <[email protected]> wrote:
> When another code finds that object and adds an `_id` property, > perhaps in a different version of a rendition of this approach, then > what? Likely, if the object is window. > > Yes, I do believe I said it was an example and that _id should be a very probable unique identifier. You can use _this_is_my_unique_lib_id_identifier_dont_touch_me for all I care. The actual name of the identifier has no impact on the rest of the code so it doesn't matter what it's actual name is. The risk of overwriting is one you have to take, regardless. But isn't that obvious..? > Adding an expando can cause errors in some cases, IIRC, though I can[t > remember specifics. > I'm sure there are (edge case?) problems besides overwriting. I haven't encountered them personally (even though I've used the pattern quite a lot) so it's not something you'll easily be confronted with. Otoh, I haven't really used expandos in IE6 so who knows what kind of pitts you'll get there. The jQuery/Prototype folks probably do. They can chime in :) Of course, when you do encounter a problem due to expando's, it'll be hard to figure them out. There's a reason expandos are frowned upon :) - peter -- To view archived discussions from the original JSMentors Mailman list: http://www.mail-archive.com/[email protected]/ To search via a non-Google archive, visit here: http://www.mail-archive.com/[email protected]/ To unsubscribe from this group, send email to [email protected]
