> 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.prototype would be the best
option in my case as I will be using the code inside Cocoa/Webkit
wrapper only.
I now realize that it's really easy to have naming clash, especially
on form elements, so I should probably keep all my extensions in
separate namespace, e.g.:
Element.prototype.ext = {}
Element.prototype.ext.disabled = function() { blah; }
Element.prototype.ext.hasClass = function() {blah; }
Element.prototype.ext.isSVG = function() { blah; }
Alternatively, I could use certain naming convention, e.g.:
Element.prototype._disabled = function() { blah; }
Element.prototype._hasClass = function() {blah; }
Element.prototype._isSVG = function() { blah; }
--
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]