Re: [JSMentors] Re: Extending built-in objects with properties

2011-03-22 Thread Christophe Porteneuve
Hey Jarek, Be very wary of this, as your namespace expando (e.g. the "ext" property in there has a number of potential pitfalls: * Any other script in place can overwrite it * Your methods are bound to the expando, not the prototype. So their binding (what "this" will mean inside them) is b

Re: [JSMentors] Re: Extending built-in objects with properties

2011-03-22 Thread Christophe Porteneuve
Le 21/03/2011 02:59, RobG a écrit : Don't do that. Do not mess with host objects, you do not know how they will deal with added properties. Oh, and you don't have to take my word for it: Kangax, "What’s wrong with extending the DOM", 5 April 2010

[JSMentors] Re: Extending built-in objects with properties

2011-03-22 Thread Scott Sauyet
On Mar 21, 9:48 am, RobG wrote: > On Mar 21, 10:30 pm, Jarek Foksa wrote: > To do this stuff robustly, you often need to use getters and setters, > so: > > Element.prototype.uXgetDisabled = function() {...} > Element.prototype.uXsetDisabled = function(arg) {...} I'm curious as to why you think

[JSMentors] Re: Extending built-in objects with properties

2011-03-21 Thread RobG
On Mar 21, 10:30 pm, Jarek Foksa wrote: > > Oh, and you don't have to take my word for it: > > > Kangax, "What’s wrong with extending the DOM", 5 April 2010 > >http://perfectionkills.com/whats-wrong-with-extending-the-dom/ > > Very nice article and discussion beneath it, thanks for pointing this

Re: [JSMentors] Re: Extending built-in objects with properties

2011-03-21 Thread Poetro
2011/3/21 Jarek Foksa : >> Oh, and you don't have to take my word for it: >> >> Kangax, "What’s wrong with extending the DOM", 5 April 2010 >> http://perfectionkills.com/whats-wrong-with-extending-the-dom/ > > Very nice article and discussion beneath it, thanks for pointing this out. > > But I stil

Re: [JSMentors] Re: Extending built-in objects with properties

2011-03-21 Thread Jarek Foksa
> Oh, and you don't have to take my word for it: > > Kangax, "What’s wrong with extending the DOM", 5 April 2010 > http://perfectionkills.com/whats-wrong-with-extending-the-dom/ Very nice article and discussion beneath it, thanks for pointing this out. But I still think that extending Element.pro

[JSMentors] Re: Extending built-in objects with properties

2011-03-20 Thread RobG
On Mar 21, 11:50 am, RobG wrote: > On Mar 21, 5:17 am, Jarek Foksa wrote: > > > I do a lot of operations on objects retrieved by querySelector() and > > simillar DOM methods, so I thought it would be nice to extend the > > built-in Element object with some useful methods and properties. > > Don

[JSMentors] Re: Extending built-in objects with properties

2011-03-20 Thread RobG
On Mar 21, 5:17 am, Jarek Foksa wrote: > I do a lot of operations on objects retrieved by querySelector() and > simillar DOM methods, so I thought it would be nice to extend the > built-in Element object with some useful methods and properties. Don't do that. Do not mess with host objects, you