Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#7489 closed bug (notabug)

autocomplete fails when new widget '' is created

Reported by: kccarter Owned by:
Priority: minor Milestone: 1.9.0
Component: ui.autocomplete Version: 1.8.1
Keywords: Cc:
Blocked by: Blocking:

Description (last modified by rdworth)

the issue is when a menu widget is created in a different namespace ie: '' the menu property of the autocomplete control no longer has access to the methods defined in '' the menu object is now referencing ''.

this issue was observed in version 1.8.1. based on the look I have taken at version 1.8.13, I believe the issue is still present there as well.

Change History (3)

comment:1 Changed 11 years ago by rdworth

Description: modified (diff)
Resolution: invalid
Status: newclosed

This is as designed. The autocomplete widget depends on via $ That way you can provide your own $ and it will depend on it instead of the one that lives at $ If you want your own menu that doesn't fill that role, give it a different alias in the $.fn. namespace with $.widget.bridge and then use bridge to restore the $ -> $ alias:

$.widget.bridge( "jqnMenu", $ );
$.widget.bridge( "menu", $ );

This assumes you load autocomplete (which includes first, then If you load before autocomplete then only the first line above should be needed. If you have additional questions about this, please ask on the forum

For more on the widget bridge, see

comment:2 Changed 11 years ago by rdworth

Even though I believe this is as-designed today, it's something I think we should consider fixing in a future major release. I've added a comment to that effect on the Widget factory wiki page: . Feel free to follow up there.

comment:3 Changed 11 years ago by kccarter

I was thinking about this problem and I think I came up with a reasonable solution. this could would reside in the jquery.ui.widget.js file right after the var _remove line.


widget: function (name, options) {

var parts = String(name).split('.'), namespace = parts[0], name = parts[1], _widget = $[namespace][name];

/* when calling into a namespace in order to set the /*this*/ variable we have to instanciate a new instance of the widget. could we pass a reference to the widgets prototype? if we did does it risk corruption of that widget's class?*/

if ($.isFunction(_widget)) { _widget(), options, this); /*, options, this);*/


return this;



Note: See TracTickets for help on using tickets.