And jQuery docs criticize prototype for polluting the global namespace
and in the same breath recommend binding element properties that would
normally go on a class to elements with all the potential namespace
collisions that brings?

O... K...... (backs away slowly).

Honestly, the more I use this framework the less I like it.  The
corruption of 'this' is a major flaw in the framework I don't think
I'll ever be happy with.

On Mar 3, 10:32 pm, Dave Methvin <dave.meth...@gmail.com> wrote:
> > one area of functionality has me befuddled
> > - using object methods to handle events.
>
> To continue Karl's point, if you use jQuery the same way you would use
> prototype then you'll be fighting it all the way. The prototype
> solution squirrels away references to the DOM objects in the class and
> then points event handlers back to the class. jQuery usually
> encapsulates the data and events within the DOM element or a closure,
> e.g.:
>
> $("selector")
>   .data("options", {answer: 42})
>   .click(function(){
>      alert($(this).data("options").answer)
>   });

Reply via email to