debugConsole.html
1.42 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
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>testing debugging and logging functions</title>
<script type="text/javascript">
djConfig = {};
djConfig.isDebug = document.location.href.match(/\?ON/);
</script>
<script type="text/javascript" src="../../../dojo.js"></script>
<script type="text/javascript">
dojo.addOnLoad(function(){
var toggle = document.getElementById("toggle").innerHTML = djConfig.isDebug?"ON":"OFF";
});
var aString = "this is my test string";
var anObject = {
aProperty: "aValue",
anotherProperty: "anotherValue",
aNumber: 1234
};
var cn = ["debug","log",
"assert", "count", "dir", "dirxml", "error", "group",
"groupEnd", "info", "profile", "profileEnd", "time", "timeEnd",
"trace", "warn"
];
for(var i=0;i<cn.length;i++) {
console[cn[i]]( cn[i] + ": " + aString);
console[cn[i]]( cn[i] + ": " + anObject);
}
</script>
</head>
<body>
<p>
Testing console.* methods with djConfig.isDebug turned <span id="toggle"></span>
</p>
<p>
Append '?ON' to URL to try with djConfig.isDebug turned ON. Remove it to test djConfig.isDebug turned OFF
</p>
<p>
If isDebug is off (false), then make sure console functions go to a simple empty function. You may see
errors in the console, since console.error is being tested as part of this test.
</p>
</body>
</html>