forked from thatcher/env-js
-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathdebug.js
More file actions
53 lines (44 loc) · 1.31 KB
/
Copy pathdebug.js
File metadata and controls
53 lines (44 loc) · 1.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
// Init
load("src/env.js");
load("src/htmlparser.js");
window.location = "test/index.html";
window.onload = function(){
load("test/testrunner.js");
load("test/jquery.js");
var depth = 0;
function indent(){
var str = "";
for ( var i = 0; i < depth; i++ ) {
str += " ";
}
return str;
}
function dump(name, args, ret){
print(name + ": " + Array.prototype.slice.call(args) + " - Return: " + ret);
}
for ( var method in jQuery.fn ) (function(method){ if ( method != "init" ) {
var old = jQuery.fn[method];
jQuery.fn[method] = function(){
print(indent() + method + ": " + Array.prototype.slice.call(arguments));
depth++;
var ret = old.apply(this, arguments);
depth--;
print(indent() + method + ": Return " + ret);
return ret;
};
} })(method);
for ( var method in jQuery ) (function(method){ if ( method != "prototype" && method != "fn" ) {
var old = jQuery[method];
jQuery[method] = function(){
print(indent() + "$." + method + ": " + Array.prototype.slice.call(arguments));
depth++;
var ret = old.apply(this, arguments);
depth--;
print(indent() + "$." + method + ": Return " + ret);
return ret;
};
} })(method);
jQuery.prototype.toString = DOMNodeList.prototype.toString;
Function.prototype.toString = function(){ return "function()"; };
print("Ready.");
};