Navigation Menu

Skip to content

Commit

Permalink
Added additional guards around browser specific code and cleaned up j…
Browse files Browse the repository at this point in the history
…sDump code
  • Loading branch information
benjaminplee committed Nov 27, 2010
1 parent d5581ab commit 41a759d
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions qunit/qunit.js
Expand Up @@ -11,7 +11,7 @@
(function(window) { (function(window) {


var defined = { var defined = {
setTimeout: (typeof window.setTimeout !== "undefined") setTimeout: typeof window.setTimeout !== "undefined"
} }


var QUnit = { var QUnit = {
Expand Down Expand Up @@ -1026,7 +1026,7 @@ QUnit.jsDump = (function() {
type = "date"; type = "date";
} else if (QUnit.is("Function", obj)) { } else if (QUnit.is("Function", obj)) {
type = "function"; type = "function";
} else if (obj.setInterval && obj.document && !obj.nodeType) { } else if (typeof obj.setInterval !== undefined && typeof obj.document !== "undefined" && typeof obj.nodeType === "undefined") {
type = "window"; type = "window";
} else if (obj.nodeType === 9) { } else if (obj.nodeType === 9) {
type = "document"; type = "document";
Expand Down Expand Up @@ -1080,31 +1080,31 @@ QUnit.jsDump = (function() {
ret += ' ' + name; ret += ' ' + name;
ret += '('; ret += '(';


ret = [ ret, this.parse( fn, 'functionArgs' ), '){'].join(''); ret = [ ret, QUnit.jsDump.parse( fn, 'functionArgs' ), '){'].join('');
return join( ret, this.parse(fn,'functionCode'), '}' ); return join( ret, QUnit.jsDump.parse(fn,'functionCode'), '}' );
}, },
array: array, array: array,
nodelist: array, nodelist: array,
arguments: array, arguments: array,
object:function( map ) { object:function( map ) {
var ret = [ ]; var ret = [ ];
this.up(); QUnit.jsDump.up();
for ( var key in map ) for ( var key in map )
ret.push( this.parse(key,'key') + ': ' + this.parse(map[key]) ); ret.push( QUnit.jsDump.parse(key,'key') + ': ' + QUnit.jsDump.parse(map[key]) );
this.down(); QUnit.jsDump.down();
return join( '{', ret, '}' ); return join( '{', ret, '}' );
}, },
node:function( node ) { node:function( node ) {
var open = this.HTML ? '&lt;' : '<', var open = QUnit.jsDump.HTML ? '&lt;' : '<',
close = this.HTML ? '&gt;' : '>'; close = QUnit.jsDump.HTML ? '&gt;' : '>';


var tag = node.nodeName.toLowerCase(), var tag = node.nodeName.toLowerCase(),
ret = open + tag; ret = open + tag;


for ( var a in this.DOMAttrs ) { for ( var a in QUnit.jsDump.DOMAttrs ) {
var val = node[this.DOMAttrs[a]]; var val = node[QUnit.jsDump.DOMAttrs[a]];
if ( val ) if ( val )
ret += ' ' + a + '=' + this.parse( val, 'attribute' ); ret += ' ' + a + '=' + QUnit.jsDump.parse( val, 'attribute' );
} }
return ret + close + open + '/' + tag + close; return ret + close + open + '/' + tag + close;
}, },
Expand Down

0 comments on commit 41a759d

Please sign in to comment.