Hi Scott,
The change would be almost enough for everything, I have just re-implemented it following your direction like:
- this.menu = this._createMenu()
.addClass( "ui-autocomplete" )
.appendTo( "body", doc )
.zIndex( this.element.zIndex() + 1 )
// workaround for jQuery bug #5781 http://dev.jquery.com/ticket/5781
.css({ top: 0, left: 0 })
.hide()
.data( "menu" );
then:
- _createMenu: function() {
- self = this;
- return $( "<ul></ul>" )
- .menu({
- focus: function(event, ui) {
- ....
- })
- },
Having this, one can extend the existing menu by just overriding the _createMenu() method -- I could add the special functions to it
Then, the last thing needed, is to deal with small discrepancy in the close method:
- close: function( event ) {
clearTimeout( this.closing );
if ( this.menu.element.is(":visible") ) {
if (this._trigger( "close", event ) !== false) {
this.menu.element.hide();
this.menu.deactivate();
}
}
},
The only difference, with respect to the original implementation is the !== false check -- I believe this change fits well with the other triggers, like focus or select, that also return a value if some action should be taken. The close option was not sensitive to it.
If these changes are in place, I could add the other things by extension to the default menu behaviour.
What do you think?