Hacker News new | ask | show | jobs
by ajpiano 5609 days ago
All the jQuery UI plugins allow you to fetch cached references to the widget's proxy elements by grabbing the instance from the jQuery data cache.

var tabs = $("#mytabs").data("tabs"); tabs.lis.append("<button>Add A Button To All your Tabs</button>");

You can use this to avoid doing crazy DOM traversals to work with and customise widget components.

----

That said, we are aware that the perception you share here is not uncommon and that we need to work to document the shared API of our widgets, and that is something we are planning to address in the near term.

1 comments

Didn't know about that one... out of curiosity, where is it documented, and where would I find out what's in each plugin's data (barring inspecting it while it's running)? I haven't seen it mentioned anywhere in the documentation.

I may have sounded overly critical / angry with my comment, which wasn't really intended. I fully recognize what a ridiculously hard task making and maintaining the framework has been, and I use a fair number of them frequently and recommend it heavily. It saves me a ton of work. I just fear still having to use a similar-but-updated version of it in a decade; I want something fundamentally different, which is unlikely to come out of jQuery UI (legacy support, large codebase, and all that good stuff), and I'm not even sure what it would look like.