Skip to main content

Search and Top Navigation

#6891 closed feature (fixed)

Opened January 24, 2011 01:04AM UTC

Closed January 24, 2011 01:06AM UTC

Widget: Improve API for direct instantiation

Reported by: scottgonzalez Owned by:
Priority: minor Milestone: 1.9.0
Component: ui.widget Version: 1.8.8
Keywords: Cc:
Blocked by: Blocking:

When instantiating a widget directly (new $.ui.dialog( options, element )), the following should be improved:

  • The new keyword should be optional
  • When not using the new keyword, the widget should be initialized even if called with no parameters
  • When called with the new keyword, the widget should not be initialized to allow the simple inheritance pattern to continue to work
  • The widget should be able to generate an element if one is not provided
  • Providing a selector or jQuery object instead of a DOMElement should fully work
  • Currently the widget will be instantiated and this.element will be correct, but the instance will not be stored as data on the element
Attachments (0)
Change History (1)

Changed January 24, 2011 01:06AM UTC by scottgonzalez comment:1

resolution: → fixed
status: newclosed

Implemented in 3a0b617bb44565aacfa90c2ee20b293654d911c9 and 244eebe74dbc7bb35141e58e52ef9eaa21bd35f1.

Tests added in bc71499a505d0932668b4ae75603cd9dbfd4a2ac.

Proper default elements for all widgets in 29bfb86ce2e192dae456bf15655c25cb469ad977.