Created
October 1, 2010 14:53
-
-
Save geecu/606308 to your computer and use it in GitHub Desktop.
jquery.dbg.js
This file contains hidden or 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
/** | |
* dbg jQuery plugin - http://jquery.5s.ro/ | |
* | |
* Easy debug of your jQuery objects. | |
* | |
* @author Gunther Konig <[email protected]> | |
*/ | |
(function($) | |
{ | |
$.dbg = function() | |
{ | |
if (!("console" in window)) | |
{ | |
return this; | |
} | |
if(navigator.userAgent.toLowerCase().indexOf("applewebkit") != -1) | |
{ | |
console.log('<<<'); | |
for (var i = 0, l = arguments.length; i < l; i++) | |
{ | |
console.log(arguments[i]); | |
} | |
console.log('>>>'); | |
} | |
else | |
{ | |
console.log.apply(this, arguments); | |
} | |
return this; | |
} | |
$.fn.dbg = function() | |
{ | |
var args = []; | |
//typeof arguments = object, we need an array | |
for (var i = 0; i < arguments.length; i++) | |
{ | |
args[i] = arguments[i]; | |
} | |
args[i] = this; | |
$.dbg.apply(this, args); | |
return this; | |
} | |
})(jQuery); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment