$.ui.widget and scoping: how to get a reference to the widget instance from within a click event handler?
Good evening y'all (Europe here ;)),
been fiddling around in jQuery.UI this afternoon in order to write a
widget. One problem I encountered and couldn't get properly solved was
with referring to the instance of the widget from within a click
event.
I've set up a demoscript over at http://www.bram.us/sandbox/jquery/ui/widget.html
Just click the li's and watch your Firebug console ;)
One path I've walked in order to get it work is to attach this (the
instance of the widget) via $.data on each li. However, when working
with a huge set, that seemed to hog my system, as Firefox would end up
eating over 500MB of RAM.
Anyone has any clue to this one? Looked at several sources of the UI
core files (draggable, tabs, etc.) and I think they fall back on
the .call() method. Whilst looking at the code however I couldn't find
where exactly the magic happened in order for it to work.
Regards,
Bramus!
(posted this one on jquery-en, but then noticed that a jquery-ui
exists ... thus reposting it here ;))