lib/jspec.js in visionmedia-jspec-2.7.2 vs lib/jspec.js in visionmedia-jspec-2.8.1

- old
+ new

@@ -3,11 +3,11 @@ (function(){ JSpec = { - version : '2.7.2', + version : '2.8.1', cache : {}, suites : [], modules : [], allSuites : [], matchers : {}, @@ -842,14 +842,16 @@ return buffer += hash(value) }) } switch (object.constructor) { case Array : return serialize('a') - case Object: return serialize('o') case RegExp: return 'r:' + object.toString() case Number: return 'n:' + object.toString() case String: return 's:' + object.toString() + case Object: return 'o:' + inject(object, [], function(array, key, value){ + array.push([key, hash(value)]) + }).sort() default: return object.toString() } }, /** @@ -1467,13 +1469,13 @@ * @return {ActiveXObject, XMLHttpRequest} * @api private */ xhr : function() { - return 'ActiveXObject' in main ? - new ActiveXObject("Microsoft.XMLHTTP"): - new XMLHttpRequest() + return 'XMLHttpRequest' in main ? + new XMLHttpRequest: + new ActiveXObject("Microsoft.XMLHTTP") }, /** * Check for HTTP request support. * @@ -1494,17 +1496,17 @@ * @api public */ load : function(file, callback) { if (any(hook('loading', file), haveStopped)) return - if (this.hasXhr()) { + if ('readFile' in main) + return callback ? readFile(file, callback) : readFile(file) + else if (this.hasXhr()) { var request = this.xhr() request.open('GET', file, false) request.send(null) if (request.readyState == 4) return request.responseText } - else if ('readFile' in main) - return callback ? readFile(file, callback) : readFile(file) else error("failed to load `" + file + "'") }, /** \ No newline at end of file