vendor/assets/javascripts/chai.js in konacha-3.5.0 vs vendor/assets/javascripts/chai.js in konacha-3.5.1

- old
+ new

@@ -1,208 +1,146 @@ + ;(function(){ /** - * Require the given path. + * Require the module at `name`. * - * @param {String} path + * @param {String} name * @return {Object} exports * @api public */ -function require(path, parent, orig) { - var resolved = require.resolve(path); +function require(name) { + var module = require.modules[name]; + if (!module) throw new Error('failed to require "' + name + '"'); - // lookup failed - if (null == resolved) { - orig = orig || path; - parent = parent || 'root'; - var err = new Error('Failed to require "' + orig + '" from "' + parent + '"'); - err.path = orig; - err.parent = parent; - err.require = true; - throw err; + if (!('exports' in module) && typeof module.definition === 'function') { + module.client = module.component = true; + module.definition.call(this, module.exports = {}, module); + delete module.definition; } - var module = require.modules[resolved]; - - // perform real require() - // by invoking the module's - // registered function - if (!module._resolving && !module.exports) { - var mod = {}; - mod.exports = {}; - mod.client = mod.component = true; - module._resolving = true; - module.call(this, mod.exports, require.relative(resolved), mod); - delete module._resolving; - module.exports = mod.exports; - } - return module.exports; } /** - * Registered modules. + * Meta info, accessible in the global scope unless you use AMD option. */ -require.modules = {}; +require.loader = 'component'; /** - * Registered aliases. + * Internal helper object, contains a sorting function for semantiv versioning */ - -require.aliases = {}; - -/** - * Resolve `path`. - * - * Lookup: - * - * - PATH/index.js - * - PATH.js - * - PATH - * - * @param {String} path - * @return {String} path or null - * @api private - */ - -require.resolve = function(path) { - if (path.charAt(0) === '/') path = path.slice(1); - - var paths = [ - path, - path + '.js', - path + '.json', - path + '/index.js', - path + '/index.json' - ]; - - for (var i = 0; i < paths.length; i++) { - var path = paths[i]; - if (require.modules.hasOwnProperty(path)) return path; - if (require.aliases.hasOwnProperty(path)) return require.aliases[path]; +require.helper = {}; +require.helper.semVerSort = function(a, b) { + var aArray = a.version.split('.'); + var bArray = b.version.split('.'); + for (var i=0; i<aArray.length; ++i) { + var aInt = parseInt(aArray[i], 10); + var bInt = parseInt(bArray[i], 10); + if (aInt === bInt) { + var aLex = aArray[i].substr((""+aInt).length); + var bLex = bArray[i].substr((""+bInt).length); + if (aLex === '' && bLex !== '') return 1; + if (aLex !== '' && bLex === '') return -1; + if (aLex !== '' && bLex !== '') return aLex > bLex ? 1 : -1; + continue; + } else if (aInt > bInt) { + return 1; + } else { + return -1; + } } -}; + return 0; +} /** - * Normalize `path` relative to the current path. - * - * @param {String} curr - * @param {String} path - * @return {String} - * @api private - */ + * Find and require a module which name starts with the provided name. + * If multiple modules exists, the highest semver is used. + * This function can only be used for remote dependencies. -require.normalize = function(curr, path) { - var segs = []; - - if ('.' != path.charAt(0)) return path; - - curr = curr.split('/'); - path = path.split('/'); - - for (var i = 0; i < path.length; ++i) { - if ('..' == path[i]) { - curr.pop(); - } else if ('.' != path[i] && '' != path[i]) { - segs.push(path[i]); + * @param {String} name - module name: `user~repo` + * @param {Boolean} returnPath - returns the canonical require path if true, + * otherwise it returns the epxorted module + */ +require.latest = function (name, returnPath) { + function showError(name) { + throw new Error('failed to find latest module of "' + name + '"'); + } + // only remotes with semvers, ignore local files conataining a '/' + var versionRegexp = /(.*)~(.*)@v?(\d+\.\d+\.\d+[^\/]*)$/; + var remoteRegexp = /(.*)~(.*)/; + if (!remoteRegexp.test(name)) showError(name); + var moduleNames = Object.keys(require.modules); + var semVerCandidates = []; + var otherCandidates = []; // for instance: name of the git branch + for (var i=0; i<moduleNames.length; i++) { + var moduleName = moduleNames[i]; + if (new RegExp(name + '@').test(moduleName)) { + var version = moduleName.substr(name.length+1); + var semVerMatch = versionRegexp.exec(moduleName); + if (semVerMatch != null) { + semVerCandidates.push({version: version, name: moduleName}); + } else { + otherCandidates.push({version: version, name: moduleName}); + } } } + if (semVerCandidates.concat(otherCandidates).length === 0) { + showError(name); + } + if (semVerCandidates.length > 0) { + var module = semVerCandidates.sort(require.helper.semVerSort).pop().name; + if (returnPath === true) { + return module; + } + return require(module); + } + // if the build contains more than one branch of the same module + // you should not use this funciton + var module = otherCandidates.sort(function(a, b) {return a.name > b.name})[0].name; + if (returnPath === true) { + return module; + } + return require(module); +} - return curr.concat(segs).join('/'); -}; - /** - * Register module at `path` with callback `definition`. - * - * @param {String} path - * @param {Function} definition - * @api private + * Registered modules. */ -require.register = function(path, definition) { - require.modules[path] = definition; -}; +require.modules = {}; /** - * Alias a module definition. + * Register module at `name` with callback `definition`. * - * @param {String} from - * @param {String} to + * @param {String} name + * @param {Function} definition * @api private */ -require.alias = function(from, to) { - if (!require.modules.hasOwnProperty(from)) { - throw new Error('Failed to alias "' + from + '", it does not exist'); - } - require.aliases[to] = from; +require.register = function (name, definition) { + require.modules[name] = { + definition: definition + }; }; /** - * Return a require function relative to the `parent` path. + * Define a module's exports immediately with `exports`. * - * @param {String} parent - * @return {Function} + * @param {String} name + * @param {Generic} exports * @api private */ -require.relative = function(parent) { - var p = require.normalize(parent, '..'); - - /** - * lastIndexOf helper. - */ - - function lastIndexOf(arr, obj) { - var i = arr.length; - while (i--) { - if (arr[i] === obj) return i; - } - return -1; - } - - /** - * The relative require() itself. - */ - - function localRequire(path) { - var resolved = localRequire.resolve(path); - return require(resolved, parent, path); - } - - /** - * Resolve relative to the parent. - */ - - localRequire.resolve = function(path) { - var c = path.charAt(0); - if ('/' == c) return path.slice(1); - if ('.' == c) return require.normalize(p, path); - - // resolve deps by returning - // the dep in the nearest "deps" - // directory - var segs = parent.split('/'); - var i = lastIndexOf(segs, 'deps') + 1; - if (!i) i = 0; - path = segs.slice(0, i + 1).join('/') + '/deps/' + path; - return path; +require.define = function (name, exports) { + require.modules[name] = { + exports: exports }; - - /** - * Check if module is defined at `path`. - */ - - localRequire.exists = function(path) { - return require.modules.hasOwnProperty(localRequire.resolve(path)); - }; - - return localRequire; }; -require.register("chaijs-assertion-error/index.js", function(exports, require, module){ +require.register("chaijs~assertion-error@1.0.0", function (exports, module) { /*! * assertion-error * Copyright(c) 2013 Jake Luer <jake@qualiancy.com> * MIT Licensed */ @@ -311,11 +249,12 @@ return props; }; }); -require.register("chaijs-type-detect/lib/type.js", function(exports, require, module){ + +require.register("chaijs~type-detect@0.1.1", function (exports, module) { /*! * type-detect * Copyright(c) 2013 jake luer <jake@alogicalparadox.com> * MIT Licensed */ @@ -456,22 +395,23 @@ throw new ReferenceError('Type test "' + type + '" not defined or invalid.'); } }; }); -require.register("chaijs-deep-eql/lib/eql.js", function(exports, require, module){ + +require.register("chaijs~deep-eql@0.1.3", function (exports, module) { /*! * deep-eql * Copyright(c) 2013 Jake Luer <jake@alogicalparadox.com> * MIT Licensed */ /*! * Module dependencies */ -var type = require('type-detect'); +var type = require('chaijs~type-detect@0.1.1'); /*! * Buffer.isBuffer browser shim */ @@ -716,15 +656,17 @@ return true; } }); -require.register("chai/index.js", function(exports, require, module){ -module.exports = require('./lib/chai'); +require.register("chai", function (exports, module) { +module.exports = require('chai/lib/chai.js'); + }); -require.register("chai/lib/chai.js", function(exports, require, module){ + +require.register("chai/lib/chai.js", function (exports, module) { /*! * chai * Copyright(c) 2011-2014 Jake Luer <jake@alogicalparadox.com> * MIT Licensed */ @@ -734,23 +676,23 @@ /*! * Chai version */ -exports.version = '1.9.1'; +exports.version = '1.9.2'; /*! * Assertion Error */ -exports.AssertionError = require('assertion-error'); +exports.AssertionError = require('chaijs~assertion-error@1.0.0'); /*! * Utils for plugins (not exported) */ -var util = require('./chai/utils'); +var util = require('chai/lib/chai/utils/index.js'); /** * # .use(function) * * Provides a way to extend the internals of Chai @@ -771,58 +713,59 @@ /*! * Configuration */ -var config = require('./chai/config'); +var config = require('chai/lib/chai/config.js'); exports.config = config; /*! * Primary `Assertion` prototype */ -var assertion = require('./chai/assertion'); +var assertion = require('chai/lib/chai/assertion.js'); exports.use(assertion); /*! * Core Assertions */ -var core = require('./chai/core/assertions'); +var core = require('chai/lib/chai/core/assertions.js'); exports.use(core); /*! * Expect interface */ -var expect = require('./chai/interface/expect'); +var expect = require('chai/lib/chai/interface/expect.js'); exports.use(expect); /*! * Should interface */ -var should = require('./chai/interface/should'); +var should = require('chai/lib/chai/interface/should.js'); exports.use(should); /*! * Assert interface */ -var assert = require('./chai/interface/assert'); +var assert = require('chai/lib/chai/interface/assert.js'); exports.use(assert); }); -require.register("chai/lib/chai/assertion.js", function(exports, require, module){ + +require.register("chai/lib/chai/assertion.js", function (exports, module) { /*! * chai * http://chaijs.com * Copyright(c) 2011-2014 Jake Luer <jake@alogicalparadox.com> * MIT Licensed */ -var config = require('./config'); +var config = require('chai/lib/chai/config.js'); module.exports = function (_chai, util) { /*! * Module dependencies. */ @@ -901,12 +844,12 @@ * * Executes an expression and check expectations. Throws AssertionError for reporting if test doesn't pass. * * @name assert * @param {Philosophical} expression to be tested - * @param {String} message to display if fails - * @param {String} negatedMessage to display if negated expression fails + * @param {String or Function} message or function that returns message to display if fails + * @param {String or Function} negatedMessage or function that returns negatedMessage to display if negated expression fails * @param {Mixed} expected value (remember to check for negation) * @param {Mixed} actual (optional) will default to `this.obj` * @api private */ @@ -943,11 +886,12 @@ } }); }; }); -require.register("chai/lib/chai/config.js", function(exports, require, module){ + +require.register("chai/lib/chai/config.js", function (exports, module) { module.exports = { /** * ### config.includeStack * @@ -996,11 +940,12 @@ truncateThreshold: 40 }; }); -require.register("chai/lib/chai/core/assertions.js", function(exports, require, module){ + +require.register("chai/lib/chai/core/assertions.js", function (exports, module) { /*! * chai * http://chaijs.com * Copyright(c) 2011-2014 Jake Luer <jake@alogicalparadox.com> * MIT Licensed @@ -1870,11 +1815,11 @@ , len ); } Assertion.addChainableMethod('length', assertLength, assertLengthChain); - Assertion.addMethod('lengthOf', assertLength, assertLengthChain); + Assertion.addMethod('lengthOf', assertLength); /** * ### .match(regexp) * * Asserts that the target matches a regular expression. @@ -1949,10 +1894,11 @@ : Array.prototype.slice.call(arguments); if (!keys.length) throw new Error('keys required'); var actual = Object.keys(obj) + , expected = keys , len = keys.length; // Inclusion ok = keys.every(function(key){ return ~actual.indexOf(key); @@ -1983,10 +1929,13 @@ // Assertion this.assert( ok , 'expected #{this} to ' + str , 'expected #{this} to not ' + str + , expected.sort() + , actual.sort() + , true ); } Assertion.addMethod('keys', assertKeys); Assertion.addMethod('key', assertKeys); @@ -2218,16 +2167,17 @@ */ Assertion.addMethod('satisfy', function (matcher, msg) { if (msg) flag(this, 'message', msg); var obj = flag(this, 'object'); + var result = matcher(obj); this.assert( - matcher(obj) + result , 'expected #{this} to satisfy ' + _.objDisplay(matcher) , 'expected #{this} to not satisfy' + _.objDisplay(matcher) , this.negate ? false : true - , matcher(obj) + , result ); }); /** * ### .closeTo(expected, delta) @@ -2244,10 +2194,16 @@ */ Assertion.addMethod('closeTo', function (expected, delta, msg) { if (msg) flag(this, 'message', msg); var obj = flag(this, 'object'); + + new Assertion(obj, msg).is.a('number'); + if (_.type(expected) !== 'number' || _.type(delta) !== 'number') { + throw new Error('the arguments to closeTo must be numbers'); + } + this.assert( Math.abs(obj - expected) <= delta , 'expected #{this} to be close to ' + expected + ' +/- ' + delta , 'expected #{this} not to be close to ' + expected + ' +/- ' + delta ); @@ -2313,11 +2269,12 @@ ); }); }; }); -require.register("chai/lib/chai/interface/assert.js", function(exports, require, module){ + +require.register("chai/lib/chai/interface/assert.js", function (exports, module) { /*! * chai * Copyright(c) 2011-2014 Jake Luer <jake@alogicalparadox.com> * MIT Licensed */ @@ -3322,12 +3279,12 @@ * Order is not taken into account. * * assert.sameMembers([ 1, 2, 3 ], [ 2, 1, 3 ], 'same members'); * * @name sameMembers - * @param {Array} superset - * @param {Array} subset + * @param {Array} set1 + * @param {Array} set2 * @param {String} message * @api public */ assert.sameMembers = function (set1, set2, msg) { @@ -3372,11 +3329,12 @@ ('Throw', 'throw') ('Throw', 'throws'); }; }); -require.register("chai/lib/chai/interface/expect.js", function(exports, require, module){ + +require.register("chai/lib/chai/interface/expect.js", function (exports, module) { /*! * chai * Copyright(c) 2011-2014 Jake Luer <jake@alogicalparadox.com> * MIT Licensed */ @@ -3387,11 +3345,12 @@ }; }; }); -require.register("chai/lib/chai/interface/should.js", function(exports, require, module){ + +require.register("chai/lib/chai/interface/should.js", function (exports, module) { /*! * chai * Copyright(c) 2011-2014 Jake Luer <jake@alogicalparadox.com> * MIT Licensed */ @@ -3468,24 +3427,25 @@ chai.should = loadShould; chai.Should = loadShould; }; }); -require.register("chai/lib/chai/utils/addChainableMethod.js", function(exports, require, module){ + +require.register("chai/lib/chai/utils/addChainableMethod.js", function (exports, module) { /*! * Chai - addChainingMethod utility * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com> * MIT Licensed */ /*! * Module dependencies */ -var transferFlags = require('./transferFlags'); -var flag = require('./flag'); -var config = require('../config'); +var transferFlags = require('chai/lib/chai/utils/transferFlags.js'); +var flag = require('chai/lib/chai/utils/flag.js'); +var config = require('chai/lib/chai/config.js'); /*! * Module variables */ @@ -3582,18 +3542,19 @@ , configurable: true }); }; }); -require.register("chai/lib/chai/utils/addMethod.js", function(exports, require, module){ + +require.register("chai/lib/chai/utils/addMethod.js", function (exports, module) { /*! * Chai - addMethod utility * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com> * MIT Licensed */ -var config = require('../config'); +var config = require('chai/lib/chai/config.js'); /** * ### .addMethod (ctx, name, method) * * Adds a method to the prototype of an object. @@ -3615,11 +3576,11 @@ * @param {String} name of method to add * @param {Function} method function to be used for name * @name addMethod * @api public */ -var flag = require('./flag'); +var flag = require('chai/lib/chai/utils/flag.js'); module.exports = function (ctx, name, method) { ctx[name] = function () { var old_ssfi = flag(this, 'ssfi'); if (old_ssfi && config.includeStack === false) @@ -3628,11 +3589,12 @@ return result === undefined ? this : result; }; }; }); -require.register("chai/lib/chai/utils/addProperty.js", function(exports, require, module){ + +require.register("chai/lib/chai/utils/addProperty.js", function (exports, module) { /*! * Chai - addProperty utility * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com> * MIT Licensed */ @@ -3671,11 +3633,12 @@ , configurable: true }); }; }); -require.register("chai/lib/chai/utils/flag.js", function(exports, require, module){ + +require.register("chai/lib/chai/utils/flag.js", function (exports, module) { /*! * Chai - flag utility * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com> * MIT Licensed */ @@ -3706,11 +3669,12 @@ return flags[key]; } }; }); -require.register("chai/lib/chai/utils/getActual.js", function(exports, require, module){ + +require.register("chai/lib/chai/utils/getActual.js", function (exports, module) { /*! * Chai - getActual utility * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com> * MIT Licensed */ @@ -3727,11 +3691,12 @@ module.exports = function (obj, args) { return args.length > 4 ? args[4] : obj._obj; }; }); -require.register("chai/lib/chai/utils/getEnumerableProperties.js", function(exports, require, module){ + +require.register("chai/lib/chai/utils/getEnumerableProperties.js", function (exports, module) { /*! * Chai - getEnumerableProperties utility * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com> * MIT Licensed */ @@ -3755,25 +3720,26 @@ } return result; }; }); -require.register("chai/lib/chai/utils/getMessage.js", function(exports, require, module){ + +require.register("chai/lib/chai/utils/getMessage.js", function (exports, module) { /*! * Chai - message composition utility * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com> * MIT Licensed */ /*! * Module dependancies */ -var flag = require('./flag') - , getActual = require('./getActual') - , inspect = require('./inspect') - , objDisplay = require('./objDisplay'); +var flag = require('chai/lib/chai/utils/flag.js') + , getActual = require('chai/lib/chai/utils/getActual.js') + , inspect = require('chai/lib/chai/utils/inspect.js') + , objDisplay = require('chai/lib/chai/utils/objDisplay.js'); /** * ### .getMessage(object, message, negateMessage) * * Construct the error message based on flags @@ -3797,21 +3763,23 @@ , expected = args[3] , actual = getActual(obj, args) , msg = negate ? args[2] : args[1] , flagMsg = flag(obj, 'message'); + if(typeof msg === "function") msg = msg(); msg = msg || ''; msg = msg .replace(/#{this}/g, objDisplay(val)) .replace(/#{act}/g, objDisplay(actual)) .replace(/#{exp}/g, objDisplay(expected)); return flagMsg ? flagMsg + ': ' + msg : msg; }; }); -require.register("chai/lib/chai/utils/getName.js", function(exports, require, module){ + +require.register("chai/lib/chai/utils/getName.js", function (exports, module) { /*! * Chai - getName utility * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com> * MIT Licensed */ @@ -3830,11 +3798,12 @@ var match = /^\s?function ([^(]*)\(/.exec(func); return match && match[1] ? match[1] : ""; }; }); -require.register("chai/lib/chai/utils/getPathValue.js", function(exports, require, module){ + +require.register("chai/lib/chai/utils/getPathValue.js", function (exports, module) { /*! * Chai - getPathValue utility * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com> * @see https://github.com/logicalparadox/filtr * MIT Licensed @@ -3935,11 +3904,12 @@ } return res; }; }); -require.register("chai/lib/chai/utils/getProperties.js", function(exports, require, module){ + +require.register("chai/lib/chai/utils/getProperties.js", function (exports, module) { /*! * Chai - getProperties utility * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com> * MIT Licensed */ @@ -3973,11 +3943,12 @@ return result; }; }); -require.register("chai/lib/chai/utils/index.js", function(exports, require, module){ + +require.register("chai/lib/chai/utils/index.js", function (exports, module) { /*! * chai * Copyright(c) 2011 Jake Luer <jake@alogicalparadox.com> * MIT Licensed */ @@ -3990,117 +3961,118 @@ /*! * test utility */ -exports.test = require('./test'); +exports.test = require('chai/lib/chai/utils/test.js'); /*! * type utility */ -exports.type = require('./type'); +exports.type = require('chai/lib/chai/utils/type.js'); /*! * message utility */ -exports.getMessage = require('./getMessage'); +exports.getMessage = require('chai/lib/chai/utils/getMessage.js'); /*! * actual utility */ -exports.getActual = require('./getActual'); +exports.getActual = require('chai/lib/chai/utils/getActual.js'); /*! * Inspect util */ -exports.inspect = require('./inspect'); +exports.inspect = require('chai/lib/chai/utils/inspect.js'); /*! * Object Display util */ -exports.objDisplay = require('./objDisplay'); +exports.objDisplay = require('chai/lib/chai/utils/objDisplay.js'); /*! * Flag utility */ -exports.flag = require('./flag'); +exports.flag = require('chai/lib/chai/utils/flag.js'); /*! * Flag transferring utility */ -exports.transferFlags = require('./transferFlags'); +exports.transferFlags = require('chai/lib/chai/utils/transferFlags.js'); /*! * Deep equal utility */ -exports.eql = require('deep-eql'); +exports.eql = require('chaijs~deep-eql@0.1.3'); /*! * Deep path value */ -exports.getPathValue = require('./getPathValue'); +exports.getPathValue = require('chai/lib/chai/utils/getPathValue.js'); /*! * Function name */ -exports.getName = require('./getName'); +exports.getName = require('chai/lib/chai/utils/getName.js'); /*! * add Property */ -exports.addProperty = require('./addProperty'); +exports.addProperty = require('chai/lib/chai/utils/addProperty.js'); /*! * add Method */ -exports.addMethod = require('./addMethod'); +exports.addMethod = require('chai/lib/chai/utils/addMethod.js'); /*! * overwrite Property */ -exports.overwriteProperty = require('./overwriteProperty'); +exports.overwriteProperty = require('chai/lib/chai/utils/overwriteProperty.js'); /*! * overwrite Method */ -exports.overwriteMethod = require('./overwriteMethod'); +exports.overwriteMethod = require('chai/lib/chai/utils/overwriteMethod.js'); /*! * Add a chainable method */ -exports.addChainableMethod = require('./addChainableMethod'); +exports.addChainableMethod = require('chai/lib/chai/utils/addChainableMethod.js'); /*! * Overwrite chainable method */ -exports.overwriteChainableMethod = require('./overwriteChainableMethod'); +exports.overwriteChainableMethod = require('chai/lib/chai/utils/overwriteChainableMethod.js'); }); -require.register("chai/lib/chai/utils/inspect.js", function(exports, require, module){ + +require.register("chai/lib/chai/utils/inspect.js", function (exports, module) { // This is (almost) directly from Node.js utils // https://github.com/joyent/node/blob/f8c335d0caf47f16d31413f89aa28eda3878e3aa/lib/util.js -var getName = require('./getName'); -var getProperties = require('./getProperties'); -var getEnumerableProperties = require('./getEnumerableProperties'); +var getName = require('chai/lib/chai/utils/getName.js'); +var getProperties = require('chai/lib/chai/utils/getProperties.js'); +var getEnumerableProperties = require('chai/lib/chai/utils/getEnumerableProperties.js'); module.exports = inspect; /** * Echos the value of a value. Trys to print the value out @@ -4120,28 +4092,10 @@ stylize: function (str) { return str; } }; return formatValue(ctx, obj, (typeof depth === 'undefined' ? 2 : depth)); } -// https://gist.github.com/1044128/ -var getOuterHTML = function(element) { - if ('outerHTML' in element) return element.outerHTML; - var ns = "http://www.w3.org/1999/xhtml"; - var container = document.createElementNS(ns, '_'); - var elemProto = (window.HTMLElement || window.Element).prototype; - var xmlSerializer = new XMLSerializer(); - var html; - if (document.xmlVersion) { - return xmlSerializer.serializeToString(element); - } else { - container.appendChild(element.cloneNode(false)); - html = container.innerHTML.replace('><', '>' + element.innerHTML + '<'); - container.innerHTML = ''; - return html; - } -}; - // Returns true if object is a DOM element. var isDOMElement = function (object) { if (typeof HTMLElement === 'object') { return object instanceof HTMLElement; } else { @@ -4171,13 +4125,41 @@ var primitive = formatPrimitive(ctx, value); if (primitive) { return primitive; } - // If it's DOM elem, get outer HTML. + // If this is a DOM element, try to get the outer HTML. if (isDOMElement(value)) { - return getOuterHTML(value); + if ('outerHTML' in value) { + return value.outerHTML; + // This value does not have an outerHTML attribute, + // it could still be an XML element + } else { + // Attempt to serialize it + try { + if (document.xmlVersion) { + var xmlSerializer = new XMLSerializer(); + return xmlSerializer.serializeToString(value); + } else { + // Firefox 11- do not support outerHTML + // It does, however, support innerHTML + // Use the following to render the element + var ns = "http://www.w3.org/1999/xhtml"; + var container = document.createElementNS(ns, '_'); + + container.appendChild(value.cloneNode(false)); + html = container.innerHTML + .replace('><', '>' + value.innerHTML + '<'); + container.innerHTML = ''; + return html; + } + } catch (err) { + // This could be a non-native DOM implementation, + // continue with the normal flow: + // printing the element as if it is an object. + } + } } // Look up the keys of the object. var visibleKeys = getEnumerableProperties(value); var keys = ctx.showHidden ? getProperties(value) : visibleKeys; @@ -4413,23 +4395,24 @@ function objectToString(o) { return Object.prototype.toString.call(o); } }); -require.register("chai/lib/chai/utils/objDisplay.js", function(exports, require, module){ + +require.register("chai/lib/chai/utils/objDisplay.js", function (exports, module) { /*! * Chai - flag utility * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com> * MIT Licensed */ /*! * Module dependancies */ -var inspect = require('./inspect'); -var config = require('../config'); +var inspect = require('chai/lib/chai/utils/inspect.js'); +var config = require('chai/lib/chai/config.js'); /** * ### .objDisplay (object) * * Determines if an object or an array matches @@ -4465,11 +4448,12 @@ return str; } }; }); -require.register("chai/lib/chai/utils/overwriteMethod.js", function(exports, require, module){ + +require.register("chai/lib/chai/utils/overwriteMethod.js", function (exports, module) { /*! * Chai - overwriteMethod utility * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com> * MIT Licensed */ @@ -4519,11 +4503,12 @@ return result === undefined ? this : result; } }; }); -require.register("chai/lib/chai/utils/overwriteProperty.js", function(exports, require, module){ + +require.register("chai/lib/chai/utils/overwriteProperty.js", function (exports, module) { /*! * Chai - overwriteProperty utility * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com> * MIT Licensed */ @@ -4576,11 +4561,12 @@ , configurable: true }); }; }); -require.register("chai/lib/chai/utils/overwriteChainableMethod.js", function(exports, require, module){ + +require.register("chai/lib/chai/utils/overwriteChainableMethod.js", function (exports, module) { /*! * Chai - overwriteChainableMethod utility * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com> * MIT Licensed */ @@ -4632,22 +4618,23 @@ return result === undefined ? this : result; }; }; }); -require.register("chai/lib/chai/utils/test.js", function(exports, require, module){ + +require.register("chai/lib/chai/utils/test.js", function (exports, module) { /*! * Chai - test utility * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com> * MIT Licensed */ /*! * Module dependancies */ -var flag = require('./flag'); +var flag = require('chai/lib/chai/utils/flag.js'); /** * # test(object, expression) * * Test and object for expression. @@ -4661,11 +4648,12 @@ , expr = args[0]; return negate ? !expr : expr; }; }); -require.register("chai/lib/chai/utils/transferFlags.js", function(exports, require, module){ + +require.register("chai/lib/chai/utils/transferFlags.js", function (exports, module) { /*! * Chai - transferFlags utility * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com> * MIT Licensed */ @@ -4708,11 +4696,12 @@ } } }; }); -require.register("chai/lib/chai/utils/type.js", function(exports, require, module){ + +require.register("chai/lib/chai/utils/type.js", function (exports, module) { /*! * Chai - type utility * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com> * MIT Licensed */ @@ -4757,26 +4746,13 @@ return typeof obj; }; }); - - - -require.alias("chaijs-assertion-error/index.js", "chai/deps/assertion-error/index.js"); -require.alias("chaijs-assertion-error/index.js", "chai/deps/assertion-error/index.js"); -require.alias("chaijs-assertion-error/index.js", "assertion-error/index.js"); -require.alias("chaijs-assertion-error/index.js", "chaijs-assertion-error/index.js"); -require.alias("chaijs-deep-eql/lib/eql.js", "chai/deps/deep-eql/lib/eql.js"); -require.alias("chaijs-deep-eql/lib/eql.js", "chai/deps/deep-eql/index.js"); -require.alias("chaijs-deep-eql/lib/eql.js", "deep-eql/index.js"); -require.alias("chaijs-type-detect/lib/type.js", "chaijs-deep-eql/deps/type-detect/lib/type.js"); -require.alias("chaijs-type-detect/lib/type.js", "chaijs-deep-eql/deps/type-detect/index.js"); -require.alias("chaijs-type-detect/lib/type.js", "chaijs-type-detect/index.js"); -require.alias("chaijs-deep-eql/lib/eql.js", "chaijs-deep-eql/index.js"); -require.alias("chai/index.js", "chai/index.js");if (typeof exports == "object") { +if (typeof exports == "object") { module.exports = require("chai"); } else if (typeof define == "function" && define.amd) { - define([], function(){ return require("chai"); }); + define("chai", [], function(){ return require("chai"); }); } else { - this["chai"] = require("chai"); -}})(); \ No newline at end of file + (this || window)["chai"] = require("chai"); +} +})()