mirror of
https://github.com/Hopiu/jquery-mobile.git
synced 2026-04-25 16:44:43 +00:00
Change .live() to .delegate()
This commit is contained in:
parent
3fdb12600e
commit
c367c832e2
6 changed files with 10 additions and 14 deletions
|
|
@ -66,7 +66,7 @@ $.widget( "mobile.dialog", $.mobile.widget, {
|
|||
});
|
||||
|
||||
//auto self-init widgets
|
||||
$( $.mobile.dialog.prototype.options.initSelector ).live( "pagecreate", function(){
|
||||
$( document ).delegate( $.mobile.dialog.prototype.options.initSelector, "pagecreate", function(){
|
||||
$( this ).dialog();
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -150,9 +150,7 @@ $.mobile.fixedToolbars = (function() {
|
|||
|
||||
// 1. Before page is shown, check for duplicate footer
|
||||
// 2. After page is shown, append footer to new page
|
||||
$( ".ui-page" )
|
||||
.live( "pagebeforeshow", function( event, ui ) {
|
||||
|
||||
$( document ).delegate( ".ui-page", "pagebeforeshow", function( event, ui ) {
|
||||
var page = $( event.target ),
|
||||
footer = page.find( ":jqmData(role='footer')" ),
|
||||
id = footer.data( "id" ),
|
||||
|
|
@ -165,12 +163,10 @@ $.mobile.fixedToolbars = (function() {
|
|||
setTop( stickyFooter.removeClass( "fade in out" ).appendTo( $.mobile.pageContainer ) );
|
||||
}
|
||||
})
|
||||
.live( "pageshow", function( event, ui ) {
|
||||
|
||||
.delegate( ".ui-page", "pageshow", function( event, ui ) {
|
||||
var $this = $( this );
|
||||
|
||||
if ( stickyFooter && stickyFooter.length ) {
|
||||
|
||||
setTimeout(function() {
|
||||
setTop( stickyFooter.appendTo( $this ).addClass( "fade" ) );
|
||||
stickyFooter = null;
|
||||
|
|
@ -181,7 +177,7 @@ $.mobile.fixedToolbars = (function() {
|
|||
});
|
||||
|
||||
// When a collapsiable is hidden or shown we need to trigger the fixed toolbar to reposition itself (#1635)
|
||||
$( ".ui-collapsible-contain" ).live( "collapse expand", showEventCallback );
|
||||
$( document ).delegate( ".ui-collapsible-contain", "collapse expand", showEventCallback );
|
||||
|
||||
// element.getBoundingClientRect() is broken in iOS 3.2.1 on the iPad. The
|
||||
// coordinates inside of the rect it returns don't have the page scroll position
|
||||
|
|
|
|||
|
|
@ -481,7 +481,7 @@
|
|||
});
|
||||
};
|
||||
|
||||
$( "select" ).live( "selectmenubeforecreate", function(){
|
||||
$( document ).delegate( "select", "selectmenubeforecreate", function(){
|
||||
var selectmenuWidget = $( this ).data( "selectmenu" );
|
||||
|
||||
if( !selectmenuWidget.options.nativeMenu ){
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ $.mobile.listview.prototype.options.filterCallback = function( text, searchValue
|
|||
return text.toLowerCase().indexOf( searchValue ) === -1;
|
||||
};
|
||||
|
||||
$( ":jqmData(role='listview')" ).live( "listviewcreate", function() {
|
||||
$( document ).delegate( ":jqmData(role='listview')", "listviewcreate", function() {
|
||||
|
||||
var list = $( this ),
|
||||
listview = list.data( "listview" );
|
||||
|
|
|
|||
|
|
@ -1094,7 +1094,7 @@
|
|||
|
||||
// Kill the keyboard.
|
||||
// XXX_jblas: We need to stop crawling the entire document to kill focus. Instead,
|
||||
// we should be tracking focus with a live() handler so we already have
|
||||
// we should be tracking focus with a delegate() handler so we already have
|
||||
// the element in hand at this point.
|
||||
// Wrap this in a try/catch block since IE9 throw "Unspecified error" if document.activeElement
|
||||
// is undefined when we are in an IFrame.
|
||||
|
|
@ -1215,7 +1215,7 @@
|
|||
$.mobile._registerInternalEvents = function(){
|
||||
|
||||
//bind to form submit events, handle with Ajax
|
||||
$( "form" ).live('submit', function( event ) {
|
||||
$( document ).delegate( "form", "submit", function( event ) {
|
||||
var $this = $( this );
|
||||
if( !$.mobile.ajaxEnabled ||
|
||||
$this.is( ":jqmData(ajax='false')" ) ) {
|
||||
|
|
@ -1382,7 +1382,7 @@
|
|||
});
|
||||
|
||||
//prefetch pages when anchors with data-prefetch are encountered
|
||||
$( ".ui-page" ).live( "pageshow.prefetch", function() {
|
||||
$( document ).delegate( ".ui-page", "pageshow.prefetch", function() {
|
||||
var urls = [];
|
||||
$( this ).find( "a:jqmData(prefetch)" ).each(function(){
|
||||
var $link = $(this),
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ $.mobile.page.prototype.options.headerTheme = "a";
|
|||
$.mobile.page.prototype.options.footerTheme = "a";
|
||||
$.mobile.page.prototype.options.contentTheme = null;
|
||||
|
||||
$( ":jqmData(role='page'), :jqmData(role='dialog')" ).live( "pagecreate", function( e ) {
|
||||
$( document ).delegate( ":jqmData(role='page'), :jqmData(role='dialog')", "pagecreate", function( e ) {
|
||||
|
||||
var $page = $( this ),
|
||||
o = $page.data( "page" ).options,
|
||||
|
|
|
|||
Loading…
Reference in a new issue