Skip to content

Commit

Permalink
Added more strict array type detection for dump output, and allowed N…
Browse files Browse the repository at this point in the history
…odeList objects to be output as arrays

This helps prevent treating any object with a length property as an
array, while maintaining the ability to render NodeList objects as
arrays. jsDump output tests still pass after this patch is applied.
  • Loading branch information
trevorparscal committed Oct 7, 2011
1 parent 2031511 commit f24167a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion qunit/qunit.js
Expand Up @@ -1268,7 +1268,9 @@ QUnit.jsDump = (function() {
type = "document";
} else if (obj.nodeType) {
type = "node";
} else if (typeof obj === "object" && typeof obj.length === "number" && obj.length >= 0) {
} else if (Object.prototype.toString.call( obj ) == "[object Array]") {
type = "array";
} else if (Object.prototype.toString.call( obj ) == "[object NodeList]") {
type = "array";
} else {
type = typeof obj;
Expand Down

0 comments on commit f24167a

Please sign in to comment.