Skip to content

Commit c367c83

Browse files
committed
Change .live() to .delegate()
1 parent 3fdb126 commit c367c83

6 files changed

+10
-14
lines changed

js/jquery.mobile.dialog.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ $.widget( "mobile.dialog", $.mobile.widget, {
6666
});
6767

6868
//auto self-init widgets
69-
$( $.mobile.dialog.prototype.options.initSelector ).live( "pagecreate", function(){
69+
$( document ).delegate( $.mobile.dialog.prototype.options.initSelector, "pagecreate", function(){
7070
$( this ).dialog();
7171
});
7272

js/jquery.mobile.fixHeaderFooter.js

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -150,9 +150,7 @@ $.mobile.fixedToolbars = (function() {
150150

151151
// 1. Before page is shown, check for duplicate footer
152152
// 2. After page is shown, append footer to new page
153-
$( ".ui-page" )
154-
.live( "pagebeforeshow", function( event, ui ) {
155-
153+
$( document ).delegate( ".ui-page", "pagebeforeshow", function( event, ui ) {
156154
var page = $( event.target ),
157155
footer = page.find( ":jqmData(role='footer')" ),
158156
id = footer.data( "id" ),
@@ -165,12 +163,10 @@ $.mobile.fixedToolbars = (function() {
165163
setTop( stickyFooter.removeClass( "fade in out" ).appendTo( $.mobile.pageContainer ) );
166164
}
167165
})
168-
.live( "pageshow", function( event, ui ) {
169-
166+
.delegate( ".ui-page", "pageshow", function( event, ui ) {
170167
var $this = $( this );
171168

172169
if ( stickyFooter && stickyFooter.length ) {
173-
174170
setTimeout(function() {
175171
setTop( stickyFooter.appendTo( $this ).addClass( "fade" ) );
176172
stickyFooter = null;
@@ -181,7 +177,7 @@ $.mobile.fixedToolbars = (function() {
181177
});
182178

183179
// When a collapsiable is hidden or shown we need to trigger the fixed toolbar to reposition itself (#1635)
184-
$( ".ui-collapsible-contain" ).live( "collapse expand", showEventCallback );
180+
$( document ).delegate( ".ui-collapsible-contain", "collapse expand", showEventCallback );
185181

186182
// element.getBoundingClientRect() is broken in iOS 3.2.1 on the iPad. The
187183
// coordinates inside of the rect it returns don't have the page scroll position

js/jquery.mobile.forms.select.custom.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,7 @@
481481
});
482482
};
483483

484-
$( "select" ).live( "selectmenubeforecreate", function(){
484+
$( document ).delegate( "select", "selectmenubeforecreate", function(){
485485
var selectmenuWidget = $( this ).data( "selectmenu" );
486486

487487
if( !selectmenuWidget.options.nativeMenu ){

js/jquery.mobile.listview.filter.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ $.mobile.listview.prototype.options.filterCallback = function( text, searchValue
1111
return text.toLowerCase().indexOf( searchValue ) === -1;
1212
};
1313

14-
$( ":jqmData(role='listview')" ).live( "listviewcreate", function() {
14+
$( document ).delegate( ":jqmData(role='listview')", "listviewcreate", function() {
1515

1616
var list = $( this ),
1717
listview = list.data( "listview" );

js/jquery.mobile.navigation.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1094,7 +1094,7 @@
10941094

10951095
// Kill the keyboard.
10961096
// XXX_jblas: We need to stop crawling the entire document to kill focus. Instead,
1097-
// we should be tracking focus with a live() handler so we already have
1097+
// we should be tracking focus with a delegate() handler so we already have
10981098
// the element in hand at this point.
10991099
// Wrap this in a try/catch block since IE9 throw "Unspecified error" if document.activeElement
11001100
// is undefined when we are in an IFrame.
@@ -1215,7 +1215,7 @@
12151215
$.mobile._registerInternalEvents = function(){
12161216

12171217
//bind to form submit events, handle with Ajax
1218-
$( "form" ).live('submit', function( event ) {
1218+
$( document ).delegate( "form", "submit", function( event ) {
12191219
var $this = $( this );
12201220
if( !$.mobile.ajaxEnabled ||
12211221
$this.is( ":jqmData(ajax='false')" ) ) {
@@ -1382,7 +1382,7 @@
13821382
});
13831383

13841384
//prefetch pages when anchors with data-prefetch are encountered
1385-
$( ".ui-page" ).live( "pageshow.prefetch", function() {
1385+
$( document ).delegate( ".ui-page", "pageshow.prefetch", function() {
13861386
var urls = [];
13871387
$( this ).find( "a:jqmData(prefetch)" ).each(function(){
13881388
var $link = $(this),

js/jquery.mobile.page.sections.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ $.mobile.page.prototype.options.headerTheme = "a";
1111
$.mobile.page.prototype.options.footerTheme = "a";
1212
$.mobile.page.prototype.options.contentTheme = null;
1313

14-
$( ":jqmData(role='page'), :jqmData(role='dialog')" ).live( "pagecreate", function( e ) {
14+
$( document ).delegate( ":jqmData(role='page'), :jqmData(role='dialog')", "pagecreate", function( e ) {
1515

1616
var $page = $( this ),
1717
o = $page.data( "page" ).options,

0 commit comments

Comments
 (0)