Created
January 12, 2010 19:43
-
-
Save paulirish/275532 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// sorta like manual profiling. | |
// peek into your jquery method calls to see why they are being called so much | |
// usage: | |
// $.logCallsTo('append'); | |
// $.logCallsTo('curCSS',true); | |
// output: | |
// http://gyazo.com/40cec25d875a7a767e95fd7a2f451b32.png | |
$.logCallsTo = function(method,isOn$){ | |
var old = isOn$ ? $[method] : $.fn[method], | |
that = this; | |
(isOn$ ? $ : $.fn)[method] = function(){ | |
window.console && console.log.apply(console,[this,method,arguments]); | |
return old.apply(this,arguments); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment