Skip to content

Instantly share code, notes, and snippets.

@paulirish
Created January 12, 2010 19:43

Revisions

  1. paulirish revised this gist Jan 21, 2010. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion $.logCallsTo.js
    Original file line number Diff line number Diff line change
    @@ -14,7 +14,7 @@ $.logCallsTo = function(method,isOn$){

    (isOn$ ? $ : $.fn)[method] = function(){
    window.console && console.log.apply(console,[this,method,arguments]);
    old.apply(this,arguments);
    return old.apply(this,arguments);
    }

    }
  2. paulirish revised this gist Jan 12, 2010. 1 changed file with 3 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions $.logCallsTo.js
    Original file line number Diff line number Diff line change
    @@ -5,6 +5,9 @@
    // $.logCallsTo('append');
    // $.logCallsTo('curCSS',true);

    // output:
    // http://gyazo.com/40cec25d875a7a767e95fd7a2f451b32.png

    $.logCallsTo = function(method,isOn$){
    var old = isOn$ ? $[method] : $.fn[method],
    that = this;
  3. @invalid-email-address Anonymous created this gist Jan 12, 2010.
    17 changes: 17 additions & 0 deletions $.logCallsTo.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,17 @@
    // 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);

    $.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]);
    old.apply(this,arguments);
    }

    }