]> source.dussan.org Git - jquery.git/commitdiff
Rather than declaring empty anonymous functions all around, introduce and use a singl...
authorjeresig <jeresig@gmail.com>
Thu, 31 Dec 2009 14:50:49 +0000 (09:50 -0500)
committerjeresig <jeresig@gmail.com>
Thu, 31 Dec 2009 14:50:49 +0000 (09:50 -0500)
src/ajax.js
src/core.js
src/event.js
src/offset.js

index 2249dc6874f65cc2cc83573f967f0a5c00ed2773..37fb75b557e0a75e3b0c5379f4124f8060e189b2 100644 (file)
@@ -384,7 +384,7 @@ jQuery.extend({
                        // The request was aborted, clear the interval and decrement jQuery.active
                        if ( !xhr || xhr.readyState === 0 ) {
                                requestDone = true;
-                               xhr.onreadystatechange = function(){};
+                               xhr.onreadystatechange = jQuery.noop;
 
                                // Handle the global AJAX counter
                                if ( s.global && ! --jQuery.active ) {
@@ -394,7 +394,7 @@ jQuery.extend({
                        // The transfer is complete and the data is available, or the request timed out
                        } else if ( !requestDone && xhr && (xhr.readyState === 4 || isTimeout === "timeout") ) {
                                requestDone = true;
-                               xhr.onreadystatechange = function(){};
+                               xhr.onreadystatechange = jQuery.noop;
 
                                status = isTimeout === "timeout" ?
                                        "timeout" :
index 944e8a9bf7ec8c06089ea4cb8a3f7175fc022cf3..93f04ec7d7c2c91035b173a8fbb56e32078ff54c 100644 (file)
@@ -464,6 +464,8 @@ jQuery.extend({
                return true;
        },
 
+       noop: function() {},
+
        // Evalulates a script in a global context
        globalEval: function( data ) {
                if ( data && rnotwhite.test(data) ) {
index 79a6b9529d4b88173afd03196c31b9ef72d39e0a..0345b0c1e9c67bb4da4fb9247245396dee5ef38e 100644 (file)
@@ -427,7 +427,7 @@ jQuery.event = {
                ready: {
                        // Make sure the ready event is setup
                        setup: jQuery.bindReady,
-                       teardown: function() {}
+                       teardown: jQuery.noop
                },
 
                live: {
index 7ae9cb909f85d4e3b3157e0320cf061ae2654849..d12921dffc7baca43773d411889ed23fcc53aa96 100644 (file)
@@ -121,7 +121,7 @@ jQuery.offset = {
 
                body.removeChild( container );
                body = container = innerDiv = checkDiv = table = td = null;
-               jQuery.offset.initialize = function() {};
+               jQuery.offset.initialize = jQuery.noop;
        },
 
        bodyOffset: function( body ) {