Skip to main content

Search and Top Navigation

#14941 closed feature (wontfix)

Opened March 31, 2016 05:45PM UTC

Closed March 31, 2016 08:50PM UTC

Last modified March 31, 2016 08:58PM UTC

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

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

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

Attachments (0)
Change History (2)

Changed March 31, 2016 06:06PM UTC by scottgonzalez comment:1

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.

Changed March 31, 2016 08:50PM UTC by scottgonzalez comment:2

_comment0: @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 Ajax 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. Thats not really a matter of jQuery Ui thats 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 provides auto-initalizeation of the content and widgets which pulls in. Starting with the about to be released 1.5 version this is a stand alone module which will work with jQuery UI its not in a stable release yet but you can find it here https://github.com/jquery/jquery-mobile/blob/1.5-dev/js/widgets/enhancer.js \ \ 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. 1459457937758986
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 https://github.com/jquery/jquery-mobile/blob/1.5-dev/js/widgets/enhancer.js

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.