move to a centralized form element selector to leverage keepnative

This commit is contained in:
John Bender 2011-10-10 13:19:49 -07:00
parent b358985ca2
commit 0e5583eae9
2 changed files with 7 additions and 3 deletions

View file

@ -217,8 +217,6 @@ $.widget( "mobile.selectmenu", $.mobile.widget, {
//auto self-init widgets
$( document ).bind( "pagecreate create", function( e ){
$( $.mobile.selectmenu.prototype.options.initSelector, e.target )
.not( ":jqmData(role='none'), :jqmData(role='nojs')" )
.selectmenu();
$.mobile.selectmenu.prototype.enhanceWithin( e.target );
});
})( jQuery );

View file

@ -36,6 +36,12 @@ $.widget( "mobile.widget", {
});
return options;
},
enhanceWithin: function( target ) {
var keepNative = $.mobile.page.prototype.keepNativeSelector();
$( this.options.initSelector, target ).not( keepNative )[this.widgetName]();
}
});