Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #3008 from eddiemonge/live-delegate

Change .live() to .delegate()
  • Loading branch information...
commit 3542c9c0b1e8ed3843fc2a4f5acf37ed705e5a6b 2 parents a0ec2eb + c367c83
@gseguin gseguin authored
View
2  js/jquery.mobile.dialog.js
@@ -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();
});
View
10 js/jquery.mobile.fixHeaderFooter.js
@@ -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
View
2  js/jquery.mobile.forms.select.custom.js
@@ -483,7 +483,7 @@
});
};
- $( "select" ).live( "selectmenubeforecreate", function(){
+ $( document ).delegate( "select", "selectmenubeforecreate", function(){
var selectmenuWidget = $( this ).data( "selectmenu" );
if( !selectmenuWidget.options.nativeMenu ){
View
2  js/jquery.mobile.listview.filter.js
@@ -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" );
View
6 js/jquery.mobile.navigation.js
@@ -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.
@@ -1226,7 +1226,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')" ) ) {
@@ -1393,7 +1393,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),
View
2  js/jquery.mobile.page.sections.js
@@ -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,
Please sign in to comment.
Something went wrong with that request. Please try again.