#15019 closed bug (fixed)
Widget instance does not return undefined for empty jQuery collection
Reported by: | Victor Homyakov | Owned by: | Scott González |
---|---|---|---|
Priority: | minor | Milestone: | 1.12.1 |
Component: | ui.widget | Version: | 1.12.0 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
Current versions of jQuery UI return following values for widget instance:
- When widget is initialized: widget instance
- When widget is not initialized:
undefined
- When jQuery collection is empty: empty jQuery collection
https://jsfiddle.net/gtmbwyb9/
This is a bit misleading because as stated in https://api.jqueryui.com/jQuery.widget/#method-instance, if the element does not have an associated instance, undefined
is returned. I ran into that problem in single-page application, while I was simply checking for non-undefined widget instance before calling widget methods. In case when DOM element is missing, additional check is required.
Change History (2)
comment:1 Changed 7 years ago by
Owner: | set to Scott González |
---|---|
Resolution: | → fixed |
Status: | new → closed |
comment:2 Changed 7 years ago by
Milestone: | none → 1.12.1 |
---|
Note: See
TracTickets for help on using
tickets.
In 3dd8a09: