Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#14941 closed feature (wontfix)

The jquery ui examples don't have an example for if HTML is being pulled in through $.ajax

Reported by: K Stanton Owned by:
Priority: minor Milestone: none
Component: ui.core Version: 1.11.3
Keywords: Cc:
Blocked by: Blocking:


Speaking from someone who will be giving a talk at a programming conference on PJAX, why aren't there examples for things like "PJAX"?

Change History (2)

comment:1 Changed 6 years ago by Scott González

The code is literally the same, just run at a different time. There are no examples with PJAX because we don't show integration with anything outside of jQuery UI. If we did, we'd be swamped.

comment:2 Changed 6 years ago by Alexander Schmitz

Resolution: wontfix
Status: newclosed

@KMStanton this is a response to both this issue and your forum posts on the same subject. jQuery UI does not automatically initialize any widget ever, regardless of if its loaded via AJAX or in your page to begin with, you are always responsible for initializing your own widgets. When you do a jQuery selector like $( ".some-widget" ) and initialize widgets based on it that happens at that moment with whatever matches, anything added in the future you are responsible for knowing about and calling. That's not really a matter of jQuery UI, that's just how selectors and JS work. For PJAX specifically we don't show examples integrating with any 3rd party code in jQuery UI. There are just too many things out there that integrate with jQuery UI we could never keep up, it would just be a pandoras box if we started. We have had very good luck with interested 3rd parties showing how to integrate with us instead.

There are options for doing auto initialization of widgets but they are outside the scope of jQuery UI and so we would not add examples for them.

Two options for this type of thing are jQuery Mobile which is an AJAX framework built around jQuery UI and provides auto-initialization of the content and widgets which it pulls in. Starting with the about to be released 1.5 version this is a stand alone module which will work with jQuery UI; it's not in a stable release yet but you can find it here

Another option would be to use a mutation observer to watch for change in the DOM and initialize widgets based on this.

Both of these options though are outside the scope of jQuery UI and its demos.

This would potentially be a good learning center article though.

Finally in your forum post you mention bugs in jQuery UI. If you have found any bugs in jQuery UI could you please open new issues with those so we can get them fixed?

I'm going to close this ticket since its not a bug and not something thats inline with other demos we have.

Last edited 6 years ago by Scott González (previous) (diff)
Note: See TracTickets for help on using tickets.