mirror of
https://github.com/Modernizr/Modernizr.git
synced 2026-01-08 23:27:59 -05:00
Hey server, this content is for you! [skip ci]
This commit is contained in:
10798
dist/modernizr-build.js
vendored
Normal file
10798
dist/modernizr-build.js
vendored
Normal file
File diff suppressed because one or more lines are too long
51
lib/build-query.js
Normal file
51
lib/build-query.js
Normal file
@@ -0,0 +1,51 @@
|
||||
define(['lodash', 'metadata'], function(_, metadata) {
|
||||
|
||||
function getDetectObjByAmdPath(amdPath) {
|
||||
return _.find(metadata, function(detect) {
|
||||
return detect.amdPath === amdPath || detect.amdPath === 'test/' + amdPath;
|
||||
});
|
||||
}
|
||||
|
||||
return function generateBuildQuery(config) {
|
||||
// Format:
|
||||
// ?-<prop1>-<prop2>-…-<propN>-<option1>-<option2>-…<optionN>[-dontmin][-cssclassprefix:<prefix>]
|
||||
// where prop1…N and option1…N are sorted alphabetically (for consistency)
|
||||
var dontmin = !config.minify;
|
||||
|
||||
// Config uses amdPaths, but build query uses property names
|
||||
var props = _.chain(config['feature-detects'])
|
||||
.map(function(amdPath) {
|
||||
var detect = getDetectObjByAmdPath(amdPath);
|
||||
var property = detect && detect.property;
|
||||
if (property) {
|
||||
property = _.isArray(property) ?
|
||||
property.join('_').replace('-', '_') :
|
||||
property.replace('-', '_');
|
||||
return property;
|
||||
}
|
||||
})
|
||||
.filter()
|
||||
.value();
|
||||
|
||||
// Config uses amdPaths, but the option's just use their names.
|
||||
// A few of the values have to be massaged in order to match
|
||||
// the `value`
|
||||
var opts = _.map(config.options, function(opt) {
|
||||
if (opt.indexOf('html5') === 0) {
|
||||
opt = opt.replace('html5', '');
|
||||
}
|
||||
return opt.toLowerCase();
|
||||
});
|
||||
|
||||
var sortedProps = props.sort();
|
||||
var sortedOpts = opts.sort();
|
||||
|
||||
// Options are AMD paths in the config, but need to be converted to
|
||||
var buildQuery = '?-' + sortedProps.concat(sortedOpts).join('-') +
|
||||
(dontmin ? '-dontmin' : '') +
|
||||
((config.classPrefix) ?
|
||||
'-cssclassprefix:' + config.classPrefix : '');
|
||||
|
||||
return buildQuery;
|
||||
};
|
||||
});
|
||||
170
lib/build.js
Normal file
170
lib/build.js
Normal file
@@ -0,0 +1,170 @@
|
||||
// this file configures require.js based on environment
|
||||
'use strict';
|
||||
|
||||
var inBrowser = typeof define === 'function' && typeof define.amd === 'object';
|
||||
|
||||
var _extend = function(a, b) {
|
||||
for (var prop in b) {
|
||||
var supplied = b[prop];
|
||||
if (Object.prototype.toString.call(supplied) === '[object Object]') {
|
||||
a[prop] = a[prop] || {};
|
||||
_extend(a[prop], supplied);
|
||||
} else {
|
||||
a[prop] = b[prop];
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var baseRequireConfig = {
|
||||
optimize: 'none',
|
||||
generateSourceMaps: false,
|
||||
optimizeCss: 'none',
|
||||
useStrict: true,
|
||||
include: ['modernizr-init'],
|
||||
fileExclusionRegExp: /^(.git|node_modules|modulizr|media|test)$/,
|
||||
wrap: {
|
||||
start: '\n;(function(scriptGlobalObject, window, document, undefined){',
|
||||
end: '})(window, window, document);'
|
||||
},
|
||||
onBuildWrite: function(id, path, contents) {
|
||||
if (this.optimize === 'uglify') {
|
||||
// strip out documentation comments
|
||||
contents = contents.replace(/\/\*\![\s\S]*\!\*\//m, '');
|
||||
}
|
||||
|
||||
if ((/define\(.*?\{/).test(contents)) {
|
||||
// remove AMD ceremony for use without require.js or almond.js
|
||||
contents = contents.replace(/define\(.*?\{/, '');
|
||||
|
||||
contents = contents.replace(/\}\);\s*?$/, '');
|
||||
|
||||
if (!contents.match(/Modernizr\.add(Async)?Test\(/)) {
|
||||
// remove last return statement and trailing })
|
||||
contents = contents.replace(/return.*[^return]*$/, '');
|
||||
}
|
||||
} else if ((/require\([^\{]*?\{/).test(contents)) {
|
||||
contents = contents.replace(/require[^\{]+\{/, '');
|
||||
contents = contents.replace(/\}\);\s*$/, '');
|
||||
}
|
||||
|
||||
contents = contents.replace(/return addTest;/, '');
|
||||
|
||||
return contents;
|
||||
}
|
||||
};
|
||||
|
||||
function build(generate, generateBanner, pkg) {
|
||||
return function build(config, cb) {
|
||||
var requireConfig = {};
|
||||
var banner;
|
||||
config = config || {};
|
||||
cb = cb || function noop() {};
|
||||
|
||||
_extend(requireConfig, baseRequireConfig);
|
||||
|
||||
requireConfig.rawText = {
|
||||
'modernizr-init': generate(config)
|
||||
};
|
||||
|
||||
if (config.minify) {
|
||||
banner = generateBanner('compact', config);
|
||||
requireConfig.optimize = 'uglify';
|
||||
requireConfig.uglify = {
|
||||
mangle: {
|
||||
except: ['Modernizr']
|
||||
},
|
||||
beautify: {
|
||||
ascii_only: true
|
||||
}
|
||||
};
|
||||
} else {
|
||||
banner = generateBanner('full', config);
|
||||
requireConfig.optimize = 'none';
|
||||
}
|
||||
|
||||
if(config.scriptGlobalName) {
|
||||
requireConfig.wrap.end = '})(' + config.scriptGlobalName + ', window, document);';
|
||||
}
|
||||
|
||||
requireConfig.out = function(output) {
|
||||
output = banner + output;
|
||||
|
||||
// Remove `define('modernizr-init' ...)` and `define('modernizr-build' ...)`
|
||||
output = output.replace(/(,\s*)?define\("modernizr-(init|build)",\s*function\(\)\{\};?\)/g, '');
|
||||
output = output.replace(/__VERSION__/g, pkg.version);
|
||||
|
||||
// Hack the prefix into place. Anything is way too big for something so small.
|
||||
if (config && config.classPrefix) {
|
||||
output = output.replace(/(classPrefix'?:\s?)['"]{2}(,)/, '$1\'' + config.classPrefix.replace(/'/g, '\\\'') + '\'$2');
|
||||
}
|
||||
['enableClasses', 'enableJSClass', 'usePrefixes'].forEach(function(configName) {
|
||||
if (config && typeof config[configName] === 'boolean') {
|
||||
if (config.minify) {
|
||||
output = output.replace(new RegExp('(' + configName + '\\\'?\\s?:\\s?)(!?0)([,\\n])'), '$1' + (config[configName] ? "!0" : "!1") + '$3');
|
||||
} else {
|
||||
output = output.replace(new RegExp('(' + configName + '\\\'?\\s?:\\s?)(true|false)([,\\n])'), '$1' + Boolean(config[configName]) + '$3');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
cb(output);
|
||||
};
|
||||
|
||||
requirejs.optimize(requireConfig);
|
||||
};
|
||||
}
|
||||
|
||||
if (inBrowser) {
|
||||
var suppliedConfig = self._modernizrConfig;
|
||||
var metadataUrl = 'i/js/metadata.json';
|
||||
var packageUrl = 'i/js/modernizr-git/package.json';
|
||||
baseRequireConfig.baseUrl = '/i/js/modernizr-git/src';
|
||||
baseRequireConfig.paths = {
|
||||
text: '/i/js/requirejs-plugins/lib/text',
|
||||
lib: '/i/js/modernizr-git/lib',
|
||||
json: '/i/js/requirejs-plugins/src/json',
|
||||
lodash: '/i/js/lodash',
|
||||
test: '/i/js/modernizr-git/feature-detects'
|
||||
};
|
||||
|
||||
if (suppliedConfig) {
|
||||
metadataUrl = suppliedConfig.metadataUrl || metadataUrl;
|
||||
packageUrl = suppliedConfig.packageUrl || packageUrl;
|
||||
_extend(baseRequireConfig, suppliedConfig);
|
||||
}
|
||||
|
||||
if (self._modernizrMetadata) {
|
||||
requirejs.define('metadata', [], function() {return self._modernizrMetadata;});
|
||||
} else {
|
||||
requirejs.define('metadata', ['json!' + metadataUrl], function(pkg) {return pkg;});
|
||||
}
|
||||
requirejs.define('package', ['json!' + packageUrl], function(pkg) {return pkg;});
|
||||
} else {
|
||||
var requirejs = require('requirejs');
|
||||
var metadata = require('./metadata')();
|
||||
var pkgj = require('../package.json');
|
||||
|
||||
requirejs.define('metadata', [], function() {return metadata;});
|
||||
requirejs.define('package', function() {return pkgj;});
|
||||
|
||||
baseRequireConfig.baseUrl = __dirname + '/../src';
|
||||
baseRequireConfig.paths = {
|
||||
lodash: require.resolve('lodash').replace(/\.[^/.]+$/, ""),
|
||||
test: __dirname + '/../feature-detects',
|
||||
lib: __dirname
|
||||
};
|
||||
}
|
||||
|
||||
requirejs.config(baseRequireConfig);
|
||||
|
||||
if (inBrowser) {
|
||||
define('build', ['generate', 'lib/generate-banner', 'package'], build);
|
||||
} else {
|
||||
var generateBanner = requirejs(__dirname + '/generate-banner.js');
|
||||
var generate = requirejs('generate');
|
||||
var pakg = requirejs('package');
|
||||
var _build = build;
|
||||
module.exports = function build() {
|
||||
return _build(generate, generateBanner, pakg).apply(undefined, arguments);
|
||||
};
|
||||
}
|
||||
7
lib/cli.js
Normal file
7
lib/cli.js
Normal file
@@ -0,0 +1,7 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = {
|
||||
build: require('./build'),
|
||||
metadata: require('./metadata'),
|
||||
options: require('./options')
|
||||
};
|
||||
331
lib/config-all.json
Normal file
331
lib/config-all.json
Normal file
@@ -0,0 +1,331 @@
|
||||
{
|
||||
"classPrefix": "",
|
||||
"enableClasses": true,
|
||||
"enableJSClass": true,
|
||||
"scriptGlobalName": "window",
|
||||
"usePrefixes": true,
|
||||
"minify": false,
|
||||
"options": [
|
||||
"addTest",
|
||||
"atRule",
|
||||
"domPrefixes",
|
||||
"hasEvent",
|
||||
"html5shiv",
|
||||
"html5printshiv",
|
||||
"load",
|
||||
"mq",
|
||||
"prefixed",
|
||||
"prefixes",
|
||||
"prefixedCSS",
|
||||
"setClasses",
|
||||
"testAllProps",
|
||||
"testProp",
|
||||
"testStyles"
|
||||
],
|
||||
"feature-detects": [
|
||||
"a/download",
|
||||
"a/aping",
|
||||
"a/areaping",
|
||||
"ambientlight",
|
||||
"applicationcache",
|
||||
"audio",
|
||||
"audio/autoplay",
|
||||
"audio/loop",
|
||||
"audio/preload",
|
||||
"audio/webaudio",
|
||||
"battery",
|
||||
"battery/lowbattery",
|
||||
"blob",
|
||||
"canvas",
|
||||
"canvas/blending",
|
||||
"canvas/todataurl",
|
||||
"canvas/winding",
|
||||
"canvastext",
|
||||
"clipboard",
|
||||
"contenteditable",
|
||||
"contextmenu",
|
||||
"cookies",
|
||||
"cors",
|
||||
"crypto",
|
||||
"crypto/getrandomvalues",
|
||||
"css/all",
|
||||
"css/animations",
|
||||
"css/appearance",
|
||||
"css/backdropfilter",
|
||||
"css/backgroundblendmode",
|
||||
"css/backgroundcliptext",
|
||||
"css/backgroundposition-shorthand",
|
||||
"css/backgroundposition-xy",
|
||||
"css/backgroundrepeat",
|
||||
"css/backgroundsize",
|
||||
"css/backgroundsizecover",
|
||||
"css/borderimage",
|
||||
"css/borderradius",
|
||||
"css/boxdecorationbreak",
|
||||
"css/boxshadow",
|
||||
"css/boxsizing",
|
||||
"css/calc",
|
||||
"css/checked",
|
||||
"css/chunit",
|
||||
"css/columns",
|
||||
"css/cssgrid",
|
||||
"css/cubicbezierrange",
|
||||
"css/customproperties",
|
||||
"css/displayrunin",
|
||||
"css/displaytable",
|
||||
"css/ellipsis",
|
||||
"css/escape",
|
||||
"css/exunit",
|
||||
"css/filters",
|
||||
"css/flexbox",
|
||||
"css/flexboxlegacy",
|
||||
"css/flexboxtweener",
|
||||
"css/flexwrap",
|
||||
"css/flexgap",
|
||||
"css/focusvisible",
|
||||
"css/focuswithin",
|
||||
"css/fontdisplay",
|
||||
"css/fontface",
|
||||
"css/generatedcontent",
|
||||
"css/gradients",
|
||||
"css/hairline",
|
||||
"css/hsla",
|
||||
"css/hyphens",
|
||||
"css/invalid",
|
||||
"css/lastchild",
|
||||
"css/mask",
|
||||
"css/mediaqueries",
|
||||
"css/multiplebgs",
|
||||
"css/nthchild",
|
||||
"css/objectfit",
|
||||
"css/opacity",
|
||||
"css/overflow-scrolling",
|
||||
"css/pointerevents",
|
||||
"css/positionsticky",
|
||||
"css/pseudoanimations",
|
||||
"css/pseudotransitions",
|
||||
"css/reflections",
|
||||
"css/regions",
|
||||
"css/remunit",
|
||||
"css/resize",
|
||||
"css/rgba",
|
||||
"css/scrollbars",
|
||||
"css/scrollsnappoints",
|
||||
"css/shapes",
|
||||
"css/siblinggeneral",
|
||||
"css/subpixelfont",
|
||||
"css/supports",
|
||||
"css/target",
|
||||
"css/textalignlast",
|
||||
"css/textdecoration",
|
||||
"css/textshadow",
|
||||
"css/transforms",
|
||||
"css/transforms3d",
|
||||
"css/transformslevel2",
|
||||
"css/transformstylepreserve3d",
|
||||
"css/transitions",
|
||||
"css/userselect",
|
||||
"css/valid",
|
||||
"css/variablefonts",
|
||||
"css/vhunit",
|
||||
"css/vmaxunit",
|
||||
"css/vminunit",
|
||||
"css/vwunit",
|
||||
"css/will-change",
|
||||
"css/wrapflow",
|
||||
"custom-elements",
|
||||
"custom-protocol-handler",
|
||||
"customevent",
|
||||
"dart",
|
||||
"dataview-api",
|
||||
"dom/classlist",
|
||||
"dom/createElement-attrs",
|
||||
"dom/dataset",
|
||||
"dom/documentfragment",
|
||||
"dom/hidden",
|
||||
"dom/intersection-observer",
|
||||
"dom/microdata",
|
||||
"dom/mutationObserver",
|
||||
"dom/passiveeventlisteners",
|
||||
"dom/shadowroot",
|
||||
"dom/shadowrootlegacy",
|
||||
"elem/bdi",
|
||||
"elem/datalist",
|
||||
"elem/details",
|
||||
"elem/output",
|
||||
"elem/picture",
|
||||
"elem/progress-meter",
|
||||
"elem/ruby",
|
||||
"elem/template",
|
||||
"elem/time",
|
||||
"elem/track",
|
||||
"elem/unknown",
|
||||
"emoji",
|
||||
"es5/array",
|
||||
"es5/date",
|
||||
"es5/function",
|
||||
"es5/object",
|
||||
"es5/specification",
|
||||
"es5/strictmode",
|
||||
"es5/string",
|
||||
"es5/syntax",
|
||||
"es5/undefined",
|
||||
"es6/array",
|
||||
"es6/arrow",
|
||||
"es6/class",
|
||||
"es6/collections",
|
||||
"es6/contains",
|
||||
"es6/generators",
|
||||
"es6/math",
|
||||
"es6/number",
|
||||
"es6/object",
|
||||
"es6/promises",
|
||||
"es6/string",
|
||||
"es6/symbol",
|
||||
"es6/rest-parameters",
|
||||
"es6/string-template",
|
||||
"es6/spread-array",
|
||||
"es7/array",
|
||||
"es7/rest-destructuring",
|
||||
"es7/spread-object",
|
||||
"es8/object",
|
||||
"event/deviceorientation-motion",
|
||||
"event/oninput",
|
||||
"eventlistener",
|
||||
"exif-orientation",
|
||||
"file/api",
|
||||
"file/filesystem",
|
||||
"flash",
|
||||
"forcetouch",
|
||||
"forms/capture",
|
||||
"forms/fileinput",
|
||||
"forms/fileinputdirectory",
|
||||
"forms/formattribute",
|
||||
"forms/inputnumber-l10n",
|
||||
"forms/placeholder",
|
||||
"forms/requestautocomplete",
|
||||
"forms/validation",
|
||||
"fullscreen-api",
|
||||
"gamepad",
|
||||
"geolocation",
|
||||
"hashchange",
|
||||
"hiddenscroll",
|
||||
"history",
|
||||
"htmlimports",
|
||||
"ie8compat",
|
||||
"iframe/sandbox",
|
||||
"iframe/seamless",
|
||||
"iframe/srcdoc",
|
||||
"img/apng",
|
||||
"img/avif",
|
||||
"img/crossorigin",
|
||||
"img/jpeg2000",
|
||||
"img/jpegxr",
|
||||
"img/lazyloading",
|
||||
"img/sizes",
|
||||
"img/srcset",
|
||||
"img/webp",
|
||||
"img/webp-alpha",
|
||||
"img/webp-animation",
|
||||
"img/webp-lossless",
|
||||
"indexeddb",
|
||||
"indexeddbblob",
|
||||
"input",
|
||||
"input/formaction",
|
||||
"input/formenctype",
|
||||
"input/formmethod",
|
||||
"input/formnovalidate",
|
||||
"input/formtarget",
|
||||
"inputsearchevent",
|
||||
"inputtypes",
|
||||
"intl",
|
||||
"json",
|
||||
"ligatures",
|
||||
"lists-reversed",
|
||||
"mathml",
|
||||
"mediaquery/hovermq",
|
||||
"mediaquery/pointermq",
|
||||
"media-source-extension-api",
|
||||
"messagechannel",
|
||||
"network/beacon",
|
||||
"network/connection",
|
||||
"network/connection-effectivetype",
|
||||
"network/eventsource",
|
||||
"network/fetch",
|
||||
"network/xhr2",
|
||||
"network/xhr-responsetype",
|
||||
"network/xhr-responsetype-arraybuffer",
|
||||
"network/xhr-responsetype-blob",
|
||||
"network/xhr-responsetype-document",
|
||||
"network/xhr-responsetype-json",
|
||||
"network/xhr-responsetype-text",
|
||||
"notification",
|
||||
"pagevisibility-api",
|
||||
"performance",
|
||||
"pointerevents",
|
||||
"pointerlock-api",
|
||||
"postmessage",
|
||||
"proximity",
|
||||
"proxy",
|
||||
"queryselector",
|
||||
"quota-management-api",
|
||||
"link/prefetch",
|
||||
"requestanimationframe",
|
||||
"script/async",
|
||||
"script/defer",
|
||||
"scrolltooptions",
|
||||
"serviceworker",
|
||||
"speech/speech-recognition",
|
||||
"speech/speech-synthesis",
|
||||
"storage/indexeddb2",
|
||||
"storage/localstorage",
|
||||
"storage/sessionstorage",
|
||||
"storage/websqldatabase",
|
||||
"style/scoped",
|
||||
"svg",
|
||||
"svg/asimg",
|
||||
"svg/clippaths",
|
||||
"svg/filters",
|
||||
"svg/foreignobject",
|
||||
"svg/inline",
|
||||
"svg/smil",
|
||||
"templatestrings",
|
||||
"textarea/maxlength",
|
||||
"textencoding",
|
||||
"typed-arrays",
|
||||
"unicode-range",
|
||||
"url/bloburls",
|
||||
"url/data-uri",
|
||||
"url/parser",
|
||||
"url/urlsearchparams",
|
||||
"userdata",
|
||||
"vibration",
|
||||
"video",
|
||||
"video/autoplay",
|
||||
"video/crossorigin",
|
||||
"video/loop",
|
||||
"video/preload",
|
||||
"vml",
|
||||
"web-intents",
|
||||
"webanimations",
|
||||
"webauthn/publickeycredential",
|
||||
"webgl",
|
||||
"webgl/extensions",
|
||||
"webrtc/datachannel",
|
||||
"webrtc/getusermedia",
|
||||
"webrtc/mediastream",
|
||||
"webrtc/peerconnection",
|
||||
"websockets",
|
||||
"websockets/binary",
|
||||
"window/atob-btoa",
|
||||
"window/framed",
|
||||
"window/matchmedia",
|
||||
"window/resizeobserver",
|
||||
"workers/blobworkers",
|
||||
"workers/dataworkers",
|
||||
"workers/sharedworkers",
|
||||
"workers/transferables",
|
||||
"workers/webworkers",
|
||||
"xdomainrequest"
|
||||
]
|
||||
}
|
||||
39
lib/generate-banner.js
Normal file
39
lib/generate-banner.js
Normal file
@@ -0,0 +1,39 @@
|
||||
define(['lodash', 'package', 'lib/build-query'], function(_, pkg, buildQuery) {
|
||||
var domain = 'modernizr.com';
|
||||
if (typeof location !== 'undefined' && 'host' in location) {
|
||||
domain = location.host;
|
||||
}
|
||||
|
||||
// Return a Modernizr file banner.
|
||||
// Usage:
|
||||
// require('banners')(type);
|
||||
// Arguments:
|
||||
// type (String, required): either 'compact' or 'full'.
|
||||
|
||||
return function banners(type, config) {
|
||||
config = config || {};
|
||||
var query = buildQuery(config);
|
||||
if (!type || type === 'compact') {
|
||||
return '/*! ' + pkg.name + ' ' + pkg.version + ' (Custom Build) | ' + pkg.license + ' *\n' +
|
||||
' * https://' + domain + '/download/' + query +
|
||||
' !*/\n';
|
||||
}
|
||||
else if (type === 'full') {
|
||||
return '/*!\n' +
|
||||
' * ' + pkg.name + ' v' + pkg.version + '\n' +
|
||||
' * Build https://' + domain + '/download' + query + '\n' +
|
||||
' *\n' +
|
||||
' * Copyright (c)\n * ' + _.map(pkg.contributors, 'name').join('\n * ') + '\n\n' +
|
||||
' * ' + pkg.license + ' License\n */\n' +
|
||||
'\n' +
|
||||
'/*\n' +
|
||||
' * Modernizr tests which native CSS3 and HTML5 features are available in the\n' +
|
||||
' * current UA and makes the results available to you in two ways: as properties on\n' +
|
||||
' * a global `Modernizr` object, and as classes on the `<html>` element. This\n' +
|
||||
' * information allows you to progressively enhance your pages with a granular level\n' +
|
||||
' * of control over the experience.\n*/\n';
|
||||
} else {
|
||||
throw 'banners() must be passed "compact" or "full" as an argument.';
|
||||
}
|
||||
};
|
||||
});
|
||||
140
lib/metadata.js
Normal file
140
lib/metadata.js
Normal file
@@ -0,0 +1,140 @@
|
||||
var fs = require('fs');
|
||||
var file = require('file');
|
||||
var MarkdownIt = require('markdown-it');
|
||||
var polyfills = require('./polyfills.json');
|
||||
var viewRoot = fs.realpathSync(__dirname + '/../feature-detects');
|
||||
|
||||
function metadata(cb) {
|
||||
var tests = [];
|
||||
var md = new MarkdownIt();
|
||||
file.walkSync(viewRoot, function(start, dirs, files) {
|
||||
files.forEach(function(file) {
|
||||
if (file === '.DS_Store') {
|
||||
return;
|
||||
}
|
||||
var test = fs.readFileSync(start + '/' + file, 'utf8');
|
||||
// TODO:: make this regex not suck
|
||||
var metaRE = /\/\*\!([\s\S]*)\!\*\//m;
|
||||
var matches = test.match(metaRE);
|
||||
var docRE = /\/\*\sDOC([\s\S]*?)\*\//m;
|
||||
var docmatches = test.match(docRE);
|
||||
var depRE = /define\((\[[^\]]*\]),/;
|
||||
var depMatches = test.match(depRE);
|
||||
|
||||
var metadata;
|
||||
|
||||
if (matches && matches[1]) {
|
||||
try {
|
||||
metadata = JSON.parse(matches[1]);
|
||||
} catch (e) {
|
||||
throw new Error('Error Parsing Metadata: ' + file + '\nInput: `' + matches[1] + '`');
|
||||
}
|
||||
}
|
||||
else {
|
||||
metadata = {};
|
||||
}
|
||||
|
||||
var docs = null;
|
||||
|
||||
if (docmatches && docmatches[1]) {
|
||||
docs = md.render(docmatches[1].trim());
|
||||
}
|
||||
|
||||
metadata.doc = docs;
|
||||
|
||||
var deps = [];
|
||||
var matchedDeps;
|
||||
|
||||
if (depMatches && depMatches[1]) {
|
||||
try {
|
||||
matchedDeps = JSON.parse(depMatches[1].replace(/'/g, '"'));
|
||||
} catch (e) {
|
||||
throw new Error('Couldn\'t parse dependencies for `' + file + '`:\n`' + depMatches[1] + '\n`');
|
||||
}
|
||||
matchedDeps.forEach(function(dep) {
|
||||
if (dep === 'Modernizr') {
|
||||
return;
|
||||
}
|
||||
deps.push(dep);
|
||||
});
|
||||
} else {
|
||||
throw new Error('Couldn\'t find the define for `' + file + '`');
|
||||
}
|
||||
metadata.deps = deps;
|
||||
|
||||
var baseDir = __dirname.replace(/lib$/, '');
|
||||
metadata.path = './' + (start + '/' + file).replace(baseDir, '').replace(/\\/g, '/');
|
||||
metadata.amdPath = metadata.path.replace(/^\.\/feature\-detects/, 'test').replace(/\.js$/i, '');
|
||||
|
||||
if (!metadata.name) {
|
||||
metadata.name = metadata.amdPath;
|
||||
}
|
||||
|
||||
var pfs = [];
|
||||
if (metadata.polyfills && metadata.polyfills.length) {
|
||||
metadata.polyfills.forEach(function(polyname) {
|
||||
if (polyfills[polyname]) {
|
||||
pfs.push(polyfills[polyname]);
|
||||
}
|
||||
else {
|
||||
throw new Error(metadata.name + ': Polyfill not found in `' + file + '`: ' + polyname);
|
||||
}
|
||||
});
|
||||
}
|
||||
metadata.polyfills = pfs;
|
||||
|
||||
if (!metadata.async) {
|
||||
metadata.async = false;
|
||||
}
|
||||
|
||||
if (!metadata.notes) {
|
||||
metadata.notes = [];
|
||||
}
|
||||
|
||||
if (!metadata.warnings) {
|
||||
metadata.warnings = [];
|
||||
}
|
||||
|
||||
if (!metadata.caniuse) {
|
||||
metadata.caniuse = null;
|
||||
}
|
||||
|
||||
if (!metadata.cssclass && metadata.property) {
|
||||
metadata.cssclass = metadata.property;
|
||||
} else {
|
||||
metadata.cssclass = null;
|
||||
}
|
||||
|
||||
// Maybe catch a bug
|
||||
if (!metadata.doc && metadata.docs) {
|
||||
metadata.doc = metadata.docs;
|
||||
delete metadata.docs;
|
||||
}
|
||||
|
||||
// If you want markdown parsed code minus the docs and metadata, this'll do it.
|
||||
// Off by default for now.
|
||||
// metadata.code = md.render('```javascript\n' + test.replace(metaRE, '').replace(docRE, '') + '\n```');
|
||||
|
||||
if (!metadata.tags) {
|
||||
metadata.tags = [];
|
||||
}
|
||||
|
||||
if (!metadata.authors) {
|
||||
metadata.authors = [];
|
||||
}
|
||||
|
||||
if (!metadata.knownBugs) {
|
||||
metadata.knownBugs = [];
|
||||
}
|
||||
|
||||
tests.push(metadata);
|
||||
});
|
||||
});
|
||||
|
||||
if (cb && typeof cb === 'function') {
|
||||
return cb(tests);
|
||||
}
|
||||
return tests;
|
||||
}
|
||||
|
||||
module.exports = metadata;
|
||||
90
lib/options.js
Normal file
90
lib/options.js
Normal file
@@ -0,0 +1,90 @@
|
||||
var fs = require('fs');
|
||||
var _ = require('lodash');
|
||||
var file = require('file');
|
||||
var jsdoc = require('doctrine');
|
||||
var srcRoot = fs.realpathSync(__dirname + '/../src');
|
||||
var commentRE = /^(\s+)?(\/\*)?\*(\/)?\s?/mg;
|
||||
var jsdocRE = /[^\S\r\n]*\/(?:\*{2})([\W\w]+?)\*\//mg;
|
||||
|
||||
var stripComments = function(str) {
|
||||
return str.replace(commentRE, '');
|
||||
};
|
||||
|
||||
function options(cb, allMetadata) {
|
||||
var opts;
|
||||
|
||||
file.walkSync(srcRoot, function(start, dirs, files) {
|
||||
opts = _.chain(files)
|
||||
.map(function(file) {
|
||||
var srcFile = fs.readFileSync(start + '/' + file, 'utf8');
|
||||
var docs = srcFile.match(jsdocRE);
|
||||
|
||||
if (docs) {
|
||||
docs = docs
|
||||
.map(stripComments)
|
||||
.map(function(str) {
|
||||
return jsdoc.parse(str, {
|
||||
sloppy: true,
|
||||
tags: [
|
||||
'access',
|
||||
'author',
|
||||
'class',
|
||||
'example',
|
||||
'function',
|
||||
'memberOf',
|
||||
'name',
|
||||
'optionName',
|
||||
'optionProp',
|
||||
'param',
|
||||
'params',
|
||||
'preserve',
|
||||
'private',
|
||||
'returns',
|
||||
'type'
|
||||
]
|
||||
});
|
||||
});
|
||||
|
||||
var option = _.chain(docs)
|
||||
.flatten()
|
||||
.filter(function(doc) {
|
||||
if (allMetadata) {
|
||||
return true;
|
||||
} else {
|
||||
return doc && _.some(doc.tags, {title: 'optionName'});
|
||||
}
|
||||
})
|
||||
.map(function(opt) {
|
||||
if (allMetadata) {
|
||||
return opt;
|
||||
} else {
|
||||
var tags = opt.tags.filter(function(tag) {
|
||||
return tag.title.indexOf('option') === 0;
|
||||
});
|
||||
|
||||
return {
|
||||
name: _.filter(tags, {title: 'optionName'})[0].description,
|
||||
property: _.filter(tags, {title: 'optionProp'})[0].description
|
||||
};
|
||||
}
|
||||
})
|
||||
.value();
|
||||
|
||||
return option;
|
||||
}
|
||||
})
|
||||
.filter(function(doc) {
|
||||
return doc && doc.length;
|
||||
})
|
||||
.flatten()
|
||||
.value();
|
||||
});
|
||||
|
||||
if (cb) {
|
||||
cb(opts);
|
||||
}
|
||||
|
||||
return opts;
|
||||
}
|
||||
|
||||
module.exports = options;
|
||||
790
lib/polyfills.json
Normal file
790
lib/polyfills.json
Normal file
@@ -0,0 +1,790 @@
|
||||
{
|
||||
"html5shiv": {
|
||||
"name": "HTML5 Shiv",
|
||||
"authors": ["Alexander Farkas (@aFarkas)", "Jonathan Neal (@jonathantneal)", "Paul Irish (@paulirish)"],
|
||||
"href": "https://github.com/aFarkas/html5shiv",
|
||||
"licenses": ["MIT", "GPL2"],
|
||||
"notes": ["The HTML5 Shiv enables use of HTML5 sectioning elements in legacy Internet Explorer and provides basic HTML5 styling for Internet Explorer 6-9, Safari 4.x (and iPhone 3.x), and Firefox 3.x."]
|
||||
},
|
||||
"html5-notifications": {
|
||||
"name": "HTML5 Notifications",
|
||||
"authors": ["Hendrik Beskow"],
|
||||
"href": "https://gist.github.com/Asmod4n/6030828",
|
||||
"licenses": ["MIT"],
|
||||
"notes": ["A Polyfill to fix the differences in WebKit, Blink and Gecko HTML5 Desktop Notifications, also adds a way to add your own JavaScript Notifications in case your Browser doesn't support them natively."]
|
||||
},
|
||||
"desktop-notify": {
|
||||
"name": "HTML5-Desktop-Notifications",
|
||||
"authors": ["Tsvetan Tsvetkov"],
|
||||
"href": "https://github.com/ttsvetko/HTML5-Desktop-Notifications",
|
||||
"licenses": ["Apache2"],
|
||||
"notes": ["A small library that unifies the HTML5 Notifications APIs across different browsers including IE9 & IE10."]
|
||||
},
|
||||
"css3pie": {
|
||||
"name": "CSS3 PIE",
|
||||
"authors": ["Jason Johnston"],
|
||||
"href": "http://css3pie.com/",
|
||||
"licenses": ["Apache2", "GPL2"],
|
||||
"notes": ["CSS3 decoration rendering for IE 6-9. Supports: border-radius, box-shadow, multiple backgrounds, linear gradients, border-image"]
|
||||
},
|
||||
"xaudiojs": {
|
||||
"name": "XAudioJS",
|
||||
"authors": ["Grant Galitz"],
|
||||
"href": "https://github.com/grantgalitz/XAudioJS",
|
||||
"licenses": [],
|
||||
"notes": [
|
||||
"Audio sample stream output thin-abstraction library that supports mono and stereo audio, as well as resampling the audio stream.",
|
||||
"Supports the Mozilla Audio Data API, Web Audio API, Adobe Flash 10, real-time WAV PCM Data URI generation"
|
||||
]
|
||||
},
|
||||
"dynamicaudiojs": {
|
||||
"name": "dynamicaudio.js",
|
||||
"authors": ["Ben Firshman"],
|
||||
"href": "http://github.com/bfirsh/dynamicaudio.js",
|
||||
"licenses": ["BSD"],
|
||||
"notes": []
|
||||
},
|
||||
"audiolibjs": {
|
||||
"name": "audiolib.js",
|
||||
"authors": ["Jussi Kalliokoski"],
|
||||
"href": "https://github.com/jussi-kalliokoski/audiolib.js",
|
||||
"licenses": ["MIT"],
|
||||
"notes": ["specs: incubator group proposed spec, Mozilla Audio Data API (temporary)"]
|
||||
},
|
||||
"transformie": {
|
||||
"name": "transformie",
|
||||
"authors": ["Paul Bakaus"],
|
||||
"href": "https://github.com/pbakaus/transformie",
|
||||
"licenses": ["GPL2", "MIT"],
|
||||
"notes": []
|
||||
},
|
||||
"csssandpaper": {
|
||||
"name": "CSS Sandpaper",
|
||||
"authors": ["Zoltan Hawryluk"],
|
||||
"href": "http://www.useragentman.com/blog/2010/03/09/cross-browser-css-transforms-even-in-ie/",
|
||||
"licenses": ["MIT"],
|
||||
"notes": []
|
||||
},
|
||||
"css-escape": {
|
||||
"name": "CSS.escape()",
|
||||
"authors": ["Mathias Bynens"],
|
||||
"href": "http://mths.be/cssescape",
|
||||
"licenses": ["MIT"],
|
||||
"notes": []
|
||||
},
|
||||
"borderboxmodel": {
|
||||
"name": "borderBoxModel",
|
||||
"authors": ["Alberto Gasparin"],
|
||||
"href": "https://github.com/albertogasparin/borderBoxModel",
|
||||
"licenses": ["MIT"],
|
||||
"notes": ["box-sizing: border-box; javascript polyfill for IE6+"]
|
||||
},
|
||||
"boxsizingpolyfill": {
|
||||
"name": "box-sizing-polyfill",
|
||||
"authors": ["Christian \"Schepp\" Schaefer"],
|
||||
"href": "https://github.com/Schepp/box-sizing-polyfill",
|
||||
"licenses": ["LGPL3"],
|
||||
"notes": ["box-sizing: border-box; for IE6 and IE7 via Microsoft's proprietary CSS behavior / .htc-script"]
|
||||
},
|
||||
"borderbox": {
|
||||
"name": "Borderbox for Compass",
|
||||
"authors": ["Richard Herrera"],
|
||||
"href": "https://github.com/doctyper/compass-borderbox",
|
||||
"licenses": [],
|
||||
"notes": ["box-sizing: border-box; polyfill for SASS/Compass. Outputs equivalent CSS for IE6 & 7"]
|
||||
},
|
||||
"css3multicolumnjs": {
|
||||
"name": "css3-multi-column.js",
|
||||
"authors": ["Betley Whitehorne Image", "Cdric Savarese"],
|
||||
"href": "https://github.com/BetleyWhitehorne/CSS3MultiColumn",
|
||||
"licenses": ["CC-GNU LGPL"],
|
||||
"notes": [
|
||||
"Supported Properties: column-count, column-width, column-gap, column-rule.",
|
||||
"Unsupported Properties: column-rule-width (use column-rule instead), column-rule-style (use column-rule instead), column-rule-color (use column-rule instead), column-span, column-width-policy, column-space-distribution"
|
||||
]
|
||||
},
|
||||
"polyfilter": {
|
||||
"name": "Polyfilter",
|
||||
"authors": ["Christian \"Schepp\" Schaefer"],
|
||||
"href": "https://github.com/Schepp/CSS-Filters-Polyfill",
|
||||
"licenses": ["MIT"],
|
||||
"notes": ["CSS filter effects for Chrome 20+, Safari 6+, Firefox 4+, IE 6 - 9 and some mobile browsers."]
|
||||
},
|
||||
"flexie": {
|
||||
"name": "Flexie",
|
||||
"authors": ["Richard Herrera"],
|
||||
"href": "http://github.com/doctyper/flexie",
|
||||
"licenses": ["MIT"],
|
||||
"notes": ["Flexible box model - old spec from 2009. (flexbox) Supports: box-orient, box-align, box-direction, box-pack, box-flex, box-ordinal-group"]
|
||||
},
|
||||
"es5shim": {
|
||||
"name": "ES5 Shim",
|
||||
"href": "https://github.com/kriskowal/es5-shim",
|
||||
"licenses": ["MIT"]
|
||||
},
|
||||
"es5sham": {
|
||||
"name": "ES5 Sham",
|
||||
"href": "https://github.com/kriskowal/es5-shim",
|
||||
"notes": ["Adds the rest of Object, read carefully before using"],
|
||||
"licenses": ["MIT"]
|
||||
},
|
||||
"es6shim": {
|
||||
"name": "ES6 Shim",
|
||||
"href": "https://github.com/paulmillr/es6-shim",
|
||||
"licenses": ["MIT"]
|
||||
},
|
||||
"html5gears": {
|
||||
"name": "html5-gears",
|
||||
"authors": ["Brad Neuberg"],
|
||||
"href": "https://code.google.com/p/html5-gears/",
|
||||
"licenses": ["Apache2"]
|
||||
},
|
||||
"blobjs": {
|
||||
"name": "Blob.js",
|
||||
"authors": ["Eli Grey"],
|
||||
"href": "https://github.com/eligrey/Blob.js",
|
||||
"licenses": ["MIT"]
|
||||
},
|
||||
"flashcanvas": {
|
||||
"name": "FlashCanvas",
|
||||
"authors": ["Shinya Muramatsu"],
|
||||
"href": "http://flashcanvas.net/",
|
||||
"licenses": ["MIT"]
|
||||
},
|
||||
"excanvas": {
|
||||
"name": "Explorer Canvas",
|
||||
"authors": ["Erik Arvidsson"],
|
||||
"href": "https://code.google.com/p/explorercanvas/",
|
||||
"licenses": ["Apache2"]
|
||||
},
|
||||
"slcanvas": {
|
||||
"name": "Silverlight HTML 5 Canvas",
|
||||
"href": "http://slcanvas.codeplex.com/",
|
||||
"licenses": ["Microsoft Public License (Ms-PL)"]
|
||||
},
|
||||
"fxcanvas": {
|
||||
"name": "fxCanvas",
|
||||
"authors": ["Evgeny Burzak"],
|
||||
"href": "http://burzak.com/proj/fxcanvas/",
|
||||
"licenses": ["MIT"]
|
||||
},
|
||||
"canvastext": {
|
||||
"name": "canvas-text",
|
||||
"authors": ["Fabien Ménager"],
|
||||
"href": "https://code.google.com/p/canvas-text/",
|
||||
"licenses": ["MIT"]
|
||||
},
|
||||
"jquery-contextmenu": {
|
||||
"name": "jQuery-contextMenu",
|
||||
"authors": ["Rodney Rehm", "Björn Brala"],
|
||||
"href": "https://github.com/swisnl/jQuery-contextMenu",
|
||||
"licenses": ["MIT", "GPL3"]
|
||||
},
|
||||
"pmxdr": {
|
||||
"name": "pmxdr",
|
||||
"authors": ["Eli Grey"],
|
||||
"href": "https://github.com/eligrey/pmxdr",
|
||||
"notes": ["Implements a CORS-compliant cross-domain XMLHttpRequest with postMessage. Note that sites being requested must have a pmxdr host."],
|
||||
"licenses": ["MIT"]
|
||||
},
|
||||
"ppx": {
|
||||
"name": "postmessage-proxied-xhr",
|
||||
"authors": ["Atul Varma"],
|
||||
"href": "https://github.com/toolness/postmessage-proxied-xhr",
|
||||
"licenses": ["MIT"]
|
||||
},
|
||||
"flxhr": {
|
||||
"name": "flXHR",
|
||||
"authors": ["Kyle Simpson"],
|
||||
"href": "https://github.com/flensed/flXHR",
|
||||
"licenses": ["MIT"]
|
||||
},
|
||||
"dropfile": {
|
||||
"name": "dropfile",
|
||||
"authors": ["Andrew Dodson"],
|
||||
"href": "https://github.com/MrSwitch/dropfile",
|
||||
"licenses": ["MIT"]
|
||||
},
|
||||
"moxie": {
|
||||
"name": "mOxie",
|
||||
"authors": ["Moxiecode"],
|
||||
"href": "https://github.com/moxiecode/moxie",
|
||||
"licenses": ["GPL2"]
|
||||
},
|
||||
"fileapi": {
|
||||
"name": "FileAPI",
|
||||
"authors": ["Konstantin Lebedev", "Demidov Vladimir"],
|
||||
"href": "https://github.com/mailru/FileAPI",
|
||||
"licenses": ["MIT"]
|
||||
},
|
||||
"jdataview": {
|
||||
"name": "jDataView",
|
||||
"authors": ["Christopher Chedeau", "Ingvar Stepanyan"],
|
||||
"href": "https://github.com/jDataView/jDataView/",
|
||||
"licenses": ["WTFPL"]
|
||||
},
|
||||
"screenfulljs": {
|
||||
"name": "screenfull.js",
|
||||
"authors": ["Sindre Sorhus"],
|
||||
"href": "https://github.com/sindresorhus/screenfull.js",
|
||||
"licenses": ["MIT"]
|
||||
},
|
||||
"geo-location-javascript": {
|
||||
"name": "geo-location-javascript",
|
||||
"authors": ["whoisstan"],
|
||||
"href": "https://code.google.com/p/geo-location-javascript/",
|
||||
"notes": ["Mobile-centric: uses non-standard Blackberry and WebOS tricks"],
|
||||
"licenses": ["MIT"]
|
||||
},
|
||||
"geolocation-api-polyfill": {
|
||||
"name": "Geolocation-API-Polyfill",
|
||||
"authors": ["Manuel Bieh"],
|
||||
"href": "https://github.com/manuelbieh/Geolocation-API-Polyfill",
|
||||
"licenses": ["LGPL"]
|
||||
},
|
||||
"jquery-hashchange": {
|
||||
"name": "jQuery hashchange event",
|
||||
"authors": ["Ben Alman"],
|
||||
"href": "http://benalman.com/projects/jquery-hashchange-plugin/",
|
||||
"licenses": ["MIT", "GPL2"]
|
||||
},
|
||||
"moo-historymanager": {
|
||||
"name": "HistoryManager Mootools Plugin",
|
||||
"authors": ["Arieh Glazer"],
|
||||
"href": "http://mootools.net/forge/p/historymanager/",
|
||||
"licenses": ["MIT"]
|
||||
},
|
||||
"jquery-ajaxy": {
|
||||
"name": "jQuery Ajaxy",
|
||||
"authors": ["Benjamin Lupton"],
|
||||
"href": "https://github.com/balupton/jquery-ajaxy",
|
||||
"licenses": ["MIT"]
|
||||
},
|
||||
"hasher": {
|
||||
"name": "Hasher",
|
||||
"authors": ["Miller Medeiros"],
|
||||
"href": "https://github.com/millermedeiros/hasher/",
|
||||
"licenses": ["MIT"]
|
||||
},
|
||||
"shistory": {
|
||||
"name": "sHistory",
|
||||
"authors": ["Andrew Udvare"],
|
||||
"href": "https://github.com/tatsh/sHistory",
|
||||
"licenses": ["MIT"]
|
||||
},
|
||||
"historyjs": {
|
||||
"name": "History.js",
|
||||
"authors": ["Benjamin Lupton"],
|
||||
"href": "https://github.com/browserstate/history.js",
|
||||
"licenses": ["BSD"]
|
||||
},
|
||||
"html5historyapi": {
|
||||
"name": "HTML5 History API",
|
||||
"authors": ["Dmitrii Pakhtinov"],
|
||||
"href": "https://github.com/devote/HTML5-History-API",
|
||||
"licenses": ["GPL3", "MIT"]
|
||||
},
|
||||
"indexeddb": {
|
||||
"name": "IndexedDB",
|
||||
"authors": ["Parashuram"],
|
||||
"href": "http://nparashuram.com/IndexedDBShim/",
|
||||
"licenses": ["GPL2", "BSD"]
|
||||
},
|
||||
"jquerytools": {
|
||||
"name": "jQuery Tools",
|
||||
"href": "http://jquerytools.org",
|
||||
"licenses": ["public domain"]
|
||||
},
|
||||
"webshims": {
|
||||
"name": "Webshims",
|
||||
"authors": ["Alexander Farkas"],
|
||||
"href": "http://afarkas.github.io/webshim/demos/",
|
||||
"licenses": ["MIT"]
|
||||
},
|
||||
"h5f": {
|
||||
"name": "H5F",
|
||||
"authors": ["Ryan Seddon"],
|
||||
"href": "https://github.com/ryanseddon/H5F",
|
||||
"licenses": ["MIT"]
|
||||
},
|
||||
"webforms2": {
|
||||
"name": "Web Forms 2.0",
|
||||
"authors": ["Weston Ruter"],
|
||||
"href": "https://github.com/westonruter/webforms2",
|
||||
"licenses": ["MIT", "GPL2"]
|
||||
},
|
||||
"nwxforms": {
|
||||
"name": "NWX Forms",
|
||||
"authors": ["Diego Perini"],
|
||||
"href": "https://github.com/dperini/nwxforms",
|
||||
"licenses": ["MIT"]
|
||||
},
|
||||
"html5formsjs": {
|
||||
"name": "HTML5Forms.js",
|
||||
"authors": ["Zoltan Dulac"],
|
||||
"href": "https://github.com/zoltan-dulac/html5Forms.js"
|
||||
},
|
||||
"fdslider": {
|
||||
"name": "fd-slider",
|
||||
"authors": ["Brian McAllister"],
|
||||
"href": "https://github.com/freqdec/fd-slider",
|
||||
"licenses": ["MIT"]
|
||||
},
|
||||
"html5slider": {
|
||||
"name": "html5slider",
|
||||
"authors": ["Frank Yan"],
|
||||
"href": "https://github.com/fryn/html5slider",
|
||||
"licenses": ["MIT"]
|
||||
},
|
||||
"number-polyfill": {
|
||||
"name": "Number polyfill",
|
||||
"authors": ["jonstipe"],
|
||||
"href": "https://github.com/jonstipe/number-polyfill",
|
||||
"licenses": ["MIT"]
|
||||
},
|
||||
"galleryhtml5forms": {
|
||||
"name": "YUI Gallery HTML5 Forms",
|
||||
"authors": ["Matt Snider"],
|
||||
"href": "http://yuilibrary.com/gallery/show/html5-forms",
|
||||
"licenses": ["BSD"]
|
||||
},
|
||||
"jscolor": {
|
||||
"name": "JSColor",
|
||||
"authors": ["Johannes Jörg Schmidt"],
|
||||
"href": "https://github.com/jo/JSColor",
|
||||
"licenses": ["LGPL"]
|
||||
},
|
||||
"html5formshim": {
|
||||
"name": "HTML5 Form Shim",
|
||||
"authors": ["Dmitry Sheiko"],
|
||||
"href": "https://github.com/dsheiko/HTML5-Form-Shim",
|
||||
"licenses": ["MIT"]
|
||||
},
|
||||
"selectedoptionsjs": {
|
||||
"name": "selectedOptions.js",
|
||||
"authors": ["Brett Zamir"],
|
||||
"href": "https://gist.github.com/brettz9/4212217",
|
||||
"licenses": ["MIT", "GPL", "public domain"]
|
||||
},
|
||||
"formvalidationjs": {
|
||||
"name": "formvalidation.js",
|
||||
"authors": ["Maksim Chemerisuk"],
|
||||
"href": "https://github.com/chemerisuk/formvalidation.js",
|
||||
"licenses": ["MIT"]
|
||||
},
|
||||
"json2": {
|
||||
"name": "JSON2",
|
||||
"authors": ["Douglas Crockford"],
|
||||
"href": "https://github.com/douglascrockford/JSON-js",
|
||||
"licenses": ["public domain"]
|
||||
},
|
||||
"mathjax": {
|
||||
"name": "MathJax",
|
||||
"authors": ["Davide P. Cervone"],
|
||||
"href": "http://www.mathjax.org/",
|
||||
"licenses": ["Apache2"]
|
||||
},
|
||||
"visibilityjs": {
|
||||
"name": "Visibility.js",
|
||||
"authors": ["Andrey Sitnik"],
|
||||
"href": "https://github.com/ai/visibility.js",
|
||||
"licenses": ["GPL3"]
|
||||
},
|
||||
"visiblyjs": {
|
||||
"name": "visibly.js",
|
||||
"authors": ["Addy Osmani"],
|
||||
"href": "https://github.com/addyosmani/visibly.js",
|
||||
"licenses": ["MIT"]
|
||||
},
|
||||
"jquery-visibility": {
|
||||
"name": "Page Visibility shim for jQuery",
|
||||
"authors": ["Mathias Bynens"],
|
||||
"href": "https://github.com/mathiasbynens/jquery-visibility",
|
||||
"licenses": ["MIT", "GPL"]
|
||||
},
|
||||
"notificationjs": {
|
||||
"name": "notification.js",
|
||||
"authors": ["Andrew Dodson"],
|
||||
"href": "http://adodson.com/notification.js/",
|
||||
"licenses": ["MIT"]
|
||||
},
|
||||
"perfnow": {
|
||||
"name": "perf.now() polyfill",
|
||||
"authors": ["Paul Irish"],
|
||||
"href": "https://gist.github.com/paulirish/5438650",
|
||||
"licenses": ["MIT"]
|
||||
},
|
||||
"easyxdm": {
|
||||
"name": "easyXDM",
|
||||
"authors": ["Sean Kinsey"],
|
||||
"href": "http://easyxdm.net/wp/",
|
||||
"notes": ["Implements XDM and RPC in most browsers since IE6. Also ships with an endpoint for exposing ajax across the domain boundary."],
|
||||
"licenses": ["MIT"]
|
||||
},
|
||||
"postmessage-jquery": {
|
||||
"name": "postMessage jquery plugin",
|
||||
"authors": ["Ben Alman"],
|
||||
"href": "http://benalman.com/projects/jquery-postmessage-plugin/",
|
||||
"licenses": ["MIT", "GPL2"]
|
||||
},
|
||||
"raf": {
|
||||
"name": "requestAnimationFrame polyfill",
|
||||
"authors": ["Erik Möller"],
|
||||
"href": "https://gist.github.com/paulirish/1579671",
|
||||
"licenses": ["MIT"]
|
||||
},
|
||||
"cupcake": {
|
||||
"name": "CupCake.js",
|
||||
"authors": ["Rivindu Perera"],
|
||||
"href": "https://github.com/rivindu/cupcakejs",
|
||||
"licenses": ["MIT"]
|
||||
},
|
||||
"customelements": {
|
||||
"name": "Custom Elements",
|
||||
"authors": ["Webcomponents"],
|
||||
"href": "https://github.com/webcomponents/custom-elements",
|
||||
"licenses": ["BSD"]
|
||||
},
|
||||
"storagepolyfill": {
|
||||
"name": "Storage Polyfill",
|
||||
"authors": ["Remy Sharp"],
|
||||
"href": "http://gist.github.com/350433",
|
||||
"notes": [],
|
||||
"licenses": ["MIT"]
|
||||
},
|
||||
"sessionstorage": {
|
||||
"name": "sessionstorage",
|
||||
"authors": ["Andrea Giammarchi"],
|
||||
"href": "http://gist.github.com/350433",
|
||||
"licenses": ["MIT"]
|
||||
},
|
||||
"amplifyjs": {
|
||||
"name": "Amplify.js",
|
||||
"authors": ["appendTo"],
|
||||
"href": "http://amplifyjs.com/",
|
||||
"licenses": ["MIT", "GPL2"]
|
||||
},
|
||||
"yui-cacheoffline": {
|
||||
"name": "YUI3 CacheOffline",
|
||||
"authors": ["YUI Team"],
|
||||
"href": "http://yuilibrary.com/yui/docs/cache/#offline",
|
||||
"licenses": ["BSD"]
|
||||
},
|
||||
"scoped-styles": {
|
||||
"name": "Scoped Styles",
|
||||
"authors": ["Simon Madine"],
|
||||
"notes": ["jQuery Plugin to enable the scoped attribute on style blocks so they only affect their parent element's children."],
|
||||
"href": "http://github.com/thingsinjars/jQuery-Scoped-CSS-plugin",
|
||||
"licenses": ["MIT"]
|
||||
},
|
||||
"svgweb": {
|
||||
"name": "SVG Web",
|
||||
"authors": ["Rick Masters", "Brad Neuberg", "James Hight"],
|
||||
"href": "https://code.google.com/p/svgweb/",
|
||||
"licenses": ["Apache2"]
|
||||
},
|
||||
"raphael": {
|
||||
"name": "Raphaël",
|
||||
"authors": ["Dmitry Baranovsky"],
|
||||
"href": "http://raphaeljs.com/",
|
||||
"notes": ["Abstracted API. adds features. fallback for IE via VML"],
|
||||
"licenses": ["MIT"]
|
||||
},
|
||||
"amplesdk": {
|
||||
"name": "Ample SDK",
|
||||
"authors": ["Sergey Ilinsky"],
|
||||
"href": "http://www.amplesdk.com/examples/svg/",
|
||||
"licenses": ["MIT", "GPL2"]
|
||||
},
|
||||
"canvg": {
|
||||
"name": "canvg",
|
||||
"authors": ["Gabe Lerner"],
|
||||
"href": "http://code.google.com/p/canvg/",
|
||||
"notes": ["Writes SVG to canvas. Good for Android"],
|
||||
"licenses": ["MIT"]
|
||||
},
|
||||
"svg-boilerplate": {
|
||||
"name": "SVG Boilerplate",
|
||||
"authors": ["Robin Berjon"],
|
||||
"href": "https://github.com/darobin/svgboilerplate",
|
||||
"notes": ["Alpha and still buggy, but handle multiple concurrent SVG shims together"],
|
||||
"licenses": ["public domain"]
|
||||
},
|
||||
"sie": {
|
||||
"name": "SIE SVG library",
|
||||
"authors": ["Hiroki Dehara"],
|
||||
"href": "http://sie.sourceforge.jp/",
|
||||
"notes": ["Fallback to VML for oldIE"],
|
||||
"licenses": ["Mozilla1.1", "GPL2", "LGPL2.1"]
|
||||
},
|
||||
"dojogfx": {
|
||||
"name": "Dojo GFX",
|
||||
"authors": ["Eugene Lazutkin", "Kun Xi", "Chris Mitchell"],
|
||||
"href": "http://docs.dojocampus.org/dojox/gfx/",
|
||||
"notes": ["Fallback via VML, Canvas, Silverlight and Flash"],
|
||||
"licenses": ["BSD", "AFL"]
|
||||
},
|
||||
"fabricjs": {
|
||||
"name": "fabric.js",
|
||||
"authors": ["Juriy Zaytsev (@kangax)"],
|
||||
"href": "https://github.com/kangax/fabric.js",
|
||||
"notes": ["Can render SVG via canvas"],
|
||||
"licenses": ["MIT"]
|
||||
},
|
||||
"inline-svg-polyfill": {
|
||||
"name": "inline SVG polyfill",
|
||||
"authors": ["Marc Stalfoort (@mstalfoort)"],
|
||||
"href": "https://gist.github.com/mstalfoort/1293822",
|
||||
"licenses": ["MIT"]
|
||||
},
|
||||
"joshuabell-polyfill": {
|
||||
"name": "polyfill",
|
||||
"authors": ["Joshua Bell"],
|
||||
"href": "https://github.com/inexorabletash/polyfill",
|
||||
"licenses": ["various"]
|
||||
},
|
||||
"text-overflow": {
|
||||
"name": "jQuery text-overflow",
|
||||
"authors": ["Devon Govett"],
|
||||
"href": "http://ajaxian.com/archives/text-overflow-for-firefox-via-jquery",
|
||||
"licenses": ["MIT"]
|
||||
},
|
||||
"html5media": {
|
||||
"name": "html5media",
|
||||
"authors": ["Dave Hall"],
|
||||
"href": "https://github.com/etianen/html5media",
|
||||
"licenses": ["GPL3"]
|
||||
},
|
||||
"mediaelementjs": {
|
||||
"name": "MediaElement.js",
|
||||
"authors": ["John Dyer"],
|
||||
"href": "http://mediaelementjs.com/",
|
||||
"licenses": ["MIT"]
|
||||
},
|
||||
"sublimevideo": {
|
||||
"name": "SublimeVideo",
|
||||
"authors": ["Jilion SA"],
|
||||
"href": "http://sublimevideo.net/",
|
||||
"licenses": ["proprietary"]
|
||||
},
|
||||
"videojs": {
|
||||
"name": "video.js",
|
||||
"authors": ["Steve Heffernan"],
|
||||
"href": "http://videojs.com/",
|
||||
"licenses": ["Apache2"]
|
||||
},
|
||||
"leanbackplayer": {
|
||||
"name": "LeanBack Player",
|
||||
"authors": ["Kapelan Medien GmbH"],
|
||||
"href": "http://www.leanbackplayer.com/",
|
||||
"licenses": ["GPL3"]
|
||||
},
|
||||
"videoforeverybody": {
|
||||
"name": "Video For Everybody",
|
||||
"authors": ["Kroc Camen"],
|
||||
"href": "http://camendesign.com/code/video_for_everybody",
|
||||
"licenses": ["public domain"]
|
||||
},
|
||||
"webintents": {
|
||||
"name": "Web Intents JavaScript Shim",
|
||||
"authors": ["Paul Kinlan"],
|
||||
"href": "http://webintents.org/#javascriptshim",
|
||||
"licenses": ["Apache2"]
|
||||
},
|
||||
"jebgl": {
|
||||
"name": "jebgl",
|
||||
"authors": ["Martin Qvist"],
|
||||
"href": "http://code.google.com/p/jebgl/",
|
||||
"licenses": ["MIT"]
|
||||
},
|
||||
"cwebgl": {
|
||||
"name": "cwebgl",
|
||||
"authors": ["Cimaron Shanahan"],
|
||||
"href": "http://code.google.com/p/cwebgl/",
|
||||
"licenses": ["MIT"]
|
||||
},
|
||||
"iewebgl": {
|
||||
"name": "IEWebGL",
|
||||
"href": "http://iewebgl.com/",
|
||||
"licenses": ["MIT"]
|
||||
},
|
||||
"sockjs": {
|
||||
"name": "SockJS",
|
||||
"authors": ["Bryce Kahle"],
|
||||
"href": "https://github.com/sockjs/sockjs-client",
|
||||
"licenses": ["MIT"]
|
||||
},
|
||||
"socketio": {
|
||||
"name": "socket.io",
|
||||
"authors": ["Guillermo Rauch"],
|
||||
"href": "http://socket.io/",
|
||||
"licenses": ["MIT"]
|
||||
},
|
||||
"kaazing-websocket-gateway": {
|
||||
"name": "Kaazing WebSocket Gateway",
|
||||
"href": "http://kaazing.com/products/kaazing-websocket-gateway/",
|
||||
"licenses": ["proprietary"]
|
||||
},
|
||||
"websocketjs": {
|
||||
"name": "web-socket-js",
|
||||
"authors": ["Hiroshi Ichikawa"],
|
||||
"href": "http://github.com/gimite/web-socket-js/",
|
||||
"licenses": ["BSD"]
|
||||
},
|
||||
"atmosphere": {
|
||||
"name": "atmosphere jQuery plugin",
|
||||
"authors": ["Jeanfrancois Arcand"],
|
||||
"href": "http://jfarcand.wordpress.com/2010/06/15/using-atmospheres-jquery-plug-in-to-build-applicationsupporting-both-websocket-and-comet/",
|
||||
"licenses": ["Apache2"]
|
||||
},
|
||||
"graceful-websocket": {
|
||||
"name": "Graceful WebSocket jQuery plugin",
|
||||
"authors": ["David Lindkvist"],
|
||||
"href": "https://github.com/ffdead/jquery-graceful-websocket",
|
||||
"licenses": ["MIT"]
|
||||
},
|
||||
"portal": {
|
||||
"name": "Portal",
|
||||
"authors": ["Donghwan Kim"],
|
||||
"href": "https://github.com/flowersinthesand/portal",
|
||||
"licenses": ["Apache2"]
|
||||
},
|
||||
"datachannel": {
|
||||
"name": "DataChannel",
|
||||
"authors": ["Jesús Leganés Combarro"],
|
||||
"href": "https://github.com/piranna/DataChannel-polyfill",
|
||||
"licenses": ["GPL3"]
|
||||
},
|
||||
"getusermedia": {
|
||||
"name": "getUserMedia.js",
|
||||
"authors": ["Addy Osmani"],
|
||||
"href": "https://github.com/addyosmani/getUserMedia.js",
|
||||
"licenses": ["MIT"]
|
||||
},
|
||||
"fakeworker": {
|
||||
"name": "fakeworker.js",
|
||||
"authors": ["Shumpei Shiraishi"],
|
||||
"href": "https://code.google.com/p/fakeworker-js/",
|
||||
"licenses": ["Apache2"]
|
||||
},
|
||||
"html5shims": {
|
||||
"name": "web worker api shim",
|
||||
"authors": ["Jonathan 'J5' Cook"],
|
||||
"href": "https://code.google.com/p/html5-shims/",
|
||||
"licenses": ["Apache2"]
|
||||
},
|
||||
"polycrypt": {
|
||||
"name": "PolyCrypt",
|
||||
"authors": ["BBN Technologies"],
|
||||
"href": "http://polycrypt.net/",
|
||||
"licenses": ["BSD"]
|
||||
},
|
||||
"webanimationsjs": {
|
||||
"name": "web-animations-js",
|
||||
"authors": ["web-animations"],
|
||||
"href": "https://github.com/web-animations/web-animations-js",
|
||||
"licenses": ["Apache2"]
|
||||
},
|
||||
"shumway": {
|
||||
"name": "JavaScript Flash VM",
|
||||
"authors": ["Mozilla Foundation"],
|
||||
"href": "https://github.com/mozilla/shumway",
|
||||
"licenses": ["Apache2"]
|
||||
},
|
||||
"maxlength": {
|
||||
"name": "maxlength plugin",
|
||||
"authors": ["Remy Sharp"],
|
||||
"href": "http://remysharp.com/2008/06/30/maxlength-plugin/",
|
||||
"licenses": ["CC SA"]
|
||||
},
|
||||
"weakmap": {
|
||||
"name": "ES6 WeakMap",
|
||||
"authors": ["Google Inc."],
|
||||
"href": "https://github.com/Polymer/WeakMap",
|
||||
"licenses": ["BSD"]
|
||||
},
|
||||
"eventlistener": {
|
||||
"name": "EventListener",
|
||||
"authors": ["Jonathan Neal"],
|
||||
"href": "https://github.com/jonathantneal/EventListener",
|
||||
"licenses": ["MIT"]
|
||||
},
|
||||
"es6promises": {
|
||||
"name": "ES6-Promises",
|
||||
"authors": ["Jake Archibald"],
|
||||
"href": "https://github.com/jakearchibald/ES6-Promises",
|
||||
"licenses": ["MIT"]
|
||||
},
|
||||
"es6symbol":{
|
||||
"name": "ES6-Symbol",
|
||||
"authors": ["Mariusz Nowak"],
|
||||
"href": "https://github.com/medikoo/es6-symbol",
|
||||
"licenses": ["ISC"]
|
||||
},
|
||||
"urlparser": {
|
||||
"authors": ["Google Inc."],
|
||||
"href": "https://github.com/Polymer/URL",
|
||||
"licenses": ["BSD"],
|
||||
"name": "Polymer URL parser polyfill"
|
||||
},
|
||||
"css-selector-engine": {
|
||||
"name": "CSS Selector Engine",
|
||||
"authors": ["Егор Халимоненко"],
|
||||
"href": "https://github.com/termi/CSS_selector_engine",
|
||||
"licenses": ["MIT"]
|
||||
},
|
||||
"mutationobservers": {
|
||||
"authors": ["Google Inc."],
|
||||
"href": "https://github.com/Polymer/MutationObservers",
|
||||
"licenses": ["BSD"],
|
||||
"name": "Mutation Observers polyfill"
|
||||
},
|
||||
"polymer-htmlimports": {
|
||||
"authors": ["Google Inc."],
|
||||
"href": "https://github.com/polymer/HTMLImports",
|
||||
"licenses": ["BSD"],
|
||||
"name": "Polymer HTMLImports polyfill"
|
||||
},
|
||||
"matchmediajs": {
|
||||
"authors": ["Scott Jehl", "Paul Irish", "Nicholas Zakas"],
|
||||
"href": "https://github.com/paulirish/matchMedia.js/",
|
||||
"licenses": ["MIT"],
|
||||
"name": "matchMedia.js"
|
||||
},
|
||||
"fetch": {
|
||||
"authors": ["Github"],
|
||||
"href": "https://github.com/github/fetch",
|
||||
"licenses": ["MIT"],
|
||||
"name": "window.fetch polyfill"
|
||||
},
|
||||
"base64js": {
|
||||
"authors": ["David Chambers"],
|
||||
"href": "https://github.com/davidchambers/Base64.js",
|
||||
"licenses": ["Apache2", "WTFPL"],
|
||||
"name": "window.atob and window.btoa polyfill"
|
||||
},
|
||||
"scrollsnap": {
|
||||
"authors": ["Clemens Krack"],
|
||||
"href": "https://github.com/ckrack/scrollsnap-polyfill",
|
||||
"licenses": ["MIT"],
|
||||
"name": "scrollsnap-polyfill.js"
|
||||
},
|
||||
"pep": {
|
||||
"authors": ["jQuery Foundation and other contributors"],
|
||||
"href": "https://github.com/jquery/PEP",
|
||||
"licenses": ["MIT"],
|
||||
"name": "pep.js"
|
||||
},
|
||||
"harmony-reflect": {
|
||||
"name": "Proxy Object Polyfill",
|
||||
"authors": ["Tom Van Cutsem"],
|
||||
"href": "https://github.com/tvcutsem/harmony-reflect",
|
||||
"licenses": ["Apache2"]
|
||||
},
|
||||
"avifjs": {
|
||||
"name": "Avif.js",
|
||||
"authors": ["Kagami"],
|
||||
"href": "https://github.com/Kagami/avif.js",
|
||||
"licenses": ["CC0"]
|
||||
}
|
||||
}
|
||||
1
node_modules/chai/CODEOWNERS
generated
vendored
Normal file
1
node_modules/chai/CODEOWNERS
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
* @chaijs/chai
|
||||
58
node_modules/chai/CODE_OF_CONDUCT.md
generated
vendored
Normal file
58
node_modules/chai/CODE_OF_CONDUCT.md
generated
vendored
Normal file
@@ -0,0 +1,58 @@
|
||||
# Contributor Code of Conduct
|
||||
|
||||
> Read in: [Español](http://contributor-covenant.org/version/1/3/0/es/) |
|
||||
[Français](http://contributor-covenant.org/version/1/3/0/fr/) |
|
||||
[Italiano](http://contributor-covenant.org/version/1/3/0/it/) |
|
||||
[Magyar](http://contributor-covenant.org/version/1/3/0/hu/) |
|
||||
[Polskie](http://contributor-covenant.org/version/1/3/0/pl/) |
|
||||
[Português](http://contributor-covenant.org/version/1/3/0/pt/) |
|
||||
[Português do Brasil](http://contributor-covenant.org/version/1/3/0/pt_br/)
|
||||
|
||||
As contributors and maintainers of this project, and in the interest of
|
||||
fostering an open and welcoming community, we pledge to respect all people who
|
||||
contribute through reporting issues, posting feature requests, updating
|
||||
documentation, submitting pull requests or patches, and other activities.
|
||||
|
||||
We are committed to making participation in this project a harassment-free
|
||||
experience for everyone, regardless of level of experience, gender, gender
|
||||
identity and expression, sexual orientation, disability, personal appearance,
|
||||
body size, race, ethnicity, age, religion, or nationality.
|
||||
|
||||
Examples of unacceptable behavior by participants include:
|
||||
|
||||
* The use of sexualized language or imagery
|
||||
* Personal attacks
|
||||
* Trolling or insulting/derogatory comments
|
||||
* Public or private harassment
|
||||
* Publishing other's private information, such as physical or electronic
|
||||
addresses, without explicit permission
|
||||
* Other unethical or unprofessional conduct
|
||||
|
||||
Project maintainers have the right and responsibility to remove, edit, or
|
||||
reject comments, commits, code, wiki edits, issues, and other contributions
|
||||
that are not aligned to this Code of Conduct, or to ban temporarily or
|
||||
permanently any contributor for other behaviors that they deem inappropriate,
|
||||
threatening, offensive, or harmful.
|
||||
|
||||
By adopting this Code of Conduct, project maintainers commit themselves to
|
||||
fairly and consistently applying these principles to every aspect of managing
|
||||
this project. Project maintainers who do not follow or enforce the Code of
|
||||
Conduct may be permanently removed from the project team.
|
||||
|
||||
This Code of Conduct applies both within project spaces and in public spaces
|
||||
when an individual is representing the project or its community.
|
||||
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
||||
reported by contacting a project maintainer at chaijs@keithcirkel.co.uk. All
|
||||
complaints will be reviewed and investigated and will result in a response that
|
||||
is deemed necessary and appropriate to the circumstances. Maintainers are
|
||||
obligated to maintain confidentiality with regard to the reporter of an
|
||||
incident.
|
||||
|
||||
|
||||
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
||||
version 1.3.0, available at
|
||||
[http://contributor-covenant.org/version/1/3/0/][version]
|
||||
|
||||
[homepage]: http://contributor-covenant.org
|
||||
[version]: http://contributor-covenant.org/version/1/3/0/
|
||||
218
node_modules/chai/CONTRIBUTING.md
generated
vendored
Normal file
218
node_modules/chai/CONTRIBUTING.md
generated
vendored
Normal file
@@ -0,0 +1,218 @@
|
||||
# Chai Contribution Guidelines
|
||||
|
||||
We like to encourage you to contribute to the Chai.js repository. This should be as easy as possible for you but there are a few things to consider when contributing. The following guidelines for contribution should be followed if you want to submit a pull request or open an issue.
|
||||
|
||||
Following these guidelines helps to communicate that you respect the time of the developers managing and developing this open source project. In return, they should reciprocate that respect in addressing your issue or assessing patches and features.
|
||||
|
||||
#### Table of Contents
|
||||
|
||||
- [TLDR;](#tldr)
|
||||
- [Contributing](#contributing)
|
||||
- [Bug Reports](#bugs)
|
||||
- [Feature Requests](#features)
|
||||
- [Pull Requests](#pull-requests)
|
||||
- [Releasing](#releasing)
|
||||
- [Support](#support)
|
||||
- [Resources](#resources)
|
||||
- [Core Contributors](#contributors)
|
||||
|
||||
<a name="tldr"></a>
|
||||
## TLDR;
|
||||
|
||||
- Creating an Issue or Pull Request requires a [GitHub](http://github.com) account.
|
||||
- Issue reports should be **clear**, **concise** and **reproducible**. Check to see if your issue has already been resolved in the [master]() branch or already reported in Chai's [GitHub Issue Tracker](https://github.com/chaijs/chai/issues).
|
||||
- Pull Requests must adhere to strict [coding style guidelines](https://github.com/chaijs/chai/wiki/Chai-Coding-Style-Guide).
|
||||
- In general, avoid submitting PRs for new Assertions without asking core contributors first. More than likely it would be better implemented as a plugin.
|
||||
- Additional support is available via the [Google Group](http://groups.google.com/group/chaijs) or on irc.freenode.net#chaijs.
|
||||
- **IMPORTANT**: By submitting a patch, you agree to allow the project owner to license your work under the same license as that used by the project.
|
||||
|
||||
|
||||
|
||||
<a name="contributing"></a>
|
||||
## Contributing
|
||||
|
||||
The issue tracker is the preferred channel for [bug reports](#bugs),
|
||||
[feature requests](#features) and [submitting pull
|
||||
requests](#pull-requests), but please respect the following restrictions:
|
||||
|
||||
* Please **do not** use the issue tracker for personal support requests (use
|
||||
[Google Group](https://groups.google.com/forum/#!forum/chaijs) or IRC).
|
||||
* Please **do not** derail or troll issues. Keep the discussion on topic and
|
||||
respect the opinions of others
|
||||
|
||||
<a name="bugs"></a>
|
||||
### Bug Reports
|
||||
|
||||
A bug is a **demonstrable problem** that is caused by the code in the repository.
|
||||
|
||||
Guidelines for bug reports:
|
||||
|
||||
1. **Use the GitHub issue search** — check if the issue has already been reported.
|
||||
2. **Check if the issue has been fixed** — try to reproduce it using the latest `master` or development branch in the repository.
|
||||
3. **Isolate the problem** — create a test case to demonstrate your issue. Provide either a repo, gist, or code sample to demonstrate you problem.
|
||||
|
||||
A good bug report shouldn't leave others needing to chase you up for more information. Please try to be as detailed as possible in your report. What is your environment? What steps will reproduce the issue? What browser(s) and/or Node.js versions experience the problem? What would you expect to be the outcome? All these details will help people to fix any potential bugs.
|
||||
|
||||
Example:
|
||||
|
||||
> Short and descriptive example bug report title
|
||||
>
|
||||
> A summary of the issue and the browser/OS environment in which it occurs. If suitable, include the steps required to reproduce the bug.
|
||||
>
|
||||
> 1. This is the first step
|
||||
> 2. This is the second step
|
||||
> 3. Further steps, etc.
|
||||
>
|
||||
> `<url>` - a link to the reduced test case OR
|
||||
> ```js
|
||||
> expect(a).to.equal('a');
|
||||
> // code sample
|
||||
> ```
|
||||
>
|
||||
> Any other information you want to share that is relevant to the issue being reported. This might include the lines of code that you have identified as causing the bug, and potential solutions (and your opinions on their merits).
|
||||
|
||||
<a name="features"></a>
|
||||
### Feature Requests
|
||||
|
||||
Feature requests are welcome. But take a moment to find out whether your idea fits with the scope and aims of the project. It's up to *you* to make a strong case to convince the project's developers of the merits of this feature. Please provide as much detail and context as possible.
|
||||
|
||||
Furthermore, since Chai.js has a [robust plugin API](http://chaijs.com/guide/plugins/), we encourage you to publish **new Assertions** as plugins. If your feature is an enhancement to an **existing Assertion**, please propose your changes as an issue prior to opening a pull request. If the core Chai.js contributors feel your plugin would be better suited as a core assertion, they will invite you to open a PR in [chaijs/chai](https://github.com/chaijs/chai).
|
||||
|
||||
<a name="pull-requests"></a>
|
||||
### Pull Requests
|
||||
|
||||
- PRs for new core-assertions are advised against.
|
||||
- PRs for core-assertion bug fixes are always welcome.
|
||||
- PRs for enhancing the interfaces are always welcome.
|
||||
- PRs that increase test coverage are always welcome.
|
||||
- PRs are scrutinized for coding-style.
|
||||
|
||||
Good pull requests - patches, improvements, new features - are a fantastic help. They should remain focused in scope and avoid containing unrelated commits.
|
||||
|
||||
**Please ask first** before embarking on any significant pull request (e.g. implementing features, refactoring code), otherwise you risk spending a lot of time working on something that the project's developers might not want to merge into the project.
|
||||
|
||||
Please adhere to the coding conventions used throughout a project (indentation, accurate comments, etc.) and any other requirements (such as test coverage). Please review the [Chai.js Coding Style Guide](https://github.com/chaijs/chai/wiki/Chai-Coding-Style-Guide).
|
||||
|
||||
Follow this process if you'd like your work considered for inclusion in the project:
|
||||
|
||||
1. [Fork](http://help.github.com/fork-a-repo/) the project, clone your fork, and configure the remotes:
|
||||
|
||||
```bash
|
||||
# Clone your fork of the repo into the current directory
|
||||
git clone https://github.com/<your-username>/<repo-name>
|
||||
# Navigate to the newly cloned directory
|
||||
cd <repo-name>
|
||||
# Assign the original repo to a remote called "upstream"
|
||||
git remote add upstream https://github.com/<upstream-owner>/<repo-name>
|
||||
```
|
||||
|
||||
2. If you cloned a while ago, get the latest changes from upstream:
|
||||
|
||||
```bash
|
||||
git checkout <dev-branch>
|
||||
git pull upstream <dev-branch>
|
||||
```
|
||||
|
||||
3. Create a new topic branch (off the main project development branch) to contain your feature, change, or fix:
|
||||
|
||||
```bash
|
||||
git checkout -b <topic-branch-name>
|
||||
```
|
||||
|
||||
4. Commit your changes in logical chunks. Use Git's [interactive rebase](https://help.github.com/articles/interactive-rebase) feature to tidy up your commits before making them public.
|
||||
|
||||
5. Run you code to make sure it works. If you're still having problems please try to run `make clean` and then test your code again.
|
||||
|
||||
```bash
|
||||
npm test
|
||||
# when finished running tests...
|
||||
git checkout chai.js
|
||||
```
|
||||
|
||||
6. Locally merge (or rebase) the upstream development branch into your topic branch:
|
||||
|
||||
```bash
|
||||
git pull [--rebase] upstream <dev-branch>
|
||||
```
|
||||
|
||||
7. Push your topic branch up to your fork:
|
||||
|
||||
```bash
|
||||
git push origin <topic-branch-name>
|
||||
```
|
||||
|
||||
8. [Open a Pull Request](https://help.github.com/articles/using-pull-requests/) with a clear title and description.
|
||||
|
||||
**IMPORTANT**: By submitting a patch, you agree to allow the project owner to license your work under the same license as that used by the project.
|
||||
|
||||
<a name="releasing"></a>
|
||||
## Releasing
|
||||
|
||||
Releases can be **prepared** by anyone with access to the code.
|
||||
|
||||
Simply run `make release-major`, `make release-minor`, or `make-release-patch`
|
||||
and it will automatically do the following:
|
||||
|
||||
- Build chai.js
|
||||
- Bump the version numbers across the project
|
||||
- Make a commit within git
|
||||
|
||||
All you need to do is push the commit up and make a pull request, one of the core contributors will merge it and publish a release.
|
||||
|
||||
### Publishing a Release
|
||||
|
||||
Anyone who is a core contributor (see the [Core Contributors Heading in the Readme](https://github.com/chaijs/chai#core-contributors)) can publish a release:
|
||||
|
||||
1. Go to the [Releases page on Github](https://github.com/chaijs/chai/releases)
|
||||
2. Hit "Draft a new release" (if you can't see this, you're not a core contributor!)
|
||||
3. Write human-friendly Release Notes based on changelog.
|
||||
- The release title is "x.x.x / YYYY-MM-DD" (where x.x.x is the version number)
|
||||
- If breaking changes, write migration tutorial(s) and reasoning.
|
||||
- Callouts for community contributions (PRs) with links to PR and contributing user.
|
||||
- Callouts for other fixes made by core contributors with links to issue.
|
||||
4. Hit "Save Draft" and get other core contributors to check your work, or alternatively hit "Publish release"
|
||||
5. That's it!
|
||||
|
||||
<a name="support"></a>
|
||||
## Support
|
||||
|
||||
<a name="resources"></a>
|
||||
### Resources
|
||||
|
||||
For most of the documentation you are going to want to visit [ChaiJS.com](http://chaijs.com).
|
||||
|
||||
- [Getting Started Guide](http://chaijs.com/guide/)
|
||||
- [API Reference](http://chaijs.com/api/)
|
||||
- [Plugins](http://chaijs.com/plugins/)
|
||||
|
||||
Alternatively, the [wiki](https://github.com/chaijs/chai/wiki) might be what you are looking for.
|
||||
|
||||
- [Chai Coding Style Guide](https://github.com/chaijs/chai/wiki/Chai-Coding-Style-Guide)
|
||||
- [Third-party Resources](https://github.com/chaijs/chai/wiki/Third-Party-Resources)
|
||||
|
||||
Or finally, you may find a core-contributor or like-minded developer in any of our support channels.
|
||||
|
||||
- IRC: irc.freenode.org #chaijs
|
||||
- [Mailing List / Google Group](https://groups.google.com/forum/#!forum/chaijs)
|
||||
|
||||
<a name="contributors"></a>
|
||||
### Core Contributors
|
||||
|
||||
Feel free to reach out to any of the core-contributors with you questions or concerns. We will do our best to respond in a timely manner.
|
||||
|
||||
- Jake Luer
|
||||
- GH: [@logicalparadox](https://github.com/logicalparadox)
|
||||
- TW: [@jakeluer](http://twitter.com/jakeluer)
|
||||
- IRC: logicalparadox
|
||||
- Veselin Todorov
|
||||
- GH: [@vesln](https://github.com/vesln/)
|
||||
- TW: [@vesln](http://twitter.com/vesln)
|
||||
- IRC: vesln
|
||||
- Keith Cirkel
|
||||
- GH: [@keithamus](https://github.com/keithamus)
|
||||
- TW: [@keithamus](http://twitter.com/keithamus)
|
||||
- IRC: keithamus
|
||||
- Lucas Fernandes da Costa
|
||||
- GH: [@lucasfcosta](https://github.com/lucasfcosta)
|
||||
- TW: [@lfernandescosta](https://twitter.com/lfernandescosta)
|
||||
- IRC: lucasfcosta
|
||||
1059
node_modules/chai/History.md
generated
vendored
Normal file
1059
node_modules/chai/History.md
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
21
node_modules/chai/LICENSE
generated
vendored
Normal file
21
node_modules/chai/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2017 Chai.js Assertion Library
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
212
node_modules/chai/README.md
generated
vendored
Normal file
212
node_modules/chai/README.md
generated
vendored
Normal file
@@ -0,0 +1,212 @@
|
||||
<h1 align=center>
|
||||
<a href="http://chaijs.com" title="Chai Documentation">
|
||||
<img alt="ChaiJS" src="http://chaijs.com/img/chai-logo.png">
|
||||
</a>
|
||||
<br>
|
||||
chai
|
||||
</h1>
|
||||
|
||||
<p align=center>
|
||||
Chai is a BDD / TDD assertion library for <a href="http://nodejs.org">node</a> and the browser that can be delightfully paired with any javascript testing framework.
|
||||
</p>
|
||||
|
||||
<p align=center>
|
||||
<a href="./LICENSE">
|
||||
<img
|
||||
alt="license:mit"
|
||||
src="https://img.shields.io/badge/license-mit-green.svg?style=flat-square"
|
||||
/>
|
||||
</a>
|
||||
<a href="https://github.com/chaijs/chai/releases">
|
||||
<img
|
||||
alt="tag:?"
|
||||
src="https://img.shields.io/github/tag/chaijs/chai.svg?style=flat-square"
|
||||
/>
|
||||
</a>
|
||||
<a href="https://www.npmjs.com/package/chai">
|
||||
<img
|
||||
alt="node:?"
|
||||
src="https://img.shields.io/badge/node-%3E=4.0-blue.svg?style=flat-square"
|
||||
/>
|
||||
</a>
|
||||
<br/>
|
||||
<a href="https://saucelabs.com/u/chaijs">
|
||||
<img
|
||||
alt="Selenium Test Status"
|
||||
src="https://saucelabs.com/browser-matrix/chaijs.svg"
|
||||
/>
|
||||
</a>
|
||||
<br/>
|
||||
<a href="https://www.npmjs.com/packages/chai">
|
||||
<img
|
||||
alt="downloads:?"
|
||||
src="https://img.shields.io/npm/dm/chai.svg?style=flat-square"
|
||||
/>
|
||||
</a>
|
||||
<a href="https://travis-ci.org/chaijs/chai">
|
||||
<img
|
||||
alt="build:?"
|
||||
src="https://img.shields.io/travis/chaijs/chai/master.svg?style=flat-square"
|
||||
/>
|
||||
</a>
|
||||
<a href="https://codecov.io/gh/chaijs/chai">
|
||||
<img
|
||||
alt="coverage:?"
|
||||
src="https://img.shields.io/codecov/c/github/chaijs/chai.svg?style=flat-square"
|
||||
/>
|
||||
</a>
|
||||
<a href="">
|
||||
<img
|
||||
alt="devDependencies:?"
|
||||
src="https://img.shields.io/david/chaijs/chai.svg?style=flat-square"
|
||||
/>
|
||||
</a>
|
||||
<br/>
|
||||
<a href="https://chai-slack.herokuapp.com/">
|
||||
<img
|
||||
alt="Join the Slack chat"
|
||||
src="https://img.shields.io/badge/slack-join%20chat-E2206F.svg?style=flat-square"
|
||||
/>
|
||||
</a>
|
||||
<a href="https://gitter.im/chaijs/chai">
|
||||
<img
|
||||
alt="Join the Gitter chat"
|
||||
src="https://img.shields.io/badge/gitter-join%20chat-D0104D.svg?style=flat-square"
|
||||
/>
|
||||
</a>
|
||||
<a href="https://opencollective.com/chaijs">
|
||||
<img
|
||||
alt="OpenCollective Backers"
|
||||
src="https://opencollective.com/chaijs/backers/badge.svg?style=flat-square"
|
||||
/>
|
||||
</a>
|
||||
</p>
|
||||
|
||||
For more information or to download plugins, view the [documentation](http://chaijs.com).
|
||||
|
||||
## What is Chai?
|
||||
|
||||
Chai is an _assertion library_, similar to Node's built-in `assert`. It makes testing much easier by giving you lots of assertions you can run against your code.
|
||||
|
||||
## Installation
|
||||
|
||||
### Node.js
|
||||
|
||||
`chai` is available on [npm](http://npmjs.org). To install it, type:
|
||||
|
||||
$ npm install --save-dev chai
|
||||
|
||||
### Browsers
|
||||
|
||||
You can also use it within the browser; install via npm and use the `chai.js` file found within the download. For example:
|
||||
|
||||
```html
|
||||
<script src="./node_modules/chai/chai.js"></script>
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
Import the library in your code, and then pick one of the styles you'd like to use - either `assert`, `expect` or `should`:
|
||||
|
||||
```js
|
||||
var chai = require('chai');
|
||||
var assert = chai.assert; // Using Assert style
|
||||
var expect = chai.expect; // Using Expect style
|
||||
var should = chai.should(); // Using Should style
|
||||
```
|
||||
|
||||
### Pre-Native Modules Usage (_registers the chai testing style globally_)
|
||||
|
||||
```js
|
||||
require('chai/register-assert'); // Using Assert style
|
||||
require('chai/register-expect'); // Using Expect style
|
||||
require('chai/register-should'); // Using Should style
|
||||
```
|
||||
|
||||
### Pre-Native Modules Usage (_as local variables_)
|
||||
|
||||
```js
|
||||
const { assert } = require('chai'); // Using Assert style
|
||||
const { expect } = require('chai'); // Using Expect style
|
||||
const { should } = require('chai'); // Using Should style
|
||||
should(); // Modifies `Object.prototype`
|
||||
|
||||
const { expect, use } = require('chai'); // Creates local variables `expect` and `use`; useful for plugin use
|
||||
```
|
||||
|
||||
### Native Modules Usage (_registers the chai testing style globally_)
|
||||
|
||||
```js
|
||||
import 'chai/register-assert'; // Using Assert style
|
||||
import 'chai/register-expect'; // Using Expect style
|
||||
import 'chai/register-should'; // Using Should style
|
||||
```
|
||||
|
||||
### Native Modules Usage (_local import only_)
|
||||
|
||||
```js
|
||||
import { assert } from 'chai'; // Using Assert style
|
||||
import { expect } from 'chai'; // Using Expect style
|
||||
import { should } from 'chai'; // Using Should style
|
||||
should(); // Modifies `Object.prototype`
|
||||
```
|
||||
|
||||
### Usage with Mocha
|
||||
|
||||
```bash
|
||||
mocha spec.js -r chai/register-assert # Using Assert style
|
||||
mocha spec.js -r chai/register-expect # Using Expect style
|
||||
mocha spec.js -r chai/register-should # Using Should style
|
||||
```
|
||||
|
||||
[Read more about these styles in our docs](http://chaijs.com/guide/styles/).
|
||||
|
||||
## Plugins
|
||||
|
||||
Chai offers a robust Plugin architecture for extending Chai's assertions and interfaces.
|
||||
|
||||
- Need a plugin? View the [official plugin list](http://chaijs.com/plugins).
|
||||
- Want to build a plugin? Read the [plugin api documentation](http://chaijs.com/guide/plugins/).
|
||||
- Have a plugin and want it listed? Simply add the following keywords to your package.json:
|
||||
- `chai-plugin`
|
||||
- `browser` if your plugin works in the browser as well as Node.js
|
||||
- `browser-only` if your plugin does not work with Node.js
|
||||
|
||||
### Related Projects
|
||||
|
||||
- [chaijs / chai-docs](https://github.com/chaijs/chai-docs): The chaijs.com website source code.
|
||||
- [chaijs / assertion-error](https://github.com/chaijs/assertion-error): Custom `Error` constructor thrown upon an assertion failing.
|
||||
- [chaijs / deep-eql](https://github.com/chaijs/deep-eql): Improved deep equality testing for Node.js and the browser.
|
||||
- [chaijs / type-detect](https://github.com/chaijs/type-detect): Improved typeof detection for Node.js and the browser.
|
||||
- [chaijs / check-error](https://github.com/chaijs/check-error): Error comparison and information related utility for Node.js and the browser.
|
||||
- [chaijs / loupe](https://github.com/chaijs/loupe): Inspect utility for Node.js and browsers.
|
||||
- [chaijs / pathval](https://github.com/chaijs/pathval): Object value retrieval given a string path.
|
||||
- [chaijs / get-func-name](https://github.com/chaijs/get-func-name): Utility for getting a function's name for node and the browser.
|
||||
|
||||
### Contributing
|
||||
|
||||
Thank you very much for considering to contribute!
|
||||
|
||||
Please make sure you follow our [Code Of Conduct](https://github.com/chaijs/chai/blob/master/CODE_OF_CONDUCT.md) and we also strongly recommend reading our [Contributing Guide](https://github.com/chaijs/chai/blob/master/CONTRIBUTING.md).
|
||||
|
||||
Here are a few issues other contributors frequently ran into when opening pull requests:
|
||||
|
||||
- Please do not commit changes to the `chai.js` build. We do it once per release.
|
||||
- Before pushing your commits, please make sure you [rebase](https://github.com/chaijs/chai/blob/master/CONTRIBUTING.md#pull-requests) them.
|
||||
|
||||
### Contributors
|
||||
|
||||
Please see the full
|
||||
[Contributors Graph](https://github.com/chaijs/chai/graphs/contributors) for our
|
||||
list of contributors.
|
||||
|
||||
### Core Contributors
|
||||
|
||||
Feel free to reach out to any of the core contributors with your questions or
|
||||
concerns. We will do our best to respond in a timely manner.
|
||||
|
||||
[](https://github.com/logicalparadox)
|
||||
[](https://github.com/vesln)
|
||||
[](https://github.com/keithamus)
|
||||
[](https://github.com/lucasfcosta)
|
||||
[](https://github.com/meeber)
|
||||
737
node_modules/chai/ReleaseNotes.md
generated
vendored
Normal file
737
node_modules/chai/ReleaseNotes.md
generated
vendored
Normal file
@@ -0,0 +1,737 @@
|
||||
# Release Notes
|
||||
|
||||
## Note
|
||||
|
||||
As of 3.0.0, the ReleaseNotes.md file has been deprecated. [Please refer to the release notes available on Github](https://github.com/chaijs/chai/releases). Or
|
||||
[the release notes on the chaijs.com website](https://chaijs.com/releases).
|
||||
|
||||
---
|
||||
|
||||
## 2.3.0 / 2015-04-26
|
||||
|
||||
Added `ownPropertyDescriptor` assertion:
|
||||
|
||||
```js
|
||||
expect('test').to.have.ownPropertyDescriptor('length');
|
||||
expect('test').to.have.ownPropertyDescriptor('length', { enumerable: false, configurable: false, writable: false, value: 4 });
|
||||
expect('test').not.to.have.ownPropertyDescriptor('length', { enumerable: false, configurable: false, writable: false, value: 3 });
|
||||
expect('test').ownPropertyDescriptor('length').to.have.property('enumerable', false);
|
||||
expect('test').ownPropertyDescriptor('length').to.have.keys('value');
|
||||
```
|
||||
|
||||
### Community Contributions
|
||||
|
||||
#### Code Features & Fixes
|
||||
|
||||
* [#408](https://github.com/chaijs/chai/pull/408) Add `ownPropertyDescriptor`
|
||||
assertion.
|
||||
By [@ljharb](https://github.com/ljharb)
|
||||
* [#422](https://github.com/chaijs/chai/pull/422) Improve ownPropertyDescriptor
|
||||
tests.
|
||||
By [@ljharb](https://github.com/ljharb)
|
||||
|
||||
#### Documentation fixes
|
||||
|
||||
* [#417](https://github.com/chaijs/chai/pull/417) Fix documentation typo
|
||||
By [@astorije](https://github.com/astorije)
|
||||
* [#423](https://github.com/chaijs/chai/pull/423) Fix inconsistency in docs.
|
||||
By [@ehntoo](https://github.com/ehntoo)
|
||||
|
||||
|
||||
## 2.2.0 / 2015-03-26
|
||||
|
||||
Deep property strings can now be escaped using `\\` - for example:
|
||||
|
||||
```js
|
||||
var deepCss = { '.link': { '[target]': 42 }};
|
||||
expect(deepCss).to.have.deep.property('\\.link.\\[target\\]', 42)
|
||||
```
|
||||
|
||||
### Community Contributions
|
||||
|
||||
#### Code Features & Fixes
|
||||
|
||||
* [#402](https://github.com/chaijs/chai/pull/402) Allow escaping of deep
|
||||
property keys.
|
||||
By [@umireon](https://github.com/umireon)
|
||||
|
||||
#### Documentation fixes
|
||||
|
||||
* [#405](https://github.com/chaijs/chai/pull/405) Tweak documentation around
|
||||
deep property escaping.
|
||||
By [@keithamus](https://github.com/keithamus)
|
||||
|
||||
|
||||
## 2.1.2 / 2015-03-15
|
||||
|
||||
A minor bug fix. No new features.
|
||||
|
||||
### Community Contributions
|
||||
|
||||
#### Code Features & Fixes
|
||||
|
||||
* [#395](https://github.com/chaijs/chai/pull/395) Fix eval-related bugs with
|
||||
assert.operator ([#386](https://github.com/chaijs/chai/pull/386)).
|
||||
By [@cjqed](https://github.com/cjqed)
|
||||
|
||||
## 2.1.1 / 2015-03-04
|
||||
|
||||
Two minor bugfixes. No new features.
|
||||
|
||||
### Community Contributions
|
||||
|
||||
#### Code Features & Fixes
|
||||
|
||||
* [#385](https://github.com/chaijs/chai/pull/385) Fix a bug (also described in
|
||||
[#387](https://github.com/chaijs/chai/pull/385)) where `deep.property` would not work with single
|
||||
key names. By [@eldritch-fossicker](https://github.com/eldritch-fossicker)
|
||||
* [#379](https://github.com/chaijs/chai/pull/379) Fix bug where tools which overwrite
|
||||
primitive prototypes, such as Babel or core-js would fail.
|
||||
By [@dcneiner](https://github.com/dcneiner)
|
||||
|
||||
#### Documentation fixes
|
||||
|
||||
* [#382](https://github.com/chaijs/chai/pull/382) Add doc for showDiff argument in assert.
|
||||
By [@astorije](https://github.com/astorije)
|
||||
* [#383](https://github.com/chaijs/chai/pull/383) Improve wording for truncateTreshold docs
|
||||
By [@gurdiga](https://github.com/gurdiga)
|
||||
* [#381](https://github.com/chaijs/chai/pull/381) Improve wording for assert.empty docs
|
||||
By [@astorije](https://github.com/astorije)
|
||||
|
||||
## 2.1.0 / 2015-02-23
|
||||
|
||||
Small release; fixes an issue where the Chai lib was incorrectly reporting the
|
||||
version number.
|
||||
|
||||
Adds new `should.fail()` and `expect.fail()` methods, which are convinience
|
||||
methods to throw Assertion Errors.
|
||||
|
||||
### Community Contributions
|
||||
|
||||
#### Code Features & Fixes
|
||||
|
||||
* [#356](https://github.com/chaijs/chai/pull/356) Add should.fail(), expect.fail(). By [@Soviut](https://github.com/Soviut)
|
||||
* [#374](https://github.com/chaijs/chai/pull/374) Increment version. By [@jmm](https://github.com/jmm)
|
||||
|
||||
## 2.0.0 / 2015-02-09
|
||||
|
||||
Unfortunately with 1.10.0 - compatibility broke with older versions because of
|
||||
the `addChainableNoop`. This change has been reverted.
|
||||
|
||||
Any plugins using `addChainableNoop` should cease to do so.
|
||||
|
||||
Any developers wishing for this behaviour can use [dirty-chai](https://www.npmjs.com/package/dirty-chai)
|
||||
by [@joshperry](https://github.com/joshperry)
|
||||
|
||||
### Community Contributions
|
||||
|
||||
#### Code Features & Fixes
|
||||
|
||||
* [#361](https://github.com/chaijs/chai/pull/361) `.keys()` now accepts Objects, extracting keys from them. By [@gregglind](https://github.com/gregglind)
|
||||
* [#359](https://github.com/chaijs/chai/pull/359) `.keys()` no longer mutates passed arrays. By [@gregglind](https://github.com/gregglind)
|
||||
* [#349](https://github.com/chaijs/chai/pull/349) Add a new chainable keyword - `.which`. By [@toastynerd](https://github.com/toastynerd)
|
||||
* [#333](https://github.com/chaijs/chai/pull/333) Add `.change`, `.increase` and `.decrease` assertions. By [@cmpolis](https://github.com/cmpolis)
|
||||
* [#335](https://github.com/chaijs/chai/pull/335) `chai.util` is now exposed [@DingoEatingFuzz](https://github.com/DingoEatingFuzz)
|
||||
* [#328](https://github.com/chaijs/chai/pull/328) Add `.includes` and `.contains` aliases (for `.include` and `.contain`). By [@lo1tuma](https://github.com/lo1tuma)
|
||||
* [#313](https://github.com/chaijs/chai/pull/313) Add `.any.keys()` and `.all.keys()` qualifiers. By [@cjqed](https://github.com/cjqed)
|
||||
* [#312](https://github.com/chaijs/chai/pull/312) Add `assert.sameDeepMembers()`. By [@cjqed](https://github.com/cjqed)
|
||||
* [#311](https://github.com/chaijs/chai/pull/311) Add `assert.isAbove()` and `assert.isBelow()`. By [@cjqed](https://github.com/cjqed)
|
||||
* [#308](https://github.com/chaijs/chai/pull/308) `property` and `deep.property` now pass if a value is set to `undefined`. By [@prodatakey](https://github.com/prodatakey)
|
||||
* [#309](https://github.com/chaijs/chai/pull/309) optimize deep equal in Arrays. By [@ericdouglas](https://github.com/ericdouglas)
|
||||
* [#306](https://github.com/chaijs/chai/pull/306) revert #297 - allowing lint-friendly tests. By [@keithamus](https://github.com/keithamus)
|
||||
|
||||
#### Documentation fixes
|
||||
|
||||
* [#357](https://github.com/chaijs/chai/pull/357) Copyright year updated in docs. By [@danilovaz](https://github.com/danilovaz)
|
||||
* [#325](https://github.com/chaijs/chai/pull/325) Fix documentation for overwriteChainableMethod. By [@chasenlehara](https://github.com/chasenlehara)
|
||||
* [#334](https://github.com/chaijs/chai/pull/334) Typo fix. By [@hurrymaplelad](https://github.com/hurrymaplelad)
|
||||
* [#317](https://github.com/chaijs/chai/pull/317) Typo fix. By [@jasonkarns](https://github.com/jasonkarns)
|
||||
* [#318](https://github.com/chaijs/chai/pull/318) Typo fix. By [@jasonkarns](https://github.com/jasonkarns)
|
||||
* [#316](https://github.com/chaijs/chai/pull/316) Typo fix. By [@jasonkarns](https://github.com/jasonkarns)
|
||||
|
||||
|
||||
## 1.10.0 / 2014-11-10
|
||||
|
||||
The following changes are required if you are upgrading from the previous version:
|
||||
|
||||
- **Users:**
|
||||
- No changes required
|
||||
- **Plugin Developers:**
|
||||
- Review `addChainableNoop` notes below.
|
||||
- **Core Contributors:**
|
||||
- Refresh `node_modules` folder for updated dependencies.
|
||||
|
||||
### Noop Function for Terminating Assertion Properties
|
||||
|
||||
The following assertions can now also be used in the function-call form:
|
||||
|
||||
* ok
|
||||
* true
|
||||
* false
|
||||
* null
|
||||
* undefined
|
||||
* exist
|
||||
* empty
|
||||
* arguments
|
||||
* Arguments
|
||||
|
||||
The above list of assertions are property getters that assert immediately on
|
||||
access. Because of that, they were written to be used by terminating the assertion
|
||||
chain with a property access.
|
||||
|
||||
```js
|
||||
expect(true).to.be.true;
|
||||
foo.should.be.ok;
|
||||
```
|
||||
|
||||
This syntax is definitely aesthetically pleasing but, if you are linting your
|
||||
test code, your linter will complain with an error something like "Expected an
|
||||
assignment or function call and instead saw an expression." Since the linter
|
||||
doesn't know about the property getter it assumes this line has no side-effects,
|
||||
and throws a warning in case you made a mistake.
|
||||
|
||||
Squelching these errors is not a good solution as test code is getting to be
|
||||
just as important as, if not more than, production code. Catching syntactical
|
||||
errors in tests using static analysis is a great tool to help make sure that your
|
||||
tests are well-defined and free of typos.
|
||||
|
||||
A better option was to provide a function-call form for these assertions so that
|
||||
the code's intent is more clear and the linters stop complaining about something
|
||||
looking off. This form is added in addition to the existing property access form
|
||||
and does not impact existing test code.
|
||||
|
||||
```js
|
||||
expect(true).to.be.true();
|
||||
foo.should.be.ok();
|
||||
```
|
||||
|
||||
These forms can also be mixed in any way, these are all functionally identical:
|
||||
|
||||
```js
|
||||
expect(true).to.be.true.and.not.false();
|
||||
expect(true).to.be.true().and.not.false;
|
||||
expect(true).to.be.true.and.not.false;
|
||||
```
|
||||
|
||||
#### Plugin Authors
|
||||
|
||||
If you would like to provide this function-call form for your terminating assertion
|
||||
properties, there is a new function to register these types of asserts. Instead
|
||||
of using `addProperty` to register terminating assertions, simply use `addChainableNoop`
|
||||
instead; the arguments to both are identical. The latter will make the assertion
|
||||
available in both the attribute and function-call forms and should have no impact
|
||||
on existing users of your plugin.
|
||||
|
||||
### Community Contributions
|
||||
|
||||
- [#297](https://github.com/chaijs/chai/pull/297) Allow writing lint-friendly tests. [@joshperry](https://github.com/joshperry)
|
||||
- [#298](https://github.com/chaijs/chai/pull/298) Add check for logging `-0`. [@dasilvacontin](https://github.com/dasilvacontin)
|
||||
- [#300](https://github.com/chaijs/chai/pull/300) Fix #299: the test is defining global variables [@julienw](https://github.com/julienw)
|
||||
|
||||
Thank you to all who took time to contribute!
|
||||
|
||||
## 1.9.2 / 2014-09-29
|
||||
|
||||
The following changes are required if you are upgrading from the previous version:
|
||||
|
||||
- **Users:**
|
||||
- No changes required
|
||||
- **Plugin Developers:**
|
||||
- No changes required
|
||||
- **Core Contributors:**
|
||||
- Refresh `node_modules` folder for updated dependencies.
|
||||
|
||||
### Community Contributions
|
||||
|
||||
- [#264](https://github.com/chaijs/chai/pull/264) Show diff for keys assertions [@cjthompson](https://github.com/cjthompson)
|
||||
- [#267](https://github.com/chaijs/chai/pull/267) Use SVG badges [@shinnn](https://github.com/shinnn)
|
||||
- [#268](https://github.com/chaijs/chai/pull/268) Allow messages to be functions (sinon-compat) [@charlierudolph](https://github.com/charlierudolph)
|
||||
- [#269](https://github.com/chaijs/chai/pull/269) Remove unused argument for #lengthOf [@charlierudolph](https://github.com/charlierudolph)
|
||||
- [#275](https://github.com/chaijs/chai/pull/275) Rewrite pretty-printing HTML elements to prevent throwing internal errors [@DrRataplan](https://github.com/DrRataplan)
|
||||
- [#277](https://github.com/chaijs/chai/pull/277) Fix assert documentation for #sameMembers [@charlierudolph](https://github.com/charlierudolph)
|
||||
- [#279](https://github.com/chaijs/chai/pull/279) closeTo should check value's type before assertion [@mohayonao](https://github.com/mohayonao)
|
||||
- [#289](https://github.com/chaijs/chai/pull/289) satisfy is called twice [@charlierudolph](https://github.com/charlierudolph)
|
||||
- [#292](https://github.com/chaijs/chai/pull/292) resolve conflicts with node-webkit and global usage [@boneskull](https://github.com/boneskull)
|
||||
|
||||
Thank you to all who took time to contribute!
|
||||
|
||||
## 1.9.1 / 2014-03-19
|
||||
|
||||
The following changes are required if you are upgrading from the previous version:
|
||||
|
||||
- **Users:**
|
||||
- Migrate configuration options to new interface. (see notes)
|
||||
- **Plugin Developers:**
|
||||
- No changes required
|
||||
- **Core Contributors:**
|
||||
- Refresh `node_modules` folder for updated dependencies.
|
||||
|
||||
### Configuration
|
||||
|
||||
There have been requests for changes and additions to the configuration mechanisms
|
||||
and their impact in the Chai architecture. As such, we have decoupled the
|
||||
configuration from the `Assertion` constructor. This not only allows for centralized
|
||||
configuration, but will allow us to shift the responsibility from the `Assertion`
|
||||
constructor to the `assert` interface in future releases.
|
||||
|
||||
These changes have been implemented in a non-breaking way, but a depretiation
|
||||
warning will be presented to users until they migrate. The old config method will
|
||||
be removed in either `v1.11.0` or `v2.0.0`, whichever comes first.
|
||||
|
||||
#### Quick Migration
|
||||
|
||||
```js
|
||||
// change this:
|
||||
chai.Assertion.includeStack = true;
|
||||
chai.Assertion.showDiff = false;
|
||||
|
||||
// ... to this:
|
||||
chai.config.includeStack = true;
|
||||
chai.config.showDiff = false;
|
||||
```
|
||||
|
||||
#### All Config Options
|
||||
|
||||
##### config.includeStack
|
||||
|
||||
- **@param** _{Boolean}_
|
||||
- **@default** `false`
|
||||
|
||||
User configurable property, influences whether stack trace is included in
|
||||
Assertion error message. Default of `false` suppresses stack trace in the error
|
||||
message.
|
||||
|
||||
##### config.showDiff
|
||||
|
||||
- **@param** _{Boolean}_
|
||||
- **@default** `true`
|
||||
|
||||
User configurable property, influences whether or not the `showDiff` flag
|
||||
should be included in the thrown AssertionErrors. `false` will always be `false`;
|
||||
`true` will be true when the assertion has requested a diff be shown.
|
||||
|
||||
##### config.truncateThreshold **(NEW)**
|
||||
|
||||
- **@param** _{Number}_
|
||||
- **@default** `40`
|
||||
|
||||
User configurable property, sets length threshold for actual and expected values
|
||||
in assertion errors. If this threshold is exceeded, the value is truncated.
|
||||
|
||||
Set it to zero if you want to disable truncating altogether.
|
||||
|
||||
```js
|
||||
chai.config.truncateThreshold = 0; // disable truncating
|
||||
```
|
||||
|
||||
### Community Contributions
|
||||
|
||||
- [#228](https://github.com/chaijs/chai/pull/228) Deep equality check for memebers. [@duncanbeevers](https://github.com/duncanbeevers)
|
||||
- [#247](https://github.com/chaijs/chai/pull/247) Proofreading. [@didorellano](https://github.com/didoarellano)
|
||||
- [#244](https://github.com/chaijs/chai/pull/244) Fix `contain`/`include` 1.9.0 regression. [@leider](https://github.com/leider)
|
||||
- [#233](https://github.com/chaijs/chai/pull/233) Improvements to `ssfi` for `assert` interface. [@refack](https://github.com/refack)
|
||||
- [#251](https://github.com/chaijs/chai/pull/251) New config option: object display threshold. [@romario333](https://github.com/romario333)
|
||||
|
||||
Thank you to all who took time to contribute!
|
||||
|
||||
### Other Bug Fixes
|
||||
|
||||
- [#183](https://github.com/chaijs/chai/issues/183) Allow `undefined` for actual. (internal api)
|
||||
- Update Karam(+plugins)/Istanbul to most recent versions.
|
||||
|
||||
## 1.9.0 / 2014-01-29
|
||||
|
||||
The following changes are required if you are upgrading from the previous version:
|
||||
|
||||
- **Users:**
|
||||
- No changes required
|
||||
- **Plugin Developers:**
|
||||
- Review [#219](https://github.com/chaijs/chai/pull/219).
|
||||
- **Core Contributors:**
|
||||
- Refresh `node_modules` folder for updated dependencies.
|
||||
|
||||
### Community Contributions
|
||||
|
||||
- [#202](https://github.com/chaijs/chai/pull/201) Improve error message for .throw(). [@andreineculau](https://github.com/andreineculau)
|
||||
- [#217](https://github.com/chaijs/chai/pull/217) Chai tests can be run with `--watch`. [@demands](https://github.com/demands)
|
||||
- [#219](https://github.com/chaijs/chai/pull/219) Add overwriteChainableMethod utility. [@demands](https://github.com/demands)
|
||||
- [#224](https://github.com/chaijs/chai/pull/224) Return error on throw method to chain on error properties. [@vbardales](https://github.com/vbardales)
|
||||
- [#226](https://github.com/chaijs/chai/pull/226) Add `has` to language chains. [@duncanbeevers](https://github.com/duncanbeevers)
|
||||
- [#230](https://github.com/chaijs/chai/pull/230) Support `{a:1,b:2}.should.include({a:1})` [@jkroso](https://github.com/jkroso)
|
||||
- [#231](https://github.com/chaijs/chai/pull/231) Update Copyright notices to 2014 [@duncanbeevers](https://github.com/duncanbeevers)
|
||||
- [#232](https://github.com/chaijs/chai/pull/232) Avoid error instantiation if possible on assert.throws. [@laconbass](https://github.com/laconbass)
|
||||
|
||||
Thank you to all who took time to contribute!
|
||||
|
||||
### Other Bug Fixes
|
||||
|
||||
- [#225](https://github.com/chaijs/chai/pull/225) Improved AMD wrapper provided by upstream `component(1)`.
|
||||
- [#185](https://github.com/chaijs/chai/issues/185) `assert.throws()` returns thrown error for further assertions.
|
||||
- [#237](https://github.com/chaijs/chai/pull/237) Remove coveralls/jscoverage, include istanbul coverage report in travis test.
|
||||
- Update Karma and Sauce runner versions for consistent CI results. No more karma@canary.
|
||||
|
||||
## 1.8.1 / 2013-10-10
|
||||
|
||||
The following changes are required if you are upgrading from the previous version:
|
||||
|
||||
- **Users:**
|
||||
- Refresh `node_modules` folder for updated dependencies.
|
||||
- **Plugin Developers:**
|
||||
- No changes required
|
||||
- **Core Contributors:**
|
||||
- Refresh `node_modules` folder for updated dependencies.
|
||||
|
||||
### Browserify
|
||||
|
||||
This is a small patch that updates the dependency tree so browserify users can install
|
||||
chai. (Remove conditional requires)
|
||||
|
||||
## 1.8.0 / 2013-09-18
|
||||
|
||||
The following changes are required if you are upgrading from the previous version:
|
||||
|
||||
- **Users:**
|
||||
- See `deep.equal` notes.
|
||||
- **Plugin Developers:**
|
||||
- No changes required
|
||||
- **Core Contributors:**
|
||||
- Refresh `node_modules` folder for updated dependencies.
|
||||
|
||||
### Deep Equals
|
||||
|
||||
This version of Chai focused on a overhaul to the deep equal utility. The code for this
|
||||
tool has been removed from the core lib and can now be found at:
|
||||
[chai / deep-eql](https://github.com/chaijs/deep-eql). As stated in previous releases,
|
||||
this is part of a larger initiative to provide transparency, independent testing, and coverage for
|
||||
some of the more complicated internal tools.
|
||||
|
||||
For the most part `.deep.equal` will behave the same as it has. However, in order to provide a
|
||||
consistent ruleset across all types being tested, the following changes have been made and _might_
|
||||
require changes to your tests.
|
||||
|
||||
**1.** Strict equality for non-traversable nodes according to [egal](http://wiki.ecmascript.org/doku.php?id=harmony:egal).
|
||||
|
||||
_Previously:_ Non-traversable equal via `===`.
|
||||
|
||||
```js
|
||||
expect(NaN).to.deep.equal(NaN);
|
||||
expect(-0).to.not.deep.equal(+0);
|
||||
```
|
||||
|
||||
**2.** Arguments are not Arrays (and all types must be equal):
|
||||
|
||||
_Previously:_ Some crazy nonsense that led to empty arrays deep equaling empty objects deep equaling dates.
|
||||
|
||||
```js
|
||||
expect(arguments).to.not.deep.equal([]);
|
||||
expect(Array.prototype.slice.call(arguments)).to.deep.equal([]);
|
||||
```
|
||||
|
||||
- [#156](https://github.com/chaijs/chai/issues/156) Empty object is eql to empty array
|
||||
- [#192](https://github.com/chaijs/chai/issues/192) empty object is eql to a Date object
|
||||
- [#194](https://github.com/chaijs/chai/issues/194) refactor deep-equal utility
|
||||
|
||||
### CI and Browser Testing
|
||||
|
||||
Chai now runs the browser CI suite using [Karma](http://karma-runner.github.io/) directed at
|
||||
[SauceLabs](https://saucelabs.com/). This means we get to know where our browser support stands...
|
||||
and we get a cool badge:
|
||||
|
||||
[](https://saucelabs.com/u/logicalparadox)
|
||||
|
||||
Look for the list of browsers/versions to expand over the coming releases.
|
||||
|
||||
- [#195](https://github.com/chaijs/chai/issues/195) karma test framework
|
||||
|
||||
## 1.7.2 / 2013-06-27
|
||||
|
||||
The following changes are required if you are upgrading from the previous version:
|
||||
|
||||
- **Users:**
|
||||
- No changes required.
|
||||
- **Plugin Developers:**
|
||||
- No changes required
|
||||
- **Core Contributors:**
|
||||
- Refresh `node_modules` folder for updated dependencies.
|
||||
|
||||
### Coverage Reporting
|
||||
|
||||
Coverage reporting has always been available for core-developers but the data has never been published
|
||||
for our end users. In our ongoing effort to improve accountability this data will now be published via
|
||||
the [coveralls.io](https://coveralls.io/) service. A badge has been added to the README and the full report
|
||||
can be viewed online at the [chai coveralls project](https://coveralls.io/r/chaijs/chai). Furthermore, PRs
|
||||
will receive automated messages indicating how their PR impacts test coverage. This service is tied to TravisCI.
|
||||
|
||||
### Other Fixes
|
||||
|
||||
- [#175](https://github.com/chaijs/chai/issues/175) Add `bower.json`. (Fix ignore all)
|
||||
|
||||
## 1.7.1 / 2013-06-24
|
||||
|
||||
The following changes are required if you are upgrading from the previous version:
|
||||
|
||||
- **Users:**
|
||||
- No changes required.
|
||||
- **Plugin Developers:**
|
||||
- No changes required
|
||||
- **Core Contributors:**
|
||||
- Refresh `node_modules` folder for updated dependencies.
|
||||
|
||||
### Official Bower Support
|
||||
|
||||
Support has been added for the Bower Package Manager ([bower.io])(http://bower.io/). Though
|
||||
Chai could be installed via Bower in the past, this update adds official support via the `bower.json`
|
||||
specification file.
|
||||
|
||||
- [#175](https://github.com/chaijs/chai/issues/175) Add `bower.json`.
|
||||
|
||||
## 1.7.0 / 2013-06-17
|
||||
|
||||
The following changes are required if you are upgrading from the previous version:
|
||||
|
||||
- **Users:**
|
||||
- No changes required.
|
||||
- **Plugin Developers:**
|
||||
- Review AssertionError update notice.
|
||||
- **Core Contributors:**
|
||||
- Refresh `node_modules` folder for updated dependencies.
|
||||
|
||||
### AssertionError Update Notice
|
||||
|
||||
Chai now uses [chaijs/assertion-error](https://github.com/chaijs/assertion-error) instead an internal
|
||||
constructor. This will allow for further iteration/experimentation of the AssertionError constructor
|
||||
independant of Chai. Future plans include stack parsing for callsite support.
|
||||
|
||||
This update constructor has a different constructor param signature that conforms more with the standard
|
||||
`Error` object. If your plugin throws and `AssertionError` directly you will need to update your plugin
|
||||
with the new signature.
|
||||
|
||||
```js
|
||||
var AssertionError = require('chai').AssertionError;
|
||||
|
||||
/**
|
||||
* previous
|
||||
*
|
||||
* @param {Object} options
|
||||
*/
|
||||
|
||||
throw new AssertionError({
|
||||
message: 'An assertion error occurred'
|
||||
, actual: actual
|
||||
, expect: expect
|
||||
, startStackFunction: arguments.callee
|
||||
, showStack: true
|
||||
});
|
||||
|
||||
/**
|
||||
* new
|
||||
*
|
||||
* @param {String} message
|
||||
* @param {Object} options
|
||||
* @param {Function} start stack function
|
||||
*/
|
||||
|
||||
throw new AssertionError('An assertion error occurred', {
|
||||
actual: actual
|
||||
, expect: expect
|
||||
, showStack: true
|
||||
}, arguments.callee);
|
||||
|
||||
// other signatures
|
||||
throw new AssertionError('An assertion error occurred');
|
||||
throw new AssertionError('An assertion error occurred', null, arguments.callee);
|
||||
```
|
||||
|
||||
#### External Dependencies
|
||||
|
||||
This is the first non-developement dependency for Chai. As Chai continues to evolve we will begin adding
|
||||
more; the next will likely be improved type detection and deep equality. With Chai's userbase continually growing
|
||||
there is an higher need for accountability and documentation. External dependencies will allow us to iterate and
|
||||
test on features independent from our interfaces.
|
||||
|
||||
Note: The browser packaged version `chai.js` will ALWAYS contain all dependencies needed to run Chai.
|
||||
|
||||
### Community Contributions
|
||||
|
||||
- [#169](https://github.com/chaijs/chai/pull/169) Fix deep equal comparison for Date/Regexp types. [@katsgeorgeek](https://github.com/katsgeorgeek)
|
||||
- [#171](https://github.com/chaijs/chai/pull/171) Add `assert.notOk()`. [@Bartvds](https://github.com/Bartvds)
|
||||
- [#173](https://github.com/chaijs/chai/pull/173) Fix `inspect` utility. [@domenic](https://github.com/domenic)
|
||||
|
||||
Thank you to all who took the time to contribute!
|
||||
|
||||
## 1.6.1 / 2013-06-05
|
||||
|
||||
The following changes are required if you are upgrading from the previous version:
|
||||
|
||||
- **Users:**
|
||||
- No changes required.
|
||||
- **Plugin Developers:**
|
||||
- No changes required.
|
||||
- **Core Contributors:**
|
||||
- Refresh `node_modules` folder for updated developement dependencies.
|
||||
|
||||
### Deep Equality
|
||||
|
||||
Regular Expressions are now tested as part of all deep equality assertions. In previous versions
|
||||
they silently passed for all scenarios. Thanks to [@katsgeorgeek](https://github.com/katsgeorgeek) for the contribution.
|
||||
|
||||
### Community Contributions
|
||||
|
||||
- [#161](https://github.com/chaijs/chai/pull/161) Fix documented name for assert interface's isDefined method. [@brandonpayton](https://github.com/brandonpayton)
|
||||
- [#168](https://github.com/chaijs/chai/pull/168) Fix comparison equality of two regexps for when using deep equality. [@katsgeorgeek](https://github.com/katsgeorgeek)
|
||||
|
||||
Thank you to all who took the time to contribute!
|
||||
|
||||
### Additional Notes
|
||||
|
||||
- Mocha has been locked at version `1.8.x` to ensure `mocha-phantomjs` compatibility.
|
||||
|
||||
## 1.6.0 / 2013-04-29
|
||||
|
||||
The following changes are required if you are upgrading from the previous version:
|
||||
|
||||
- **Users:**
|
||||
- No changes required.
|
||||
- **Plugin Developers:**
|
||||
- No changes required.
|
||||
- **Core Contributors:**
|
||||
- Refresh `node_modules` folder for updated developement dependencies.
|
||||
|
||||
### New Assertions
|
||||
|
||||
#### Array Members Inclusion
|
||||
|
||||
Asserts that the target is a superset of `set`, or that the target and `set` have the same members.
|
||||
Order is not taken into account. Thanks to [@NickHeiner](https://github.com/NickHeiner) for the contribution.
|
||||
|
||||
```js
|
||||
// (expect/should) full set
|
||||
expect([4, 2]).to.have.members([2, 4]);
|
||||
expect([5, 2]).to.not.have.members([5, 2, 1]);
|
||||
|
||||
// (expect/should) inclusion
|
||||
expect([1, 2, 3]).to.include.members([3, 2]);
|
||||
expect([1, 2, 3]).to.not.include.members([3, 2, 8]);
|
||||
|
||||
// (assert) full set
|
||||
assert.sameMembers([ 1, 2, 3 ], [ 2, 1, 3 ], 'same members');
|
||||
|
||||
// (assert) inclusion
|
||||
assert.includeMembers([ 1, 2, 3 ], [ 2, 1 ], 'include members');
|
||||
|
||||
```
|
||||
|
||||
#### Non-inclusion for Assert Interface
|
||||
|
||||
Most `assert` functions have a negative version, like `instanceOf()` has a corresponding `notInstaceOf()`.
|
||||
However `include()` did not have a corresponding `notInclude()`. This has been added.
|
||||
|
||||
```js
|
||||
assert.notInclude([ 1, 2, 3 ], 8);
|
||||
assert.notInclude('foobar', 'baz');
|
||||
```
|
||||
|
||||
### Community Contributions
|
||||
|
||||
- [#140](https://github.com/chaijs/chai/pull/140) Restore `call`/`apply` methods for plugin interface. [@RubenVerborgh](https://github.com/RubenVerborgh)
|
||||
- [#148](https://github.com/chaijs/chai/issues/148)/[#153](https://github.com/chaijs/chai/pull/153) Add `members` and `include.members` assertions. [#NickHeiner](https://github.com/NickHeiner)
|
||||
|
||||
Thank you to all who took time to contribute!
|
||||
|
||||
### Other Bug Fixes
|
||||
|
||||
- [#142](https://github.com/chaijs/chai/issues/142) `assert#include` will no longer silently pass on wrong-type haystack.
|
||||
- [#158](https://github.com/chaijs/chai/issues/158) `assert#notInclude` has been added.
|
||||
- Travis-CI now tests Node.js `v0.10.x`. Support for `v0.6.x` has been removed. `v0.8.x` is still tested as before.
|
||||
|
||||
## 1.5.0 / 2013-02-03
|
||||
|
||||
### Migration Requirements
|
||||
|
||||
The following changes are required if you are upgrading from the previous version:
|
||||
|
||||
- **Users:**
|
||||
- _Update [2013-02-04]:_ Some users may notice a small subset of deep equality assertions will no longer pass. This is the result of
|
||||
[#120](https://github.com/chaijs/chai/issues/120), an improvement to our deep equality algorithm. Users will need to revise their assertions
|
||||
to be more granular should this occur. Further information: [#139](https://github.com/chaijs/chai/issues/139).
|
||||
- **Plugin Developers:**
|
||||
- No changes required.
|
||||
- **Core Contributors:**
|
||||
- Refresh `node_modules` folder for updated developement dependencies.
|
||||
|
||||
### Community Contributions
|
||||
|
||||
- [#126](https://github.com/chaijs/chai/pull/126): Add `eqls` alias for `eql`. [@RubenVerborgh](https://github.com/RubenVerborgh)
|
||||
- [#127](https://github.com/chaijs/chai/issues/127): Performance refactor for chainable methods. [@RubenVerborgh](https://github.com/RubenVerborgh)
|
||||
- [#133](https://github.com/chaijs/chai/pull/133): Assertion `.throw` support for primitives. [@RubenVerborgh](https://github.com/RubenVerborgh)
|
||||
- [#137](https://github.com/chaijs/chai/issues/137): Assertion `.throw` support for empty messages. [@timnew](https://github.com/timnew)
|
||||
- [#136](https://github.com/chaijs/chai/pull/136): Fix backward negation messages when using `.above()` and `.below()`. [@whatthejeff](https://github.com/whatthejeff)
|
||||
|
||||
Thank you to all who took time to contribute!
|
||||
|
||||
### Other Bug Fixes
|
||||
|
||||
- Improve type detection of `.a()`/`.an()` to work in cross-browser scenarios.
|
||||
- [#116](https://github.com/chaijs/chai/issues/116): `.throw()` has cleaner display of errors when WebKit browsers.
|
||||
- [#120](https://github.com/chaijs/chai/issues/120): `.eql()` now works to compare dom nodes in browsers.
|
||||
|
||||
|
||||
### Usage Updates
|
||||
|
||||
#### For Users
|
||||
|
||||
**1. Component Support:** Chai now included the proper configuration to be installed as a
|
||||
[component](https://github.com/component/component). Component users are encouraged to consult
|
||||
[chaijs.com](http://chaijs.com) for the latest version number as using the master branch
|
||||
does not gaurantee stability.
|
||||
|
||||
```js
|
||||
// relevant component.json
|
||||
devDependencies: {
|
||||
"chaijs/chai": "1.5.0"
|
||||
}
|
||||
```
|
||||
|
||||
Alternatively, bleeding-edge is available:
|
||||
|
||||
$ component install chaijs/chai
|
||||
|
||||
**2. Configurable showDiff:** Some test runners (such as [mocha](http://visionmedia.github.com/mocha/))
|
||||
include support for showing the diff of strings and objects when an equality error occurs. Chai has
|
||||
already included support for this, however some users may not prefer this display behavior. To revert to
|
||||
no diff display, the following configuration is available:
|
||||
|
||||
```js
|
||||
chai.Assertion.showDiff = false; // diff output disabled
|
||||
chai.Assertion.showDiff = true; // default, diff output enabled
|
||||
```
|
||||
|
||||
#### For Plugin Developers
|
||||
|
||||
**1. New Utility - type**: The new utility `.type()` is available as a better implementation of `typeof`
|
||||
that can be used cross-browser. It handles the inconsistencies of Array, `null`, and `undefined` detection.
|
||||
|
||||
- **@param** _{Mixed}_ object to detect type of
|
||||
- **@return** _{String}_ object type
|
||||
|
||||
```js
|
||||
chai.use(function (c, utils) {
|
||||
// some examples
|
||||
utils.type({}); // 'object'
|
||||
utils.type(null); // `null'
|
||||
utils.type(undefined); // `undefined`
|
||||
utils.type([]); // `array`
|
||||
});
|
||||
```
|
||||
|
||||
#### For Core Contributors
|
||||
|
||||
**1. Browser Testing**: Browser testing of the `./chai.js` file is now available in the command line
|
||||
via PhantomJS. `make test` and Travis-CI will now also rebuild and test `./chai.js`. Consequently, all
|
||||
pull requests will now be browser tested in this way.
|
||||
|
||||
_Note: Contributors opening pull requests should still NOT include the browser build._
|
||||
|
||||
**2. SauceLabs Testing**: Early SauceLab support has been enabled with the file `./support/mocha-cloud.js`.
|
||||
Those interested in trying it out should create a free [Open Sauce](https://saucelabs.com/signup/plan) account
|
||||
and include their credentials in `./test/auth/sauce.json`.
|
||||
26
node_modules/chai/bower.json
generated
vendored
Normal file
26
node_modules/chai/bower.json
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"name": "chai",
|
||||
"description": "BDD/TDD assertion library for node.js and the browser. Test framework agnostic.",
|
||||
"license": "MIT",
|
||||
"keywords": [
|
||||
"test",
|
||||
"assertion",
|
||||
"assert",
|
||||
"testing",
|
||||
"chai"
|
||||
],
|
||||
"main": "chai.js",
|
||||
"ignore": [
|
||||
"build",
|
||||
"components",
|
||||
"lib",
|
||||
"node_modules",
|
||||
"support",
|
||||
"test",
|
||||
"index.js",
|
||||
"Makefile",
|
||||
".*"
|
||||
],
|
||||
"dependencies": {},
|
||||
"devDependencies": {}
|
||||
}
|
||||
11464
node_modules/chai/chai.js
generated
vendored
Normal file
11464
node_modules/chai/chai.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1
node_modules/chai/index.js
generated
vendored
Normal file
1
node_modules/chai/index.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = require('./lib/chai');
|
||||
14
node_modules/chai/index.mjs
generated
vendored
Normal file
14
node_modules/chai/index.mjs
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
import chai from './index.js';
|
||||
|
||||
export const expect = chai.expect;
|
||||
export const version = chai.version;
|
||||
export const Assertion = chai.Assertion;
|
||||
export const AssertionError = chai.AssertionError;
|
||||
export const util = chai.util;
|
||||
export const config = chai.config;
|
||||
export const use = chai.use;
|
||||
export const should = chai.should;
|
||||
export const assert = chai.assert;
|
||||
export const core = chai.core;
|
||||
|
||||
export default chai;
|
||||
34
node_modules/chai/karma.conf.js
generated
vendored
Normal file
34
node_modules/chai/karma.conf.js
generated
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
module.exports = function(config) {
|
||||
config.set({
|
||||
frameworks: [ 'mocha' ]
|
||||
, files: [
|
||||
'chai.js'
|
||||
, 'test/bootstrap/index.js'
|
||||
, 'test/*.js'
|
||||
]
|
||||
, reporters: [ 'progress' ]
|
||||
, colors: true
|
||||
, logLevel: config.LOG_INFO
|
||||
, autoWatch: false
|
||||
, browsers: [ 'HeadlessChrome' ]
|
||||
, customLaunchers: {
|
||||
HeadlessChrome: {
|
||||
base: 'ChromeHeadless'
|
||||
, flags: [ '--no-sandbox',]
|
||||
, }
|
||||
, }
|
||||
, browserDisconnectTimeout: 10000
|
||||
, browserDisconnectTolerance: 2
|
||||
, browserNoActivityTimeout: 20000
|
||||
, singleRun: true
|
||||
});
|
||||
|
||||
switch (process.env.CHAI_TEST_ENV) {
|
||||
case 'sauce':
|
||||
require('./karma.sauce')(config);
|
||||
break;
|
||||
default:
|
||||
// ...
|
||||
break;
|
||||
};
|
||||
};
|
||||
41
node_modules/chai/karma.sauce.js
generated
vendored
Normal file
41
node_modules/chai/karma.sauce.js
generated
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
var version = require('./package.json').version;
|
||||
var ts = new Date().getTime();
|
||||
|
||||
module.exports = function(config) {
|
||||
var auth;
|
||||
|
||||
try {
|
||||
auth = require('./test/auth/index');
|
||||
} catch(ex) {
|
||||
auth = {};
|
||||
auth.SAUCE_USERNAME = process.env.SAUCE_USERNAME || null;
|
||||
auth.SAUCE_ACCESS_KEY = process.env.SAUCE_ACCESS_KEY || null;
|
||||
}
|
||||
|
||||
if (!auth.SAUCE_USERNAME || !auth.SAUCE_ACCESS_KEY) return;
|
||||
if (process.env.SKIP_SAUCE) return;
|
||||
|
||||
var branch = process.env.TRAVIS_BRANCH || 'local'
|
||||
var browserConfig = require('./sauce.browsers');
|
||||
var browsers = Object.keys(browserConfig);
|
||||
var tags = [ 'chaijs_' + version, auth.SAUCE_USERNAME + '@' + branch ];
|
||||
var tunnel = process.env.TRAVIS_JOB_NUMBER || ts;
|
||||
|
||||
if (process.env.TRAVIS_JOB_NUMBER) {
|
||||
tags.push('travis@' + process.env.TRAVIS_JOB_NUMBER);
|
||||
}
|
||||
|
||||
config.browsers = config.browsers.concat(browsers);
|
||||
Object.assign(config.customLaunchers, browserConfig);
|
||||
config.reporters.push('saucelabs');
|
||||
config.captureTimeout = 300000;
|
||||
|
||||
config.sauceLabs = {
|
||||
username: auth.SAUCE_USERNAME
|
||||
, accessKey: auth.SAUCE_ACCESS_KEY
|
||||
, startConnect: ('TRAVIS' in process.env) === false
|
||||
, tags: tags
|
||||
, testName: 'ChaiJS'
|
||||
, tunnelIdentifier: tunnel
|
||||
};
|
||||
};
|
||||
92
node_modules/chai/lib/chai.js
generated
vendored
Normal file
92
node_modules/chai/lib/chai.js
generated
vendored
Normal file
@@ -0,0 +1,92 @@
|
||||
/*!
|
||||
* chai
|
||||
* Copyright(c) 2011-2014 Jake Luer <jake@alogicalparadox.com>
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
var used = [];
|
||||
|
||||
/*!
|
||||
* Chai version
|
||||
*/
|
||||
|
||||
exports.version = '4.3.3';
|
||||
|
||||
/*!
|
||||
* Assertion Error
|
||||
*/
|
||||
|
||||
exports.AssertionError = require('assertion-error');
|
||||
|
||||
/*!
|
||||
* Utils for plugins (not exported)
|
||||
*/
|
||||
|
||||
var util = require('./chai/utils');
|
||||
|
||||
/**
|
||||
* # .use(function)
|
||||
*
|
||||
* Provides a way to extend the internals of Chai.
|
||||
*
|
||||
* @param {Function}
|
||||
* @returns {this} for chaining
|
||||
* @api public
|
||||
*/
|
||||
|
||||
exports.use = function (fn) {
|
||||
if (!~used.indexOf(fn)) {
|
||||
fn(exports, util);
|
||||
used.push(fn);
|
||||
}
|
||||
|
||||
return exports;
|
||||
};
|
||||
|
||||
/*!
|
||||
* Utility Functions
|
||||
*/
|
||||
|
||||
exports.util = util;
|
||||
|
||||
/*!
|
||||
* Configuration
|
||||
*/
|
||||
|
||||
var config = require('./chai/config');
|
||||
exports.config = config;
|
||||
|
||||
/*!
|
||||
* Primary `Assertion` prototype
|
||||
*/
|
||||
|
||||
var assertion = require('./chai/assertion');
|
||||
exports.use(assertion);
|
||||
|
||||
/*!
|
||||
* Core Assertions
|
||||
*/
|
||||
|
||||
var core = require('./chai/core/assertions');
|
||||
exports.use(core);
|
||||
|
||||
/*!
|
||||
* Expect interface
|
||||
*/
|
||||
|
||||
var expect = require('./chai/interface/expect');
|
||||
exports.use(expect);
|
||||
|
||||
/*!
|
||||
* Should interface
|
||||
*/
|
||||
|
||||
var should = require('./chai/interface/should');
|
||||
exports.use(should);
|
||||
|
||||
/*!
|
||||
* Assert interface
|
||||
*/
|
||||
|
||||
var assert = require('./chai/interface/assert');
|
||||
exports.use(assert);
|
||||
175
node_modules/chai/lib/chai/assertion.js
generated
vendored
Normal file
175
node_modules/chai/lib/chai/assertion.js
generated
vendored
Normal file
@@ -0,0 +1,175 @@
|
||||
/*!
|
||||
* chai
|
||||
* http://chaijs.com
|
||||
* Copyright(c) 2011-2014 Jake Luer <jake@alogicalparadox.com>
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
var config = require('./config');
|
||||
|
||||
module.exports = function (_chai, util) {
|
||||
/*!
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var AssertionError = _chai.AssertionError
|
||||
, flag = util.flag;
|
||||
|
||||
/*!
|
||||
* Module export.
|
||||
*/
|
||||
|
||||
_chai.Assertion = Assertion;
|
||||
|
||||
/*!
|
||||
* Assertion Constructor
|
||||
*
|
||||
* Creates object for chaining.
|
||||
*
|
||||
* `Assertion` objects contain metadata in the form of flags. Three flags can
|
||||
* be assigned during instantiation by passing arguments to this constructor:
|
||||
*
|
||||
* - `object`: This flag contains the target of the assertion. For example, in
|
||||
* the assertion `expect(numKittens).to.equal(7);`, the `object` flag will
|
||||
* contain `numKittens` so that the `equal` assertion can reference it when
|
||||
* needed.
|
||||
*
|
||||
* - `message`: This flag contains an optional custom error message to be
|
||||
* prepended to the error message that's generated by the assertion when it
|
||||
* fails.
|
||||
*
|
||||
* - `ssfi`: This flag stands for "start stack function indicator". It
|
||||
* contains a function reference that serves as the starting point for
|
||||
* removing frames from the stack trace of the error that's created by the
|
||||
* assertion when it fails. The goal is to provide a cleaner stack trace to
|
||||
* end users by removing Chai's internal functions. Note that it only works
|
||||
* in environments that support `Error.captureStackTrace`, and only when
|
||||
* `Chai.config.includeStack` hasn't been set to `false`.
|
||||
*
|
||||
* - `lockSsfi`: This flag controls whether or not the given `ssfi` flag
|
||||
* should retain its current value, even as assertions are chained off of
|
||||
* this object. This is usually set to `true` when creating a new assertion
|
||||
* from within another assertion. It's also temporarily set to `true` before
|
||||
* an overwritten assertion gets called by the overwriting assertion.
|
||||
*
|
||||
* @param {Mixed} obj target of the assertion
|
||||
* @param {String} msg (optional) custom error message
|
||||
* @param {Function} ssfi (optional) starting point for removing stack frames
|
||||
* @param {Boolean} lockSsfi (optional) whether or not the ssfi flag is locked
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function Assertion (obj, msg, ssfi, lockSsfi) {
|
||||
flag(this, 'ssfi', ssfi || Assertion);
|
||||
flag(this, 'lockSsfi', lockSsfi);
|
||||
flag(this, 'object', obj);
|
||||
flag(this, 'message', msg);
|
||||
|
||||
return util.proxify(this);
|
||||
}
|
||||
|
||||
Object.defineProperty(Assertion, 'includeStack', {
|
||||
get: function() {
|
||||
console.warn('Assertion.includeStack is deprecated, use chai.config.includeStack instead.');
|
||||
return config.includeStack;
|
||||
},
|
||||
set: function(value) {
|
||||
console.warn('Assertion.includeStack is deprecated, use chai.config.includeStack instead.');
|
||||
config.includeStack = value;
|
||||
}
|
||||
});
|
||||
|
||||
Object.defineProperty(Assertion, 'showDiff', {
|
||||
get: function() {
|
||||
console.warn('Assertion.showDiff is deprecated, use chai.config.showDiff instead.');
|
||||
return config.showDiff;
|
||||
},
|
||||
set: function(value) {
|
||||
console.warn('Assertion.showDiff is deprecated, use chai.config.showDiff instead.');
|
||||
config.showDiff = value;
|
||||
}
|
||||
});
|
||||
|
||||
Assertion.addProperty = function (name, fn) {
|
||||
util.addProperty(this.prototype, name, fn);
|
||||
};
|
||||
|
||||
Assertion.addMethod = function (name, fn) {
|
||||
util.addMethod(this.prototype, name, fn);
|
||||
};
|
||||
|
||||
Assertion.addChainableMethod = function (name, fn, chainingBehavior) {
|
||||
util.addChainableMethod(this.prototype, name, fn, chainingBehavior);
|
||||
};
|
||||
|
||||
Assertion.overwriteProperty = function (name, fn) {
|
||||
util.overwriteProperty(this.prototype, name, fn);
|
||||
};
|
||||
|
||||
Assertion.overwriteMethod = function (name, fn) {
|
||||
util.overwriteMethod(this.prototype, name, fn);
|
||||
};
|
||||
|
||||
Assertion.overwriteChainableMethod = function (name, fn, chainingBehavior) {
|
||||
util.overwriteChainableMethod(this.prototype, name, fn, chainingBehavior);
|
||||
};
|
||||
|
||||
/**
|
||||
* ### .assert(expression, message, negateMessage, expected, actual, showDiff)
|
||||
*
|
||||
* 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|Function} message or function that returns message to display if expression fails
|
||||
* @param {String|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`
|
||||
* @param {Boolean} showDiff (optional) when set to `true`, assert will display a diff in addition to the message if expression fails
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Assertion.prototype.assert = function (expr, msg, negateMsg, expected, _actual, showDiff) {
|
||||
var ok = util.test(this, arguments);
|
||||
if (false !== showDiff) showDiff = true;
|
||||
if (undefined === expected && undefined === _actual) showDiff = false;
|
||||
if (true !== config.showDiff) showDiff = false;
|
||||
|
||||
if (!ok) {
|
||||
msg = util.getMessage(this, arguments);
|
||||
var actual = util.getActual(this, arguments);
|
||||
var assertionErrorObjectProperties = {
|
||||
actual: actual
|
||||
, expected: expected
|
||||
, showDiff: showDiff
|
||||
};
|
||||
|
||||
var operator = util.getOperator(this, arguments);
|
||||
if (operator) {
|
||||
assertionErrorObjectProperties.operator = operator;
|
||||
}
|
||||
|
||||
throw new AssertionError(
|
||||
msg,
|
||||
assertionErrorObjectProperties,
|
||||
(config.includeStack) ? this.assert : flag(this, 'ssfi'));
|
||||
}
|
||||
};
|
||||
|
||||
/*!
|
||||
* ### ._obj
|
||||
*
|
||||
* Quick reference to stored `actual` value for plugin developers.
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Object.defineProperty(Assertion.prototype, '_obj',
|
||||
{ get: function () {
|
||||
return flag(this, 'object');
|
||||
}
|
||||
, set: function (val) {
|
||||
flag(this, 'object', val);
|
||||
}
|
||||
});
|
||||
};
|
||||
94
node_modules/chai/lib/chai/config.js
generated
vendored
Normal file
94
node_modules/chai/lib/chai/config.js
generated
vendored
Normal file
@@ -0,0 +1,94 @@
|
||||
module.exports = {
|
||||
|
||||
/**
|
||||
* ### config.includeStack
|
||||
*
|
||||
* User configurable property, influences whether stack trace
|
||||
* is included in Assertion error message. Default of false
|
||||
* suppresses stack trace in the error message.
|
||||
*
|
||||
* chai.config.includeStack = true; // enable stack on error
|
||||
*
|
||||
* @param {Boolean}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
includeStack: false,
|
||||
|
||||
/**
|
||||
* ### config.showDiff
|
||||
*
|
||||
* User configurable property, influences whether or not
|
||||
* the `showDiff` flag should be included in the thrown
|
||||
* AssertionErrors. `false` will always be `false`; `true`
|
||||
* will be true when the assertion has requested a diff
|
||||
* be shown.
|
||||
*
|
||||
* @param {Boolean}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
showDiff: true,
|
||||
|
||||
/**
|
||||
* ### config.truncateThreshold
|
||||
*
|
||||
* User configurable property, sets length threshold for actual and
|
||||
* expected values in assertion errors. If this threshold is exceeded, for
|
||||
* example for large data structures, the value is replaced with something
|
||||
* like `[ Array(3) ]` or `{ Object (prop1, prop2) }`.
|
||||
*
|
||||
* Set it to zero if you want to disable truncating altogether.
|
||||
*
|
||||
* This is especially userful when doing assertions on arrays: having this
|
||||
* set to a reasonable large value makes the failure messages readily
|
||||
* inspectable.
|
||||
*
|
||||
* chai.config.truncateThreshold = 0; // disable truncating
|
||||
*
|
||||
* @param {Number}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
truncateThreshold: 40,
|
||||
|
||||
/**
|
||||
* ### config.useProxy
|
||||
*
|
||||
* User configurable property, defines if chai will use a Proxy to throw
|
||||
* an error when a non-existent property is read, which protects users
|
||||
* from typos when using property-based assertions.
|
||||
*
|
||||
* Set it to false if you want to disable this feature.
|
||||
*
|
||||
* chai.config.useProxy = false; // disable use of Proxy
|
||||
*
|
||||
* This feature is automatically disabled regardless of this config value
|
||||
* in environments that don't support proxies.
|
||||
*
|
||||
* @param {Boolean}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
useProxy: true,
|
||||
|
||||
/**
|
||||
* ### config.proxyExcludedKeys
|
||||
*
|
||||
* User configurable property, defines which properties should be ignored
|
||||
* instead of throwing an error if they do not exist on the assertion.
|
||||
* This is only applied if the environment Chai is running in supports proxies and
|
||||
* if the `useProxy` configuration setting is enabled.
|
||||
* By default, `then` and `inspect` will not throw an error if they do not exist on the
|
||||
* assertion object because the `.inspect` property is read by `util.inspect` (for example, when
|
||||
* using `console.log` on the assertion object) and `.then` is necessary for promise type-checking.
|
||||
*
|
||||
* // By default these keys will not throw an error if they do not exist on the assertion object
|
||||
* chai.config.proxyExcludedKeys = ['then', 'inspect'];
|
||||
*
|
||||
* @param {Array}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
proxyExcludedKeys: ['then', 'catch', 'inspect', 'toJSON']
|
||||
};
|
||||
3853
node_modules/chai/lib/chai/core/assertions.js
generated
vendored
Normal file
3853
node_modules/chai/lib/chai/core/assertions.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
3113
node_modules/chai/lib/chai/interface/assert.js
generated
vendored
Normal file
3113
node_modules/chai/lib/chai/interface/assert.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
47
node_modules/chai/lib/chai/interface/expect.js
generated
vendored
Normal file
47
node_modules/chai/lib/chai/interface/expect.js
generated
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
/*!
|
||||
* chai
|
||||
* Copyright(c) 2011-2014 Jake Luer <jake@alogicalparadox.com>
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
module.exports = function (chai, util) {
|
||||
chai.expect = function (val, message) {
|
||||
return new chai.Assertion(val, message);
|
||||
};
|
||||
|
||||
/**
|
||||
* ### .fail([message])
|
||||
* ### .fail(actual, expected, [message], [operator])
|
||||
*
|
||||
* Throw a failure.
|
||||
*
|
||||
* expect.fail();
|
||||
* expect.fail("custom error message");
|
||||
* expect.fail(1, 2);
|
||||
* expect.fail(1, 2, "custom error message");
|
||||
* expect.fail(1, 2, "custom error message", ">");
|
||||
* expect.fail(1, 2, undefined, ">");
|
||||
*
|
||||
* @name fail
|
||||
* @param {Mixed} actual
|
||||
* @param {Mixed} expected
|
||||
* @param {String} message
|
||||
* @param {String} operator
|
||||
* @namespace BDD
|
||||
* @api public
|
||||
*/
|
||||
|
||||
chai.expect.fail = function (actual, expected, message, operator) {
|
||||
if (arguments.length < 2) {
|
||||
message = actual;
|
||||
actual = undefined;
|
||||
}
|
||||
|
||||
message = message || 'expect.fail()';
|
||||
throw new chai.AssertionError(message, {
|
||||
actual: actual
|
||||
, expected: expected
|
||||
, operator: operator
|
||||
}, chai.expect.fail);
|
||||
};
|
||||
};
|
||||
219
node_modules/chai/lib/chai/interface/should.js
generated
vendored
Normal file
219
node_modules/chai/lib/chai/interface/should.js
generated
vendored
Normal file
@@ -0,0 +1,219 @@
|
||||
/*!
|
||||
* chai
|
||||
* Copyright(c) 2011-2014 Jake Luer <jake@alogicalparadox.com>
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
module.exports = function (chai, util) {
|
||||
var Assertion = chai.Assertion;
|
||||
|
||||
function loadShould () {
|
||||
// explicitly define this method as function as to have it's name to include as `ssfi`
|
||||
function shouldGetter() {
|
||||
if (this instanceof String
|
||||
|| this instanceof Number
|
||||
|| this instanceof Boolean
|
||||
|| typeof Symbol === 'function' && this instanceof Symbol
|
||||
|| typeof BigInt === 'function' && this instanceof BigInt) {
|
||||
return new Assertion(this.valueOf(), null, shouldGetter);
|
||||
}
|
||||
return new Assertion(this, null, shouldGetter);
|
||||
}
|
||||
function shouldSetter(value) {
|
||||
// See https://github.com/chaijs/chai/issues/86: this makes
|
||||
// `whatever.should = someValue` actually set `someValue`, which is
|
||||
// especially useful for `global.should = require('chai').should()`.
|
||||
//
|
||||
// Note that we have to use [[DefineProperty]] instead of [[Put]]
|
||||
// since otherwise we would trigger this very setter!
|
||||
Object.defineProperty(this, 'should', {
|
||||
value: value,
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
writable: true
|
||||
});
|
||||
}
|
||||
// modify Object.prototype to have `should`
|
||||
Object.defineProperty(Object.prototype, 'should', {
|
||||
set: shouldSetter
|
||||
, get: shouldGetter
|
||||
, configurable: true
|
||||
});
|
||||
|
||||
var should = {};
|
||||
|
||||
/**
|
||||
* ### .fail([message])
|
||||
* ### .fail(actual, expected, [message], [operator])
|
||||
*
|
||||
* Throw a failure.
|
||||
*
|
||||
* should.fail();
|
||||
* should.fail("custom error message");
|
||||
* should.fail(1, 2);
|
||||
* should.fail(1, 2, "custom error message");
|
||||
* should.fail(1, 2, "custom error message", ">");
|
||||
* should.fail(1, 2, undefined, ">");
|
||||
*
|
||||
*
|
||||
* @name fail
|
||||
* @param {Mixed} actual
|
||||
* @param {Mixed} expected
|
||||
* @param {String} message
|
||||
* @param {String} operator
|
||||
* @namespace BDD
|
||||
* @api public
|
||||
*/
|
||||
|
||||
should.fail = function (actual, expected, message, operator) {
|
||||
if (arguments.length < 2) {
|
||||
message = actual;
|
||||
actual = undefined;
|
||||
}
|
||||
|
||||
message = message || 'should.fail()';
|
||||
throw new chai.AssertionError(message, {
|
||||
actual: actual
|
||||
, expected: expected
|
||||
, operator: operator
|
||||
}, should.fail);
|
||||
};
|
||||
|
||||
/**
|
||||
* ### .equal(actual, expected, [message])
|
||||
*
|
||||
* Asserts non-strict equality (`==`) of `actual` and `expected`.
|
||||
*
|
||||
* should.equal(3, '3', '== coerces values to strings');
|
||||
*
|
||||
* @name equal
|
||||
* @param {Mixed} actual
|
||||
* @param {Mixed} expected
|
||||
* @param {String} message
|
||||
* @namespace Should
|
||||
* @api public
|
||||
*/
|
||||
|
||||
should.equal = function (val1, val2, msg) {
|
||||
new Assertion(val1, msg).to.equal(val2);
|
||||
};
|
||||
|
||||
/**
|
||||
* ### .throw(function, [constructor/string/regexp], [string/regexp], [message])
|
||||
*
|
||||
* Asserts that `function` will throw an error that is an instance of
|
||||
* `constructor`, or alternately that it will throw an error with message
|
||||
* matching `regexp`.
|
||||
*
|
||||
* should.throw(fn, 'function throws a reference error');
|
||||
* should.throw(fn, /function throws a reference error/);
|
||||
* should.throw(fn, ReferenceError);
|
||||
* should.throw(fn, ReferenceError, 'function throws a reference error');
|
||||
* should.throw(fn, ReferenceError, /function throws a reference error/);
|
||||
*
|
||||
* @name throw
|
||||
* @alias Throw
|
||||
* @param {Function} function
|
||||
* @param {ErrorConstructor} constructor
|
||||
* @param {RegExp} regexp
|
||||
* @param {String} message
|
||||
* @see https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Error#Error_types
|
||||
* @namespace Should
|
||||
* @api public
|
||||
*/
|
||||
|
||||
should.Throw = function (fn, errt, errs, msg) {
|
||||
new Assertion(fn, msg).to.Throw(errt, errs);
|
||||
};
|
||||
|
||||
/**
|
||||
* ### .exist
|
||||
*
|
||||
* Asserts that the target is neither `null` nor `undefined`.
|
||||
*
|
||||
* var foo = 'hi';
|
||||
*
|
||||
* should.exist(foo, 'foo exists');
|
||||
*
|
||||
* @name exist
|
||||
* @namespace Should
|
||||
* @api public
|
||||
*/
|
||||
|
||||
should.exist = function (val, msg) {
|
||||
new Assertion(val, msg).to.exist;
|
||||
}
|
||||
|
||||
// negation
|
||||
should.not = {}
|
||||
|
||||
/**
|
||||
* ### .not.equal(actual, expected, [message])
|
||||
*
|
||||
* Asserts non-strict inequality (`!=`) of `actual` and `expected`.
|
||||
*
|
||||
* should.not.equal(3, 4, 'these numbers are not equal');
|
||||
*
|
||||
* @name not.equal
|
||||
* @param {Mixed} actual
|
||||
* @param {Mixed} expected
|
||||
* @param {String} message
|
||||
* @namespace Should
|
||||
* @api public
|
||||
*/
|
||||
|
||||
should.not.equal = function (val1, val2, msg) {
|
||||
new Assertion(val1, msg).to.not.equal(val2);
|
||||
};
|
||||
|
||||
/**
|
||||
* ### .throw(function, [constructor/regexp], [message])
|
||||
*
|
||||
* Asserts that `function` will _not_ throw an error that is an instance of
|
||||
* `constructor`, or alternately that it will not throw an error with message
|
||||
* matching `regexp`.
|
||||
*
|
||||
* should.not.throw(fn, Error, 'function does not throw');
|
||||
*
|
||||
* @name not.throw
|
||||
* @alias not.Throw
|
||||
* @param {Function} function
|
||||
* @param {ErrorConstructor} constructor
|
||||
* @param {RegExp} regexp
|
||||
* @param {String} message
|
||||
* @see https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Error#Error_types
|
||||
* @namespace Should
|
||||
* @api public
|
||||
*/
|
||||
|
||||
should.not.Throw = function (fn, errt, errs, msg) {
|
||||
new Assertion(fn, msg).to.not.Throw(errt, errs);
|
||||
};
|
||||
|
||||
/**
|
||||
* ### .not.exist
|
||||
*
|
||||
* Asserts that the target is neither `null` nor `undefined`.
|
||||
*
|
||||
* var bar = null;
|
||||
*
|
||||
* should.not.exist(bar, 'bar does not exist');
|
||||
*
|
||||
* @name not.exist
|
||||
* @namespace Should
|
||||
* @api public
|
||||
*/
|
||||
|
||||
should.not.exist = function (val, msg) {
|
||||
new Assertion(val, msg).to.not.exist;
|
||||
}
|
||||
|
||||
should['throw'] = should['Throw'];
|
||||
should.not['throw'] = should.not['Throw'];
|
||||
|
||||
return should;
|
||||
};
|
||||
|
||||
chai.should = loadShould;
|
||||
chai.Should = loadShould;
|
||||
};
|
||||
152
node_modules/chai/lib/chai/utils/addChainableMethod.js
generated
vendored
Normal file
152
node_modules/chai/lib/chai/utils/addChainableMethod.js
generated
vendored
Normal file
@@ -0,0 +1,152 @@
|
||||
/*!
|
||||
* Chai - addChainingMethod utility
|
||||
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
/*!
|
||||
* Module dependencies
|
||||
*/
|
||||
|
||||
var addLengthGuard = require('./addLengthGuard');
|
||||
var chai = require('../../chai');
|
||||
var flag = require('./flag');
|
||||
var proxify = require('./proxify');
|
||||
var transferFlags = require('./transferFlags');
|
||||
|
||||
/*!
|
||||
* Module variables
|
||||
*/
|
||||
|
||||
// Check whether `Object.setPrototypeOf` is supported
|
||||
var canSetPrototype = typeof Object.setPrototypeOf === 'function';
|
||||
|
||||
// Without `Object.setPrototypeOf` support, this module will need to add properties to a function.
|
||||
// However, some of functions' own props are not configurable and should be skipped.
|
||||
var testFn = function() {};
|
||||
var excludeNames = Object.getOwnPropertyNames(testFn).filter(function(name) {
|
||||
var propDesc = Object.getOwnPropertyDescriptor(testFn, name);
|
||||
|
||||
// Note: PhantomJS 1.x includes `callee` as one of `testFn`'s own properties,
|
||||
// but then returns `undefined` as the property descriptor for `callee`. As a
|
||||
// workaround, we perform an otherwise unnecessary type-check for `propDesc`,
|
||||
// and then filter it out if it's not an object as it should be.
|
||||
if (typeof propDesc !== 'object')
|
||||
return true;
|
||||
|
||||
return !propDesc.configurable;
|
||||
});
|
||||
|
||||
// Cache `Function` properties
|
||||
var call = Function.prototype.call,
|
||||
apply = Function.prototype.apply;
|
||||
|
||||
/**
|
||||
* ### .addChainableMethod(ctx, name, method, chainingBehavior)
|
||||
*
|
||||
* Adds a method to an object, such that the method can also be chained.
|
||||
*
|
||||
* utils.addChainableMethod(chai.Assertion.prototype, 'foo', function (str) {
|
||||
* var obj = utils.flag(this, 'object');
|
||||
* new chai.Assertion(obj).to.be.equal(str);
|
||||
* });
|
||||
*
|
||||
* Can also be accessed directly from `chai.Assertion`.
|
||||
*
|
||||
* chai.Assertion.addChainableMethod('foo', fn, chainingBehavior);
|
||||
*
|
||||
* The result can then be used as both a method assertion, executing both `method` and
|
||||
* `chainingBehavior`, or as a language chain, which only executes `chainingBehavior`.
|
||||
*
|
||||
* expect(fooStr).to.be.foo('bar');
|
||||
* expect(fooStr).to.be.foo.equal('foo');
|
||||
*
|
||||
* @param {Object} ctx object to which the method is added
|
||||
* @param {String} name of method to add
|
||||
* @param {Function} method function to be used for `name`, when called
|
||||
* @param {Function} chainingBehavior function to be called every time the property is accessed
|
||||
* @namespace Utils
|
||||
* @name addChainableMethod
|
||||
* @api public
|
||||
*/
|
||||
|
||||
module.exports = function addChainableMethod(ctx, name, method, chainingBehavior) {
|
||||
if (typeof chainingBehavior !== 'function') {
|
||||
chainingBehavior = function () { };
|
||||
}
|
||||
|
||||
var chainableBehavior = {
|
||||
method: method
|
||||
, chainingBehavior: chainingBehavior
|
||||
};
|
||||
|
||||
// save the methods so we can overwrite them later, if we need to.
|
||||
if (!ctx.__methods) {
|
||||
ctx.__methods = {};
|
||||
}
|
||||
ctx.__methods[name] = chainableBehavior;
|
||||
|
||||
Object.defineProperty(ctx, name,
|
||||
{ get: function chainableMethodGetter() {
|
||||
chainableBehavior.chainingBehavior.call(this);
|
||||
|
||||
var chainableMethodWrapper = function () {
|
||||
// Setting the `ssfi` flag to `chainableMethodWrapper` causes this
|
||||
// function to be the starting point for removing implementation
|
||||
// frames from the stack trace of a failed assertion.
|
||||
//
|
||||
// However, we only want to use this function as the starting point if
|
||||
// the `lockSsfi` flag isn't set.
|
||||
//
|
||||
// If the `lockSsfi` flag is set, then this assertion is being
|
||||
// invoked from inside of another assertion. In this case, the `ssfi`
|
||||
// flag has already been set by the outer assertion.
|
||||
//
|
||||
// Note that overwriting a chainable method merely replaces the saved
|
||||
// methods in `ctx.__methods` instead of completely replacing the
|
||||
// overwritten assertion. Therefore, an overwriting assertion won't
|
||||
// set the `ssfi` or `lockSsfi` flags.
|
||||
if (!flag(this, 'lockSsfi')) {
|
||||
flag(this, 'ssfi', chainableMethodWrapper);
|
||||
}
|
||||
|
||||
var result = chainableBehavior.method.apply(this, arguments);
|
||||
if (result !== undefined) {
|
||||
return result;
|
||||
}
|
||||
|
||||
var newAssertion = new chai.Assertion();
|
||||
transferFlags(this, newAssertion);
|
||||
return newAssertion;
|
||||
};
|
||||
|
||||
addLengthGuard(chainableMethodWrapper, name, true);
|
||||
|
||||
// Use `Object.setPrototypeOf` if available
|
||||
if (canSetPrototype) {
|
||||
// Inherit all properties from the object by replacing the `Function` prototype
|
||||
var prototype = Object.create(this);
|
||||
// Restore the `call` and `apply` methods from `Function`
|
||||
prototype.call = call;
|
||||
prototype.apply = apply;
|
||||
Object.setPrototypeOf(chainableMethodWrapper, prototype);
|
||||
}
|
||||
// Otherwise, redefine all properties (slow!)
|
||||
else {
|
||||
var asserterNames = Object.getOwnPropertyNames(ctx);
|
||||
asserterNames.forEach(function (asserterName) {
|
||||
if (excludeNames.indexOf(asserterName) !== -1) {
|
||||
return;
|
||||
}
|
||||
|
||||
var pd = Object.getOwnPropertyDescriptor(ctx, asserterName);
|
||||
Object.defineProperty(chainableMethodWrapper, asserterName, pd);
|
||||
});
|
||||
}
|
||||
|
||||
transferFlags(this, chainableMethodWrapper);
|
||||
return proxify(chainableMethodWrapper);
|
||||
}
|
||||
, configurable: true
|
||||
});
|
||||
};
|
||||
60
node_modules/chai/lib/chai/utils/addLengthGuard.js
generated
vendored
Normal file
60
node_modules/chai/lib/chai/utils/addLengthGuard.js
generated
vendored
Normal file
@@ -0,0 +1,60 @@
|
||||
var fnLengthDesc = Object.getOwnPropertyDescriptor(function () {}, 'length');
|
||||
|
||||
/*!
|
||||
* Chai - addLengthGuard utility
|
||||
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
/**
|
||||
* ### .addLengthGuard(fn, assertionName, isChainable)
|
||||
*
|
||||
* Define `length` as a getter on the given uninvoked method assertion. The
|
||||
* getter acts as a guard against chaining `length` directly off of an uninvoked
|
||||
* method assertion, which is a problem because it references `function`'s
|
||||
* built-in `length` property instead of Chai's `length` assertion. When the
|
||||
* getter catches the user making this mistake, it throws an error with a
|
||||
* helpful message.
|
||||
*
|
||||
* There are two ways in which this mistake can be made. The first way is by
|
||||
* chaining the `length` assertion directly off of an uninvoked chainable
|
||||
* method. In this case, Chai suggests that the user use `lengthOf` instead. The
|
||||
* second way is by chaining the `length` assertion directly off of an uninvoked
|
||||
* non-chainable method. Non-chainable methods must be invoked prior to
|
||||
* chaining. In this case, Chai suggests that the user consult the docs for the
|
||||
* given assertion.
|
||||
*
|
||||
* If the `length` property of functions is unconfigurable, then return `fn`
|
||||
* without modification.
|
||||
*
|
||||
* Note that in ES6, the function's `length` property is configurable, so once
|
||||
* support for legacy environments is dropped, Chai's `length` property can
|
||||
* replace the built-in function's `length` property, and this length guard will
|
||||
* no longer be necessary. In the mean time, maintaining consistency across all
|
||||
* environments is the priority.
|
||||
*
|
||||
* @param {Function} fn
|
||||
* @param {String} assertionName
|
||||
* @param {Boolean} isChainable
|
||||
* @namespace Utils
|
||||
* @name addLengthGuard
|
||||
*/
|
||||
|
||||
module.exports = function addLengthGuard (fn, assertionName, isChainable) {
|
||||
if (!fnLengthDesc.configurable) return fn;
|
||||
|
||||
Object.defineProperty(fn, 'length', {
|
||||
get: function () {
|
||||
if (isChainable) {
|
||||
throw Error('Invalid Chai property: ' + assertionName + '.length. Due' +
|
||||
' to a compatibility issue, "length" cannot directly follow "' +
|
||||
assertionName + '". Use "' + assertionName + '.lengthOf" instead.');
|
||||
}
|
||||
|
||||
throw Error('Invalid Chai property: ' + assertionName + '.length. See' +
|
||||
' docs for proper usage of "' + assertionName + '".');
|
||||
}
|
||||
});
|
||||
|
||||
return fn;
|
||||
};
|
||||
68
node_modules/chai/lib/chai/utils/addMethod.js
generated
vendored
Normal file
68
node_modules/chai/lib/chai/utils/addMethod.js
generated
vendored
Normal file
@@ -0,0 +1,68 @@
|
||||
/*!
|
||||
* Chai - addMethod utility
|
||||
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
var addLengthGuard = require('./addLengthGuard');
|
||||
var chai = require('../../chai');
|
||||
var flag = require('./flag');
|
||||
var proxify = require('./proxify');
|
||||
var transferFlags = require('./transferFlags');
|
||||
|
||||
/**
|
||||
* ### .addMethod(ctx, name, method)
|
||||
*
|
||||
* Adds a method to the prototype of an object.
|
||||
*
|
||||
* utils.addMethod(chai.Assertion.prototype, 'foo', function (str) {
|
||||
* var obj = utils.flag(this, 'object');
|
||||
* new chai.Assertion(obj).to.be.equal(str);
|
||||
* });
|
||||
*
|
||||
* Can also be accessed directly from `chai.Assertion`.
|
||||
*
|
||||
* chai.Assertion.addMethod('foo', fn);
|
||||
*
|
||||
* Then can be used as any other assertion.
|
||||
*
|
||||
* expect(fooStr).to.be.foo('bar');
|
||||
*
|
||||
* @param {Object} ctx object to which the method is added
|
||||
* @param {String} name of method to add
|
||||
* @param {Function} method function to be used for name
|
||||
* @namespace Utils
|
||||
* @name addMethod
|
||||
* @api public
|
||||
*/
|
||||
|
||||
module.exports = function addMethod(ctx, name, method) {
|
||||
var methodWrapper = function () {
|
||||
// Setting the `ssfi` flag to `methodWrapper` causes this function to be the
|
||||
// starting point for removing implementation frames from the stack trace of
|
||||
// a failed assertion.
|
||||
//
|
||||
// However, we only want to use this function as the starting point if the
|
||||
// `lockSsfi` flag isn't set.
|
||||
//
|
||||
// If the `lockSsfi` flag is set, then either this assertion has been
|
||||
// overwritten by another assertion, or this assertion is being invoked from
|
||||
// inside of another assertion. In the first case, the `ssfi` flag has
|
||||
// already been set by the overwriting assertion. In the second case, the
|
||||
// `ssfi` flag has already been set by the outer assertion.
|
||||
if (!flag(this, 'lockSsfi')) {
|
||||
flag(this, 'ssfi', methodWrapper);
|
||||
}
|
||||
|
||||
var result = method.apply(this, arguments);
|
||||
if (result !== undefined)
|
||||
return result;
|
||||
|
||||
var newAssertion = new chai.Assertion();
|
||||
transferFlags(this, newAssertion);
|
||||
return newAssertion;
|
||||
};
|
||||
|
||||
addLengthGuard(methodWrapper, name, false);
|
||||
ctx[name] = proxify(methodWrapper, name);
|
||||
};
|
||||
72
node_modules/chai/lib/chai/utils/addProperty.js
generated
vendored
Normal file
72
node_modules/chai/lib/chai/utils/addProperty.js
generated
vendored
Normal file
@@ -0,0 +1,72 @@
|
||||
/*!
|
||||
* Chai - addProperty utility
|
||||
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
var chai = require('../../chai');
|
||||
var flag = require('./flag');
|
||||
var isProxyEnabled = require('./isProxyEnabled');
|
||||
var transferFlags = require('./transferFlags');
|
||||
|
||||
/**
|
||||
* ### .addProperty(ctx, name, getter)
|
||||
*
|
||||
* Adds a property to the prototype of an object.
|
||||
*
|
||||
* utils.addProperty(chai.Assertion.prototype, 'foo', function () {
|
||||
* var obj = utils.flag(this, 'object');
|
||||
* new chai.Assertion(obj).to.be.instanceof(Foo);
|
||||
* });
|
||||
*
|
||||
* Can also be accessed directly from `chai.Assertion`.
|
||||
*
|
||||
* chai.Assertion.addProperty('foo', fn);
|
||||
*
|
||||
* Then can be used as any other assertion.
|
||||
*
|
||||
* expect(myFoo).to.be.foo;
|
||||
*
|
||||
* @param {Object} ctx object to which the property is added
|
||||
* @param {String} name of property to add
|
||||
* @param {Function} getter function to be used for name
|
||||
* @namespace Utils
|
||||
* @name addProperty
|
||||
* @api public
|
||||
*/
|
||||
|
||||
module.exports = function addProperty(ctx, name, getter) {
|
||||
getter = getter === undefined ? function () {} : getter;
|
||||
|
||||
Object.defineProperty(ctx, name,
|
||||
{ get: function propertyGetter() {
|
||||
// Setting the `ssfi` flag to `propertyGetter` causes this function to
|
||||
// be the starting point for removing implementation frames from the
|
||||
// stack trace of a failed assertion.
|
||||
//
|
||||
// However, we only want to use this function as the starting point if
|
||||
// the `lockSsfi` flag isn't set and proxy protection is disabled.
|
||||
//
|
||||
// If the `lockSsfi` flag is set, then either this assertion has been
|
||||
// overwritten by another assertion, or this assertion is being invoked
|
||||
// from inside of another assertion. In the first case, the `ssfi` flag
|
||||
// has already been set by the overwriting assertion. In the second
|
||||
// case, the `ssfi` flag has already been set by the outer assertion.
|
||||
//
|
||||
// If proxy protection is enabled, then the `ssfi` flag has already been
|
||||
// set by the proxy getter.
|
||||
if (!isProxyEnabled() && !flag(this, 'lockSsfi')) {
|
||||
flag(this, 'ssfi', propertyGetter);
|
||||
}
|
||||
|
||||
var result = getter.call(this);
|
||||
if (result !== undefined)
|
||||
return result;
|
||||
|
||||
var newAssertion = new chai.Assertion();
|
||||
transferFlags(this, newAssertion);
|
||||
return newAssertion;
|
||||
}
|
||||
, configurable: true
|
||||
});
|
||||
};
|
||||
31
node_modules/chai/lib/chai/utils/compareByInspect.js
generated
vendored
Normal file
31
node_modules/chai/lib/chai/utils/compareByInspect.js
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
/*!
|
||||
* Chai - compareByInspect utility
|
||||
* Copyright(c) 2011-2016 Jake Luer <jake@alogicalparadox.com>
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
/*!
|
||||
* Module dependencies
|
||||
*/
|
||||
|
||||
var inspect = require('./inspect');
|
||||
|
||||
/**
|
||||
* ### .compareByInspect(mixed, mixed)
|
||||
*
|
||||
* To be used as a compareFunction with Array.prototype.sort. Compares elements
|
||||
* using inspect instead of default behavior of using toString so that Symbols
|
||||
* and objects with irregular/missing toString can still be sorted without a
|
||||
* TypeError.
|
||||
*
|
||||
* @param {Mixed} first element to compare
|
||||
* @param {Mixed} second element to compare
|
||||
* @returns {Number} -1 if 'a' should come before 'b'; otherwise 1
|
||||
* @name compareByInspect
|
||||
* @namespace Utils
|
||||
* @api public
|
||||
*/
|
||||
|
||||
module.exports = function compareByInspect(a, b) {
|
||||
return inspect(a) < inspect(b) ? -1 : 1;
|
||||
};
|
||||
51
node_modules/chai/lib/chai/utils/expectTypes.js
generated
vendored
Normal file
51
node_modules/chai/lib/chai/utils/expectTypes.js
generated
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
/*!
|
||||
* Chai - expectTypes utility
|
||||
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
/**
|
||||
* ### .expectTypes(obj, types)
|
||||
*
|
||||
* Ensures that the object being tested against is of a valid type.
|
||||
*
|
||||
* utils.expectTypes(this, ['array', 'object', 'string']);
|
||||
*
|
||||
* @param {Mixed} obj constructed Assertion
|
||||
* @param {Array} type A list of allowed types for this assertion
|
||||
* @namespace Utils
|
||||
* @name expectTypes
|
||||
* @api public
|
||||
*/
|
||||
|
||||
var AssertionError = require('assertion-error');
|
||||
var flag = require('./flag');
|
||||
var type = require('type-detect');
|
||||
|
||||
module.exports = function expectTypes(obj, types) {
|
||||
var flagMsg = flag(obj, 'message');
|
||||
var ssfi = flag(obj, 'ssfi');
|
||||
|
||||
flagMsg = flagMsg ? flagMsg + ': ' : '';
|
||||
|
||||
obj = flag(obj, 'object');
|
||||
types = types.map(function (t) { return t.toLowerCase(); });
|
||||
types.sort();
|
||||
|
||||
// Transforms ['lorem', 'ipsum'] into 'a lorem, or an ipsum'
|
||||
var str = types.map(function (t, index) {
|
||||
var art = ~[ 'a', 'e', 'i', 'o', 'u' ].indexOf(t.charAt(0)) ? 'an' : 'a';
|
||||
var or = types.length > 1 && index === types.length - 1 ? 'or ' : '';
|
||||
return or + art + ' ' + t;
|
||||
}).join(', ');
|
||||
|
||||
var objType = type(obj).toLowerCase();
|
||||
|
||||
if (!types.some(function (expected) { return objType === expected; })) {
|
||||
throw new AssertionError(
|
||||
flagMsg + 'object tested must be ' + str + ', but ' + objType + ' given',
|
||||
undefined,
|
||||
ssfi
|
||||
);
|
||||
}
|
||||
};
|
||||
33
node_modules/chai/lib/chai/utils/flag.js
generated
vendored
Normal file
33
node_modules/chai/lib/chai/utils/flag.js
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
/*!
|
||||
* Chai - flag utility
|
||||
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
/**
|
||||
* ### .flag(object, key, [value])
|
||||
*
|
||||
* Get or set a flag value on an object. If a
|
||||
* value is provided it will be set, else it will
|
||||
* return the currently set value or `undefined` if
|
||||
* the value is not set.
|
||||
*
|
||||
* utils.flag(this, 'foo', 'bar'); // setter
|
||||
* utils.flag(this, 'foo'); // getter, returns `bar`
|
||||
*
|
||||
* @param {Object} object constructed Assertion
|
||||
* @param {String} key
|
||||
* @param {Mixed} value (optional)
|
||||
* @namespace Utils
|
||||
* @name flag
|
||||
* @api private
|
||||
*/
|
||||
|
||||
module.exports = function flag(obj, key, value) {
|
||||
var flags = obj.__flags || (obj.__flags = Object.create(null));
|
||||
if (arguments.length === 3) {
|
||||
flags[key] = value;
|
||||
} else {
|
||||
return flags[key];
|
||||
}
|
||||
};
|
||||
20
node_modules/chai/lib/chai/utils/getActual.js
generated
vendored
Normal file
20
node_modules/chai/lib/chai/utils/getActual.js
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
/*!
|
||||
* Chai - getActual utility
|
||||
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
/**
|
||||
* ### .getActual(object, [actual])
|
||||
*
|
||||
* Returns the `actual` value for an Assertion.
|
||||
*
|
||||
* @param {Object} object (constructed Assertion)
|
||||
* @param {Arguments} chai.Assertion.prototype.assert arguments
|
||||
* @namespace Utils
|
||||
* @name getActual
|
||||
*/
|
||||
|
||||
module.exports = function getActual(obj, args) {
|
||||
return args.length > 4 ? args[4] : obj._obj;
|
||||
};
|
||||
26
node_modules/chai/lib/chai/utils/getEnumerableProperties.js
generated
vendored
Normal file
26
node_modules/chai/lib/chai/utils/getEnumerableProperties.js
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
/*!
|
||||
* Chai - getEnumerableProperties utility
|
||||
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
/**
|
||||
* ### .getEnumerableProperties(object)
|
||||
*
|
||||
* This allows the retrieval of enumerable property names of an object,
|
||||
* inherited or not.
|
||||
*
|
||||
* @param {Object} object
|
||||
* @returns {Array}
|
||||
* @namespace Utils
|
||||
* @name getEnumerableProperties
|
||||
* @api public
|
||||
*/
|
||||
|
||||
module.exports = function getEnumerableProperties(object) {
|
||||
var result = [];
|
||||
for (var name in object) {
|
||||
result.push(name);
|
||||
}
|
||||
return result;
|
||||
};
|
||||
50
node_modules/chai/lib/chai/utils/getMessage.js
generated
vendored
Normal file
50
node_modules/chai/lib/chai/utils/getMessage.js
generated
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
/*!
|
||||
* Chai - message composition utility
|
||||
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
/*!
|
||||
* Module dependencies
|
||||
*/
|
||||
|
||||
var flag = require('./flag')
|
||||
, getActual = require('./getActual')
|
||||
, objDisplay = require('./objDisplay');
|
||||
|
||||
/**
|
||||
* ### .getMessage(object, message, negateMessage)
|
||||
*
|
||||
* Construct the error message based on flags
|
||||
* and template tags. Template tags will return
|
||||
* a stringified inspection of the object referenced.
|
||||
*
|
||||
* Message template tags:
|
||||
* - `#{this}` current asserted object
|
||||
* - `#{act}` actual value
|
||||
* - `#{exp}` expected value
|
||||
*
|
||||
* @param {Object} object (constructed Assertion)
|
||||
* @param {Arguments} chai.Assertion.prototype.assert arguments
|
||||
* @namespace Utils
|
||||
* @name getMessage
|
||||
* @api public
|
||||
*/
|
||||
|
||||
module.exports = function getMessage(obj, args) {
|
||||
var negate = flag(obj, 'negate')
|
||||
, val = flag(obj, 'object')
|
||||
, 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, function () { return objDisplay(val); })
|
||||
.replace(/#\{act\}/g, function () { return objDisplay(actual); })
|
||||
.replace(/#\{exp\}/g, function () { return objDisplay(expected); });
|
||||
|
||||
return flagMsg ? flagMsg + ': ' + msg : msg;
|
||||
};
|
||||
55
node_modules/chai/lib/chai/utils/getOperator.js
generated
vendored
Normal file
55
node_modules/chai/lib/chai/utils/getOperator.js
generated
vendored
Normal file
@@ -0,0 +1,55 @@
|
||||
var type = require('type-detect');
|
||||
|
||||
var flag = require('./flag');
|
||||
|
||||
function isObjectType(obj) {
|
||||
var objectType = type(obj);
|
||||
var objectTypes = ['Array', 'Object', 'function'];
|
||||
|
||||
return objectTypes.indexOf(objectType) !== -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* ### .getOperator(message)
|
||||
*
|
||||
* Extract the operator from error message.
|
||||
* Operator defined is based on below link
|
||||
* https://nodejs.org/api/assert.html#assert_assert.
|
||||
*
|
||||
* Returns the `operator` or `undefined` value for an Assertion.
|
||||
*
|
||||
* @param {Object} object (constructed Assertion)
|
||||
* @param {Arguments} chai.Assertion.prototype.assert arguments
|
||||
* @namespace Utils
|
||||
* @name getOperator
|
||||
* @api public
|
||||
*/
|
||||
|
||||
module.exports = function getOperator(obj, args) {
|
||||
var operator = flag(obj, 'operator');
|
||||
var negate = flag(obj, 'negate');
|
||||
var expected = args[3];
|
||||
var msg = negate ? args[2] : args[1];
|
||||
|
||||
if (operator) {
|
||||
return operator;
|
||||
}
|
||||
|
||||
if (typeof msg === 'function') msg = msg();
|
||||
|
||||
msg = msg || '';
|
||||
if (!msg) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
if (/\shave\s/.test(msg)) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
var isObject = isObjectType(expected);
|
||||
if (/\snot\s/.test(msg)) {
|
||||
return isObject ? 'notDeepStrictEqual' : 'notStrictEqual';
|
||||
}
|
||||
|
||||
return isObject ? 'deepStrictEqual' : 'strictEqual';
|
||||
};
|
||||
29
node_modules/chai/lib/chai/utils/getOwnEnumerableProperties.js
generated
vendored
Normal file
29
node_modules/chai/lib/chai/utils/getOwnEnumerableProperties.js
generated
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
/*!
|
||||
* Chai - getOwnEnumerableProperties utility
|
||||
* Copyright(c) 2011-2016 Jake Luer <jake@alogicalparadox.com>
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
/*!
|
||||
* Module dependencies
|
||||
*/
|
||||
|
||||
var getOwnEnumerablePropertySymbols = require('./getOwnEnumerablePropertySymbols');
|
||||
|
||||
/**
|
||||
* ### .getOwnEnumerableProperties(object)
|
||||
*
|
||||
* This allows the retrieval of directly-owned enumerable property names and
|
||||
* symbols of an object. This function is necessary because Object.keys only
|
||||
* returns enumerable property names, not enumerable property symbols.
|
||||
*
|
||||
* @param {Object} object
|
||||
* @returns {Array}
|
||||
* @namespace Utils
|
||||
* @name getOwnEnumerableProperties
|
||||
* @api public
|
||||
*/
|
||||
|
||||
module.exports = function getOwnEnumerableProperties(obj) {
|
||||
return Object.keys(obj).concat(getOwnEnumerablePropertySymbols(obj));
|
||||
};
|
||||
27
node_modules/chai/lib/chai/utils/getOwnEnumerablePropertySymbols.js
generated
vendored
Normal file
27
node_modules/chai/lib/chai/utils/getOwnEnumerablePropertySymbols.js
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
/*!
|
||||
* Chai - getOwnEnumerablePropertySymbols utility
|
||||
* Copyright(c) 2011-2016 Jake Luer <jake@alogicalparadox.com>
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
/**
|
||||
* ### .getOwnEnumerablePropertySymbols(object)
|
||||
*
|
||||
* This allows the retrieval of directly-owned enumerable property symbols of an
|
||||
* object. This function is necessary because Object.getOwnPropertySymbols
|
||||
* returns both enumerable and non-enumerable property symbols.
|
||||
*
|
||||
* @param {Object} object
|
||||
* @returns {Array}
|
||||
* @namespace Utils
|
||||
* @name getOwnEnumerablePropertySymbols
|
||||
* @api public
|
||||
*/
|
||||
|
||||
module.exports = function getOwnEnumerablePropertySymbols(obj) {
|
||||
if (typeof Object.getOwnPropertySymbols !== 'function') return [];
|
||||
|
||||
return Object.getOwnPropertySymbols(obj).filter(function (sym) {
|
||||
return Object.getOwnPropertyDescriptor(obj, sym).enumerable;
|
||||
});
|
||||
};
|
||||
36
node_modules/chai/lib/chai/utils/getProperties.js
generated
vendored
Normal file
36
node_modules/chai/lib/chai/utils/getProperties.js
generated
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
/*!
|
||||
* Chai - getProperties utility
|
||||
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
/**
|
||||
* ### .getProperties(object)
|
||||
*
|
||||
* This allows the retrieval of property names of an object, enumerable or not,
|
||||
* inherited or not.
|
||||
*
|
||||
* @param {Object} object
|
||||
* @returns {Array}
|
||||
* @namespace Utils
|
||||
* @name getProperties
|
||||
* @api public
|
||||
*/
|
||||
|
||||
module.exports = function getProperties(object) {
|
||||
var result = Object.getOwnPropertyNames(object);
|
||||
|
||||
function addProperty(property) {
|
||||
if (result.indexOf(property) === -1) {
|
||||
result.push(property);
|
||||
}
|
||||
}
|
||||
|
||||
var proto = Object.getPrototypeOf(object);
|
||||
while (proto !== null) {
|
||||
Object.getOwnPropertyNames(proto).forEach(addProperty);
|
||||
proto = Object.getPrototypeOf(proto);
|
||||
}
|
||||
|
||||
return result;
|
||||
};
|
||||
178
node_modules/chai/lib/chai/utils/index.js
generated
vendored
Normal file
178
node_modules/chai/lib/chai/utils/index.js
generated
vendored
Normal file
@@ -0,0 +1,178 @@
|
||||
/*!
|
||||
* chai
|
||||
* Copyright(c) 2011 Jake Luer <jake@alogicalparadox.com>
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
/*!
|
||||
* Dependencies that are used for multiple exports are required here only once
|
||||
*/
|
||||
|
||||
var pathval = require('pathval');
|
||||
|
||||
/*!
|
||||
* test utility
|
||||
*/
|
||||
|
||||
exports.test = require('./test');
|
||||
|
||||
/*!
|
||||
* type utility
|
||||
*/
|
||||
|
||||
exports.type = require('type-detect');
|
||||
|
||||
/*!
|
||||
* expectTypes utility
|
||||
*/
|
||||
exports.expectTypes = require('./expectTypes');
|
||||
|
||||
/*!
|
||||
* message utility
|
||||
*/
|
||||
|
||||
exports.getMessage = require('./getMessage');
|
||||
|
||||
/*!
|
||||
* actual utility
|
||||
*/
|
||||
|
||||
exports.getActual = require('./getActual');
|
||||
|
||||
/*!
|
||||
* Inspect util
|
||||
*/
|
||||
|
||||
exports.inspect = require('./inspect');
|
||||
|
||||
/*!
|
||||
* Object Display util
|
||||
*/
|
||||
|
||||
exports.objDisplay = require('./objDisplay');
|
||||
|
||||
/*!
|
||||
* Flag utility
|
||||
*/
|
||||
|
||||
exports.flag = require('./flag');
|
||||
|
||||
/*!
|
||||
* Flag transferring utility
|
||||
*/
|
||||
|
||||
exports.transferFlags = require('./transferFlags');
|
||||
|
||||
/*!
|
||||
* Deep equal utility
|
||||
*/
|
||||
|
||||
exports.eql = require('deep-eql');
|
||||
|
||||
/*!
|
||||
* Deep path info
|
||||
*/
|
||||
|
||||
exports.getPathInfo = pathval.getPathInfo;
|
||||
|
||||
/*!
|
||||
* Check if a property exists
|
||||
*/
|
||||
|
||||
exports.hasProperty = pathval.hasProperty;
|
||||
|
||||
/*!
|
||||
* Function name
|
||||
*/
|
||||
|
||||
exports.getName = require('get-func-name');
|
||||
|
||||
/*!
|
||||
* add Property
|
||||
*/
|
||||
|
||||
exports.addProperty = require('./addProperty');
|
||||
|
||||
/*!
|
||||
* add Method
|
||||
*/
|
||||
|
||||
exports.addMethod = require('./addMethod');
|
||||
|
||||
/*!
|
||||
* overwrite Property
|
||||
*/
|
||||
|
||||
exports.overwriteProperty = require('./overwriteProperty');
|
||||
|
||||
/*!
|
||||
* overwrite Method
|
||||
*/
|
||||
|
||||
exports.overwriteMethod = require('./overwriteMethod');
|
||||
|
||||
/*!
|
||||
* Add a chainable method
|
||||
*/
|
||||
|
||||
exports.addChainableMethod = require('./addChainableMethod');
|
||||
|
||||
/*!
|
||||
* Overwrite chainable method
|
||||
*/
|
||||
|
||||
exports.overwriteChainableMethod = require('./overwriteChainableMethod');
|
||||
|
||||
/*!
|
||||
* Compare by inspect method
|
||||
*/
|
||||
|
||||
exports.compareByInspect = require('./compareByInspect');
|
||||
|
||||
/*!
|
||||
* Get own enumerable property symbols method
|
||||
*/
|
||||
|
||||
exports.getOwnEnumerablePropertySymbols = require('./getOwnEnumerablePropertySymbols');
|
||||
|
||||
/*!
|
||||
* Get own enumerable properties method
|
||||
*/
|
||||
|
||||
exports.getOwnEnumerableProperties = require('./getOwnEnumerableProperties');
|
||||
|
||||
/*!
|
||||
* Checks error against a given set of criteria
|
||||
*/
|
||||
|
||||
exports.checkError = require('check-error');
|
||||
|
||||
/*!
|
||||
* Proxify util
|
||||
*/
|
||||
|
||||
exports.proxify = require('./proxify');
|
||||
|
||||
/*!
|
||||
* addLengthGuard util
|
||||
*/
|
||||
|
||||
exports.addLengthGuard = require('./addLengthGuard');
|
||||
|
||||
/*!
|
||||
* isProxyEnabled helper
|
||||
*/
|
||||
|
||||
exports.isProxyEnabled = require('./isProxyEnabled');
|
||||
|
||||
/*!
|
||||
* isNaN method
|
||||
*/
|
||||
|
||||
exports.isNaN = require('./isNaN');
|
||||
|
||||
/*!
|
||||
* getOperator method
|
||||
*/
|
||||
|
||||
exports.getOperator = require('./getOperator');
|
||||
33
node_modules/chai/lib/chai/utils/inspect.js
generated
vendored
Normal file
33
node_modules/chai/lib/chai/utils/inspect.js
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
// This is (almost) directly from Node.js utils
|
||||
// https://github.com/joyent/node/blob/f8c335d0caf47f16d31413f89aa28eda3878e3aa/lib/util.js
|
||||
|
||||
var getName = require('get-func-name');
|
||||
var loupe = require('loupe');
|
||||
var config = require('../config');
|
||||
|
||||
module.exports = inspect;
|
||||
|
||||
/**
|
||||
* ### .inspect(obj, [showHidden], [depth], [colors])
|
||||
*
|
||||
* Echoes the value of a value. Tries to print the value out
|
||||
* in the best way possible given the different types.
|
||||
*
|
||||
* @param {Object} obj The object to print out.
|
||||
* @param {Boolean} showHidden Flag that shows hidden (not enumerable)
|
||||
* properties of objects. Default is false.
|
||||
* @param {Number} depth Depth in which to descend in object. Default is 2.
|
||||
* @param {Boolean} colors Flag to turn on ANSI escape codes to color the
|
||||
* output. Default is false (no coloring).
|
||||
* @namespace Utils
|
||||
* @name inspect
|
||||
*/
|
||||
function inspect(obj, showHidden, depth, colors) {
|
||||
var options = {
|
||||
colors: colors,
|
||||
depth: (typeof depth === 'undefined' ? 2 : depth),
|
||||
showHidden: showHidden,
|
||||
truncate: config.truncateThreshold ? config.truncateThreshold : Infinity,
|
||||
};
|
||||
return loupe.inspect(obj, options);
|
||||
}
|
||||
26
node_modules/chai/lib/chai/utils/isNaN.js
generated
vendored
Normal file
26
node_modules/chai/lib/chai/utils/isNaN.js
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
/*!
|
||||
* Chai - isNaN utility
|
||||
* Copyright(c) 2012-2015 Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
/**
|
||||
* ### .isNaN(value)
|
||||
*
|
||||
* Checks if the given value is NaN or not.
|
||||
*
|
||||
* utils.isNaN(NaN); // true
|
||||
*
|
||||
* @param {Value} The value which has to be checked if it is NaN
|
||||
* @name isNaN
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function isNaN(value) {
|
||||
// Refer http://www.ecma-international.org/ecma-262/6.0/#sec-isnan-number
|
||||
// section's NOTE.
|
||||
return value !== value;
|
||||
}
|
||||
|
||||
// If ECMAScript 6's Number.isNaN is present, prefer that.
|
||||
module.exports = Number.isNaN || isNaN;
|
||||
24
node_modules/chai/lib/chai/utils/isProxyEnabled.js
generated
vendored
Normal file
24
node_modules/chai/lib/chai/utils/isProxyEnabled.js
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
var config = require('../config');
|
||||
|
||||
/*!
|
||||
* Chai - isProxyEnabled helper
|
||||
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
/**
|
||||
* ### .isProxyEnabled()
|
||||
*
|
||||
* Helper function to check if Chai's proxy protection feature is enabled. If
|
||||
* proxies are unsupported or disabled via the user's Chai config, then return
|
||||
* false. Otherwise, return true.
|
||||
*
|
||||
* @namespace Utils
|
||||
* @name isProxyEnabled
|
||||
*/
|
||||
|
||||
module.exports = function isProxyEnabled() {
|
||||
return config.useProxy &&
|
||||
typeof Proxy !== 'undefined' &&
|
||||
typeof Reflect !== 'undefined';
|
||||
};
|
||||
50
node_modules/chai/lib/chai/utils/objDisplay.js
generated
vendored
Normal file
50
node_modules/chai/lib/chai/utils/objDisplay.js
generated
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
/*!
|
||||
* Chai - flag utility
|
||||
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
/*!
|
||||
* Module dependencies
|
||||
*/
|
||||
|
||||
var inspect = require('./inspect');
|
||||
var config = require('../config');
|
||||
|
||||
/**
|
||||
* ### .objDisplay(object)
|
||||
*
|
||||
* Determines if an object or an array matches
|
||||
* criteria to be inspected in-line for error
|
||||
* messages or should be truncated.
|
||||
*
|
||||
* @param {Mixed} javascript object to inspect
|
||||
* @name objDisplay
|
||||
* @namespace Utils
|
||||
* @api public
|
||||
*/
|
||||
|
||||
module.exports = function objDisplay(obj) {
|
||||
var str = inspect(obj)
|
||||
, type = Object.prototype.toString.call(obj);
|
||||
|
||||
if (config.truncateThreshold && str.length >= config.truncateThreshold) {
|
||||
if (type === '[object Function]') {
|
||||
return !obj.name || obj.name === ''
|
||||
? '[Function]'
|
||||
: '[Function: ' + obj.name + ']';
|
||||
} else if (type === '[object Array]') {
|
||||
return '[ Array(' + obj.length + ') ]';
|
||||
} else if (type === '[object Object]') {
|
||||
var keys = Object.keys(obj)
|
||||
, kstr = keys.length > 2
|
||||
? keys.splice(0, 2).join(', ') + ', ...'
|
||||
: keys.join(', ');
|
||||
return '{ Object (' + kstr + ') }';
|
||||
} else {
|
||||
return str;
|
||||
}
|
||||
} else {
|
||||
return str;
|
||||
}
|
||||
};
|
||||
69
node_modules/chai/lib/chai/utils/overwriteChainableMethod.js
generated
vendored
Normal file
69
node_modules/chai/lib/chai/utils/overwriteChainableMethod.js
generated
vendored
Normal file
@@ -0,0 +1,69 @@
|
||||
/*!
|
||||
* Chai - overwriteChainableMethod utility
|
||||
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
var chai = require('../../chai');
|
||||
var transferFlags = require('./transferFlags');
|
||||
|
||||
/**
|
||||
* ### .overwriteChainableMethod(ctx, name, method, chainingBehavior)
|
||||
*
|
||||
* Overwrites an already existing chainable method
|
||||
* and provides access to the previous function or
|
||||
* property. Must return functions to be used for
|
||||
* name.
|
||||
*
|
||||
* utils.overwriteChainableMethod(chai.Assertion.prototype, 'lengthOf',
|
||||
* function (_super) {
|
||||
* }
|
||||
* , function (_super) {
|
||||
* }
|
||||
* );
|
||||
*
|
||||
* Can also be accessed directly from `chai.Assertion`.
|
||||
*
|
||||
* chai.Assertion.overwriteChainableMethod('foo', fn, fn);
|
||||
*
|
||||
* Then can be used as any other assertion.
|
||||
*
|
||||
* expect(myFoo).to.have.lengthOf(3);
|
||||
* expect(myFoo).to.have.lengthOf.above(3);
|
||||
*
|
||||
* @param {Object} ctx object whose method / property is to be overwritten
|
||||
* @param {String} name of method / property to overwrite
|
||||
* @param {Function} method function that returns a function to be used for name
|
||||
* @param {Function} chainingBehavior function that returns a function to be used for property
|
||||
* @namespace Utils
|
||||
* @name overwriteChainableMethod
|
||||
* @api public
|
||||
*/
|
||||
|
||||
module.exports = function overwriteChainableMethod(ctx, name, method, chainingBehavior) {
|
||||
var chainableBehavior = ctx.__methods[name];
|
||||
|
||||
var _chainingBehavior = chainableBehavior.chainingBehavior;
|
||||
chainableBehavior.chainingBehavior = function overwritingChainableMethodGetter() {
|
||||
var result = chainingBehavior(_chainingBehavior).call(this);
|
||||
if (result !== undefined) {
|
||||
return result;
|
||||
}
|
||||
|
||||
var newAssertion = new chai.Assertion();
|
||||
transferFlags(this, newAssertion);
|
||||
return newAssertion;
|
||||
};
|
||||
|
||||
var _method = chainableBehavior.method;
|
||||
chainableBehavior.method = function overwritingChainableMethodWrapper() {
|
||||
var result = method(_method).apply(this, arguments);
|
||||
if (result !== undefined) {
|
||||
return result;
|
||||
}
|
||||
|
||||
var newAssertion = new chai.Assertion();
|
||||
transferFlags(this, newAssertion);
|
||||
return newAssertion;
|
||||
};
|
||||
};
|
||||
92
node_modules/chai/lib/chai/utils/overwriteMethod.js
generated
vendored
Normal file
92
node_modules/chai/lib/chai/utils/overwriteMethod.js
generated
vendored
Normal file
@@ -0,0 +1,92 @@
|
||||
/*!
|
||||
* Chai - overwriteMethod utility
|
||||
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
var addLengthGuard = require('./addLengthGuard');
|
||||
var chai = require('../../chai');
|
||||
var flag = require('./flag');
|
||||
var proxify = require('./proxify');
|
||||
var transferFlags = require('./transferFlags');
|
||||
|
||||
/**
|
||||
* ### .overwriteMethod(ctx, name, fn)
|
||||
*
|
||||
* Overwrites an already existing method and provides
|
||||
* access to previous function. Must return function
|
||||
* to be used for name.
|
||||
*
|
||||
* utils.overwriteMethod(chai.Assertion.prototype, 'equal', function (_super) {
|
||||
* return function (str) {
|
||||
* var obj = utils.flag(this, 'object');
|
||||
* if (obj instanceof Foo) {
|
||||
* new chai.Assertion(obj.value).to.equal(str);
|
||||
* } else {
|
||||
* _super.apply(this, arguments);
|
||||
* }
|
||||
* }
|
||||
* });
|
||||
*
|
||||
* Can also be accessed directly from `chai.Assertion`.
|
||||
*
|
||||
* chai.Assertion.overwriteMethod('foo', fn);
|
||||
*
|
||||
* Then can be used as any other assertion.
|
||||
*
|
||||
* expect(myFoo).to.equal('bar');
|
||||
*
|
||||
* @param {Object} ctx object whose method is to be overwritten
|
||||
* @param {String} name of method to overwrite
|
||||
* @param {Function} method function that returns a function to be used for name
|
||||
* @namespace Utils
|
||||
* @name overwriteMethod
|
||||
* @api public
|
||||
*/
|
||||
|
||||
module.exports = function overwriteMethod(ctx, name, method) {
|
||||
var _method = ctx[name]
|
||||
, _super = function () {
|
||||
throw new Error(name + ' is not a function');
|
||||
};
|
||||
|
||||
if (_method && 'function' === typeof _method)
|
||||
_super = _method;
|
||||
|
||||
var overwritingMethodWrapper = function () {
|
||||
// Setting the `ssfi` flag to `overwritingMethodWrapper` causes this
|
||||
// function to be the starting point for removing implementation frames from
|
||||
// the stack trace of a failed assertion.
|
||||
//
|
||||
// However, we only want to use this function as the starting point if the
|
||||
// `lockSsfi` flag isn't set.
|
||||
//
|
||||
// If the `lockSsfi` flag is set, then either this assertion has been
|
||||
// overwritten by another assertion, or this assertion is being invoked from
|
||||
// inside of another assertion. In the first case, the `ssfi` flag has
|
||||
// already been set by the overwriting assertion. In the second case, the
|
||||
// `ssfi` flag has already been set by the outer assertion.
|
||||
if (!flag(this, 'lockSsfi')) {
|
||||
flag(this, 'ssfi', overwritingMethodWrapper);
|
||||
}
|
||||
|
||||
// Setting the `lockSsfi` flag to `true` prevents the overwritten assertion
|
||||
// from changing the `ssfi` flag. By this point, the `ssfi` flag is already
|
||||
// set to the correct starting point for this assertion.
|
||||
var origLockSsfi = flag(this, 'lockSsfi');
|
||||
flag(this, 'lockSsfi', true);
|
||||
var result = method(_super).apply(this, arguments);
|
||||
flag(this, 'lockSsfi', origLockSsfi);
|
||||
|
||||
if (result !== undefined) {
|
||||
return result;
|
||||
}
|
||||
|
||||
var newAssertion = new chai.Assertion();
|
||||
transferFlags(this, newAssertion);
|
||||
return newAssertion;
|
||||
}
|
||||
|
||||
addLengthGuard(overwritingMethodWrapper, name, false);
|
||||
ctx[name] = proxify(overwritingMethodWrapper, name);
|
||||
};
|
||||
92
node_modules/chai/lib/chai/utils/overwriteProperty.js
generated
vendored
Normal file
92
node_modules/chai/lib/chai/utils/overwriteProperty.js
generated
vendored
Normal file
@@ -0,0 +1,92 @@
|
||||
/*!
|
||||
* Chai - overwriteProperty utility
|
||||
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
var chai = require('../../chai');
|
||||
var flag = require('./flag');
|
||||
var isProxyEnabled = require('./isProxyEnabled');
|
||||
var transferFlags = require('./transferFlags');
|
||||
|
||||
/**
|
||||
* ### .overwriteProperty(ctx, name, fn)
|
||||
*
|
||||
* Overwrites an already existing property getter and provides
|
||||
* access to previous value. Must return function to use as getter.
|
||||
*
|
||||
* utils.overwriteProperty(chai.Assertion.prototype, 'ok', function (_super) {
|
||||
* return function () {
|
||||
* var obj = utils.flag(this, 'object');
|
||||
* if (obj instanceof Foo) {
|
||||
* new chai.Assertion(obj.name).to.equal('bar');
|
||||
* } else {
|
||||
* _super.call(this);
|
||||
* }
|
||||
* }
|
||||
* });
|
||||
*
|
||||
*
|
||||
* Can also be accessed directly from `chai.Assertion`.
|
||||
*
|
||||
* chai.Assertion.overwriteProperty('foo', fn);
|
||||
*
|
||||
* Then can be used as any other assertion.
|
||||
*
|
||||
* expect(myFoo).to.be.ok;
|
||||
*
|
||||
* @param {Object} ctx object whose property is to be overwritten
|
||||
* @param {String} name of property to overwrite
|
||||
* @param {Function} getter function that returns a getter function to be used for name
|
||||
* @namespace Utils
|
||||
* @name overwriteProperty
|
||||
* @api public
|
||||
*/
|
||||
|
||||
module.exports = function overwriteProperty(ctx, name, getter) {
|
||||
var _get = Object.getOwnPropertyDescriptor(ctx, name)
|
||||
, _super = function () {};
|
||||
|
||||
if (_get && 'function' === typeof _get.get)
|
||||
_super = _get.get
|
||||
|
||||
Object.defineProperty(ctx, name,
|
||||
{ get: function overwritingPropertyGetter() {
|
||||
// Setting the `ssfi` flag to `overwritingPropertyGetter` causes this
|
||||
// function to be the starting point for removing implementation frames
|
||||
// from the stack trace of a failed assertion.
|
||||
//
|
||||
// However, we only want to use this function as the starting point if
|
||||
// the `lockSsfi` flag isn't set and proxy protection is disabled.
|
||||
//
|
||||
// If the `lockSsfi` flag is set, then either this assertion has been
|
||||
// overwritten by another assertion, or this assertion is being invoked
|
||||
// from inside of another assertion. In the first case, the `ssfi` flag
|
||||
// has already been set by the overwriting assertion. In the second
|
||||
// case, the `ssfi` flag has already been set by the outer assertion.
|
||||
//
|
||||
// If proxy protection is enabled, then the `ssfi` flag has already been
|
||||
// set by the proxy getter.
|
||||
if (!isProxyEnabled() && !flag(this, 'lockSsfi')) {
|
||||
flag(this, 'ssfi', overwritingPropertyGetter);
|
||||
}
|
||||
|
||||
// Setting the `lockSsfi` flag to `true` prevents the overwritten
|
||||
// assertion from changing the `ssfi` flag. By this point, the `ssfi`
|
||||
// flag is already set to the correct starting point for this assertion.
|
||||
var origLockSsfi = flag(this, 'lockSsfi');
|
||||
flag(this, 'lockSsfi', true);
|
||||
var result = getter(_super).call(this);
|
||||
flag(this, 'lockSsfi', origLockSsfi);
|
||||
|
||||
if (result !== undefined) {
|
||||
return result;
|
||||
}
|
||||
|
||||
var newAssertion = new chai.Assertion();
|
||||
transferFlags(this, newAssertion);
|
||||
return newAssertion;
|
||||
}
|
||||
, configurable: true
|
||||
});
|
||||
};
|
||||
147
node_modules/chai/lib/chai/utils/proxify.js
generated
vendored
Normal file
147
node_modules/chai/lib/chai/utils/proxify.js
generated
vendored
Normal file
@@ -0,0 +1,147 @@
|
||||
var config = require('../config');
|
||||
var flag = require('./flag');
|
||||
var getProperties = require('./getProperties');
|
||||
var isProxyEnabled = require('./isProxyEnabled');
|
||||
|
||||
/*!
|
||||
* Chai - proxify utility
|
||||
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
/**
|
||||
* ### .proxify(object)
|
||||
*
|
||||
* Return a proxy of given object that throws an error when a non-existent
|
||||
* property is read. By default, the root cause is assumed to be a misspelled
|
||||
* property, and thus an attempt is made to offer a reasonable suggestion from
|
||||
* the list of existing properties. However, if a nonChainableMethodName is
|
||||
* provided, then the root cause is instead a failure to invoke a non-chainable
|
||||
* method prior to reading the non-existent property.
|
||||
*
|
||||
* If proxies are unsupported or disabled via the user's Chai config, then
|
||||
* return object without modification.
|
||||
*
|
||||
* @param {Object} obj
|
||||
* @param {String} nonChainableMethodName
|
||||
* @namespace Utils
|
||||
* @name proxify
|
||||
*/
|
||||
|
||||
var builtins = ['__flags', '__methods', '_obj', 'assert'];
|
||||
|
||||
module.exports = function proxify(obj, nonChainableMethodName) {
|
||||
if (!isProxyEnabled()) return obj;
|
||||
|
||||
return new Proxy(obj, {
|
||||
get: function proxyGetter(target, property) {
|
||||
// This check is here because we should not throw errors on Symbol properties
|
||||
// such as `Symbol.toStringTag`.
|
||||
// The values for which an error should be thrown can be configured using
|
||||
// the `config.proxyExcludedKeys` setting.
|
||||
if (typeof property === 'string' &&
|
||||
config.proxyExcludedKeys.indexOf(property) === -1 &&
|
||||
!Reflect.has(target, property)) {
|
||||
// Special message for invalid property access of non-chainable methods.
|
||||
if (nonChainableMethodName) {
|
||||
throw Error('Invalid Chai property: ' + nonChainableMethodName + '.' +
|
||||
property + '. See docs for proper usage of "' +
|
||||
nonChainableMethodName + '".');
|
||||
}
|
||||
|
||||
// If the property is reasonably close to an existing Chai property,
|
||||
// suggest that property to the user. Only suggest properties with a
|
||||
// distance less than 4.
|
||||
var suggestion = null;
|
||||
var suggestionDistance = 4;
|
||||
getProperties(target).forEach(function(prop) {
|
||||
if (
|
||||
!Object.prototype.hasOwnProperty(prop) &&
|
||||
builtins.indexOf(prop) === -1
|
||||
) {
|
||||
var dist = stringDistanceCapped(
|
||||
property,
|
||||
prop,
|
||||
suggestionDistance
|
||||
);
|
||||
if (dist < suggestionDistance) {
|
||||
suggestion = prop;
|
||||
suggestionDistance = dist;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if (suggestion !== null) {
|
||||
throw Error('Invalid Chai property: ' + property +
|
||||
'. Did you mean "' + suggestion + '"?');
|
||||
} else {
|
||||
throw Error('Invalid Chai property: ' + property);
|
||||
}
|
||||
}
|
||||
|
||||
// Use this proxy getter as the starting point for removing implementation
|
||||
// frames from the stack trace of a failed assertion. For property
|
||||
// assertions, this prevents the proxy getter from showing up in the stack
|
||||
// trace since it's invoked before the property getter. For method and
|
||||
// chainable method assertions, this flag will end up getting changed to
|
||||
// the method wrapper, which is good since this frame will no longer be in
|
||||
// the stack once the method is invoked. Note that Chai builtin assertion
|
||||
// properties such as `__flags` are skipped since this is only meant to
|
||||
// capture the starting point of an assertion. This step is also skipped
|
||||
// if the `lockSsfi` flag is set, thus indicating that this assertion is
|
||||
// being called from within another assertion. In that case, the `ssfi`
|
||||
// flag is already set to the outer assertion's starting point.
|
||||
if (builtins.indexOf(property) === -1 && !flag(target, 'lockSsfi')) {
|
||||
flag(target, 'ssfi', proxyGetter);
|
||||
}
|
||||
|
||||
return Reflect.get(target, property);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* # stringDistanceCapped(strA, strB, cap)
|
||||
* Return the Levenshtein distance between two strings, but no more than cap.
|
||||
* @param {string} strA
|
||||
* @param {string} strB
|
||||
* @param {number} number
|
||||
* @return {number} min(string distance between strA and strB, cap)
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function stringDistanceCapped(strA, strB, cap) {
|
||||
if (Math.abs(strA.length - strB.length) >= cap) {
|
||||
return cap;
|
||||
}
|
||||
|
||||
var memo = [];
|
||||
// `memo` is a two-dimensional array containing distances.
|
||||
// memo[i][j] is the distance between strA.slice(0, i) and
|
||||
// strB.slice(0, j).
|
||||
for (var i = 0; i <= strA.length; i++) {
|
||||
memo[i] = Array(strB.length + 1).fill(0);
|
||||
memo[i][0] = i;
|
||||
}
|
||||
for (var j = 0; j < strB.length; j++) {
|
||||
memo[0][j] = j;
|
||||
}
|
||||
|
||||
for (var i = 1; i <= strA.length; i++) {
|
||||
var ch = strA.charCodeAt(i - 1);
|
||||
for (var j = 1; j <= strB.length; j++) {
|
||||
if (Math.abs(i - j) >= cap) {
|
||||
memo[i][j] = cap;
|
||||
continue;
|
||||
}
|
||||
memo[i][j] = Math.min(
|
||||
memo[i - 1][j] + 1,
|
||||
memo[i][j - 1] + 1,
|
||||
memo[i - 1][j - 1] +
|
||||
(ch === strB.charCodeAt(j - 1) ? 0 : 1)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return memo[strA.length][strB.length];
|
||||
}
|
||||
28
node_modules/chai/lib/chai/utils/test.js
generated
vendored
Normal file
28
node_modules/chai/lib/chai/utils/test.js
generated
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
/*!
|
||||
* Chai - test utility
|
||||
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
/*!
|
||||
* Module dependencies
|
||||
*/
|
||||
|
||||
var flag = require('./flag');
|
||||
|
||||
/**
|
||||
* ### .test(object, expression)
|
||||
*
|
||||
* Test and object for expression.
|
||||
*
|
||||
* @param {Object} object (constructed Assertion)
|
||||
* @param {Arguments} chai.Assertion.prototype.assert arguments
|
||||
* @namespace Utils
|
||||
* @name test
|
||||
*/
|
||||
|
||||
module.exports = function test(obj, args) {
|
||||
var negate = flag(obj, 'negate')
|
||||
, expr = args[0];
|
||||
return negate ? !expr : expr;
|
||||
};
|
||||
45
node_modules/chai/lib/chai/utils/transferFlags.js
generated
vendored
Normal file
45
node_modules/chai/lib/chai/utils/transferFlags.js
generated
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
/*!
|
||||
* Chai - transferFlags utility
|
||||
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
/**
|
||||
* ### .transferFlags(assertion, object, includeAll = true)
|
||||
*
|
||||
* Transfer all the flags for `assertion` to `object`. If
|
||||
* `includeAll` is set to `false`, then the base Chai
|
||||
* assertion flags (namely `object`, `ssfi`, `lockSsfi`,
|
||||
* and `message`) will not be transferred.
|
||||
*
|
||||
*
|
||||
* var newAssertion = new Assertion();
|
||||
* utils.transferFlags(assertion, newAssertion);
|
||||
*
|
||||
* var anotherAssertion = new Assertion(myObj);
|
||||
* utils.transferFlags(assertion, anotherAssertion, false);
|
||||
*
|
||||
* @param {Assertion} assertion the assertion to transfer the flags from
|
||||
* @param {Object} object the object to transfer the flags to; usually a new assertion
|
||||
* @param {Boolean} includeAll
|
||||
* @namespace Utils
|
||||
* @name transferFlags
|
||||
* @api private
|
||||
*/
|
||||
|
||||
module.exports = function transferFlags(assertion, object, includeAll) {
|
||||
var flags = assertion.__flags || (assertion.__flags = Object.create(null));
|
||||
|
||||
if (!object.__flags) {
|
||||
object.__flags = Object.create(null);
|
||||
}
|
||||
|
||||
includeAll = arguments.length === 3 ? includeAll : true;
|
||||
|
||||
for (var flag in flags) {
|
||||
if (includeAll ||
|
||||
(flag !== 'object' && flag !== 'ssfi' && flag !== 'lockSsfi' && flag != 'message')) {
|
||||
object.__flags[flag] = flags[flag];
|
||||
}
|
||||
}
|
||||
};
|
||||
108
node_modules/chai/package.json
generated
vendored
Normal file
108
node_modules/chai/package.json
generated
vendored
Normal file
@@ -0,0 +1,108 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"chai@4.3.6",
|
||||
"/home/veeck/Projekte/Modernizr"
|
||||
]
|
||||
],
|
||||
"_development": true,
|
||||
"_from": "chai@4.3.6",
|
||||
"_id": "chai@4.3.6",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-bbcp3YfHCUzMOvKqsztczerVgBKSsEijCySNlHHbX3VG1nskvqjz5Rfso1gGwD6w6oOV3eI60pKuMOV5MV7p3Q==",
|
||||
"_location": "/chai",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "chai@4.3.6",
|
||||
"name": "chai",
|
||||
"escapedName": "chai",
|
||||
"rawSpec": "4.3.6",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "4.3.6"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"#DEV:/"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/chai/-/chai-4.3.6.tgz",
|
||||
"_spec": "4.3.6",
|
||||
"_where": "/home/veeck/Projekte/Modernizr",
|
||||
"author": {
|
||||
"name": "Jake Luer",
|
||||
"email": "jake@alogicalparadox.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/chaijs/chai/issues"
|
||||
},
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Jake Luer",
|
||||
"email": "jake@alogicalparadox.com"
|
||||
},
|
||||
{
|
||||
"name": "Domenic Denicola",
|
||||
"email": "domenic@domenicdenicola.com",
|
||||
"url": "http://domenicdenicola.com"
|
||||
},
|
||||
{
|
||||
"name": "Veselin Todorov",
|
||||
"email": "hi@vesln.com"
|
||||
},
|
||||
{
|
||||
"name": "John Firebaugh",
|
||||
"email": "john.firebaugh@gmail.com"
|
||||
}
|
||||
],
|
||||
"dependencies": {
|
||||
"assertion-error": "^1.1.0",
|
||||
"check-error": "^1.0.2",
|
||||
"deep-eql": "^3.0.1",
|
||||
"get-func-name": "^2.0.0",
|
||||
"loupe": "^2.3.1",
|
||||
"pathval": "^1.1.1",
|
||||
"type-detect": "^4.0.5"
|
||||
},
|
||||
"description": "BDD/TDD assertion library for node.js and the browser. Test framework agnostic.",
|
||||
"devDependencies": {
|
||||
"browserify": "^16.2.3",
|
||||
"bump-cli": "^1.1.3",
|
||||
"codecov": "^3.0.0",
|
||||
"istanbul": "^0.4.3",
|
||||
"karma": "^6.1.1",
|
||||
"karma-chrome-launcher": "^2.2.0",
|
||||
"karma-firefox-launcher": "^1.0.0",
|
||||
"karma-mocha": "^2.0.1",
|
||||
"karma-sauce-launcher": "^1.2.0",
|
||||
"mocha": "^7.1.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
},
|
||||
"exports": {
|
||||
".": {
|
||||
"require": "./index.js",
|
||||
"import": "./index.mjs"
|
||||
},
|
||||
"./*": "./*"
|
||||
},
|
||||
"homepage": "http://chaijs.com",
|
||||
"keywords": [
|
||||
"test",
|
||||
"assertion",
|
||||
"assert",
|
||||
"testing",
|
||||
"chai"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "./index",
|
||||
"name": "chai",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/chaijs/chai.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "make test"
|
||||
},
|
||||
"version": "4.3.6"
|
||||
}
|
||||
1
node_modules/chai/register-assert.js
generated
vendored
Normal file
1
node_modules/chai/register-assert.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
global.assert = require('./').assert;
|
||||
1
node_modules/chai/register-expect.js
generated
vendored
Normal file
1
node_modules/chai/register-expect.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
global.expect = require('./').expect;
|
||||
1
node_modules/chai/register-should.js
generated
vendored
Normal file
1
node_modules/chai/register-should.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
global.should = require('./').should();
|
||||
106
node_modules/chai/sauce.browsers.js
generated
vendored
Normal file
106
node_modules/chai/sauce.browsers.js
generated
vendored
Normal file
@@ -0,0 +1,106 @@
|
||||
|
||||
/*!
|
||||
* Chrome
|
||||
*/
|
||||
|
||||
exports['SL_Chrome'] = {
|
||||
base: 'SauceLabs'
|
||||
, browserName: 'chrome'
|
||||
};
|
||||
|
||||
/*!
|
||||
* Firefox
|
||||
*/
|
||||
|
||||
exports['SL_Firefox'] = {
|
||||
base: 'SauceLabs'
|
||||
, browserName: 'firefox'
|
||||
};
|
||||
|
||||
exports['SL_Firefox_ESR'] = {
|
||||
base: 'SauceLabs'
|
||||
, browserName: 'firefox'
|
||||
, version: 38
|
||||
};
|
||||
|
||||
/*!
|
||||
* Internet Explorer
|
||||
*/
|
||||
|
||||
exports['SL_IE'] = {
|
||||
base: 'SauceLabs'
|
||||
, browserName: 'internet explorer'
|
||||
};
|
||||
|
||||
/*!
|
||||
* TODO: fails because of Uint8Array support
|
||||
*
|
||||
exports['SL_IE_Old'] = {
|
||||
base: 'SauceLabs'
|
||||
, browserName: 'internet explorer'
|
||||
, version: 10
|
||||
};
|
||||
*/
|
||||
|
||||
exports['SL_Edge'] = {
|
||||
base: 'SauceLabs'
|
||||
, browserName: 'microsoftedge'
|
||||
};
|
||||
|
||||
/*!
|
||||
* Safari
|
||||
*/
|
||||
|
||||
exports['SL_Safari'] = {
|
||||
base: 'SauceLabs'
|
||||
, browserName: 'safari'
|
||||
, platform: 'Mac 10.11'
|
||||
};
|
||||
|
||||
/*!
|
||||
* iPhone
|
||||
*/
|
||||
|
||||
/*!
|
||||
* TODO: These take forever to boot or shut down. Causes timeout.
|
||||
*
|
||||
|
||||
exports['SL_iPhone_6'] = {
|
||||
base: 'SauceLabs'
|
||||
, browserName: 'iphone'
|
||||
, platform: 'Mac 10.8'
|
||||
, version: '6'
|
||||
};
|
||||
|
||||
exports['SL_iPhone_5-1'] = {
|
||||
base: 'SauceLabs'
|
||||
, browserName: 'iphone'
|
||||
, platform: 'Mac 10.8'
|
||||
, version: '5.1'
|
||||
};
|
||||
|
||||
exports['SL_iPhone_5'] = {
|
||||
base: 'SauceLabs'
|
||||
, browserName: 'iphone'
|
||||
, platform: 'Mac 10.6'
|
||||
, version: '5'
|
||||
};
|
||||
|
||||
*/
|
||||
|
||||
/*!
|
||||
* Android
|
||||
*/
|
||||
|
||||
/*!
|
||||
* TODO: fails because of error serialization
|
||||
*
|
||||
|
||||
exports['SL_Android_4'] = {
|
||||
base: 'SauceLabs'
|
||||
, browserName: 'android'
|
||||
, platform: 'Linux'
|
||||
, version: '4'
|
||||
};
|
||||
|
||||
*/
|
||||
331
node_modules/jquery/AUTHORS.txt
generated
vendored
Normal file
331
node_modules/jquery/AUTHORS.txt
generated
vendored
Normal file
@@ -0,0 +1,331 @@
|
||||
John Resig <jeresig@gmail.com>
|
||||
Gilles van den Hoven <gilles0181@gmail.com>
|
||||
Michael Geary <mike@geary.com>
|
||||
Stefan Petre <stefan.petre@gmail.com>
|
||||
Yehuda Katz <wycats@gmail.com>
|
||||
Corey Jewett <cj@syntheticplayground.com>
|
||||
Klaus Hartl <klaus.hartl@gmail.com>
|
||||
Franck Marcia <franck.marcia@gmail.com>
|
||||
Jörn Zaefferer <joern.zaefferer@gmail.com>
|
||||
Paul Bakaus <paul.bakaus@gmail.com>
|
||||
Brandon Aaron <brandon.aaron@gmail.com>
|
||||
Mike Alsup <malsup@gmail.com>
|
||||
Dave Methvin <dave.methvin@gmail.com>
|
||||
Ed Engelhardt <edengelhardt@gmail.com>
|
||||
Sean Catchpole <littlecooldude@gmail.com>
|
||||
Paul Mclanahan <pmclanahan@gmail.com>
|
||||
David Serduke <davidserduke@gmail.com>
|
||||
Richard D. Worth <rdworth@gmail.com>
|
||||
Scott González <scott.gonzalez@gmail.com>
|
||||
Ariel Flesler <aflesler@gmail.com>
|
||||
Jon Evans <jon@springyweb.com>
|
||||
TJ Holowaychuk <tj@vision-media.ca>
|
||||
Michael Bensoussan <mickey@seesmic.com>
|
||||
Robert Katić <robert.katic@gmail.com>
|
||||
Louis-Rémi Babé <lrbabe@gmail.com>
|
||||
Earle Castledine <mrspeaker@gmail.com>
|
||||
Damian Janowski <damian.janowski@gmail.com>
|
||||
Rich Dougherty <rich@rd.gen.nz>
|
||||
Kim Dalsgaard <kim@kimdalsgaard.com>
|
||||
Andrea Giammarchi <andrea.giammarchi@gmail.com>
|
||||
Mark Gibson <jollytoad@gmail.com>
|
||||
Karl Swedberg <kswedberg@gmail.com>
|
||||
Justin Meyer <justinbmeyer@gmail.com>
|
||||
Ben Alman <cowboy@rj3.net>
|
||||
James Padolsey <cla@padolsey.net>
|
||||
David Petersen <public@petersendidit.com>
|
||||
Batiste Bieler <batiste.bieler@gmail.com>
|
||||
Alexander Farkas <info@corrupt-system.de>
|
||||
Rick Waldron <waldron.rick@gmail.com>
|
||||
Filipe Fortes <filipe@fortes.com>
|
||||
Neeraj Singh <neerajdotname@gmail.com>
|
||||
Paul Irish <paul.irish@gmail.com>
|
||||
Iraê Carvalho <irae@irae.pro.br>
|
||||
Matt Curry <matt@pseudocoder.com>
|
||||
Michael Monteleone <michael@michaelmonteleone.net>
|
||||
Noah Sloan <noah.sloan@gmail.com>
|
||||
Tom Viner <github@viner.tv>
|
||||
Douglas Neiner <doug@dougneiner.com>
|
||||
Adam J. Sontag <ajpiano@ajpiano.com>
|
||||
Dave Reed <dareed@microsoft.com>
|
||||
Ralph Whitbeck <ralph.whitbeck@gmail.com>
|
||||
Carl Fürstenberg <azatoth@gmail.com>
|
||||
Jacob Wright <jacwright@gmail.com>
|
||||
J. Ryan Stinnett <jryans@gmail.com>
|
||||
unknown <Igen005@.upcorp.ad.uprr.com>
|
||||
temp01 <temp01irc@gmail.com>
|
||||
Heungsub Lee <h@subl.ee>
|
||||
Colin Snover <github.com@zetafleet.com>
|
||||
Ryan W Tenney <ryan@10e.us>
|
||||
Pinhook <contact@pinhooklabs.com>
|
||||
Ron Otten <r.j.g.otten@gmail.com>
|
||||
Jephte Clain <Jephte.Clain@univ-reunion.fr>
|
||||
Anton Matzneller <obhvsbypqghgc@gmail.com>
|
||||
Alex Sexton <AlexSexton@gmail.com>
|
||||
Dan Heberden <danheberden@gmail.com>
|
||||
Henri Wiechers <hwiechers@gmail.com>
|
||||
Russell Holbrook <russell.holbrook@patch.com>
|
||||
Julian Aubourg <aubourg.julian@gmail.com>
|
||||
Gianni Alessandro Chiappetta <gianni@runlevel6.org>
|
||||
Scott Jehl <scottjehl@gmail.com>
|
||||
James Burke <jrburke@gmail.com>
|
||||
Jonas Pfenniger <jonas@pfenniger.name>
|
||||
Xavi Ramirez <xavi.rmz@gmail.com>
|
||||
Jared Grippe <jared@deadlyicon.com>
|
||||
Sylvester Keil <sylvester@keil.or.at>
|
||||
Brandon Sterne <bsterne@mozilla.com>
|
||||
Mathias Bynens <mathias@qiwi.be>
|
||||
Timmy Willison <4timmywil@gmail.com>
|
||||
Corey Frang <gnarf37@gmail.com>
|
||||
Digitalxero <digitalxero>
|
||||
Anton Kovalyov <anton@kovalyov.net>
|
||||
David Murdoch <david@davidmurdoch.com>
|
||||
Josh Varner <josh.varner@gmail.com>
|
||||
Charles McNulty <cmcnulty@kznf.com>
|
||||
Jordan Boesch <jboesch26@gmail.com>
|
||||
Jess Thrysoee <jess@thrysoee.dk>
|
||||
Michael Murray <m@murz.net>
|
||||
Lee Carpenter <elcarpie@gmail.com>
|
||||
Alexis Abril <me@alexisabril.com>
|
||||
Rob Morgan <robbym@gmail.com>
|
||||
John Firebaugh <john_firebaugh@bigfix.com>
|
||||
Sam Bisbee <sam@sbisbee.com>
|
||||
Gilmore Davidson <gilmoreorless@gmail.com>
|
||||
Brian Brennan <me@brianlovesthings.com>
|
||||
Xavier Montillet <xavierm02.net@gmail.com>
|
||||
Daniel Pihlstrom <sciolist.se@gmail.com>
|
||||
Sahab Yazdani <sahab.yazdani+github@gmail.com>
|
||||
avaly <github-com@agachi.name>
|
||||
Scott Hughes <hi@scott-hughes.me>
|
||||
Mike Sherov <mike.sherov@gmail.com>
|
||||
Greg Hazel <ghazel@gmail.com>
|
||||
Schalk Neethling <schalk@ossreleasefeed.com>
|
||||
Denis Knauf <Denis.Knauf@gmail.com>
|
||||
Timo Tijhof <krinklemail@gmail.com>
|
||||
Steen Nielsen <swinedk@gmail.com>
|
||||
Anton Ryzhov <anton@ryzhov.me>
|
||||
Shi Chuan <shichuanr@gmail.com>
|
||||
Berker Peksag <berker.peksag@gmail.com>
|
||||
Toby Brain <tobyb@freshview.com>
|
||||
Matt Mueller <mattmuelle@gmail.com>
|
||||
Justin <drakefjustin@gmail.com>
|
||||
Daniel Herman <daniel.c.herman@gmail.com>
|
||||
Oleg Gaidarenko <markelog@gmail.com>
|
||||
Richard Gibson <richard.gibson@gmail.com>
|
||||
Rafaël Blais Masson <rafbmasson@gmail.com>
|
||||
cmc3cn <59194618@qq.com>
|
||||
Joe Presbrey <presbrey@gmail.com>
|
||||
Sindre Sorhus <sindresorhus@gmail.com>
|
||||
Arne de Bree <arne@bukkie.nl>
|
||||
Vladislav Zarakovsky <vlad.zar@gmail.com>
|
||||
Andrew E Monat <amonat@gmail.com>
|
||||
Oskari <admin@o-programs.com>
|
||||
Joao Henrique de Andrade Bruni <joaohbruni@yahoo.com.br>
|
||||
tsinha <tsinha@Anthonys-MacBook-Pro.local>
|
||||
Matt Farmer <matt@frmr.me>
|
||||
Trey Hunner <treyhunner@gmail.com>
|
||||
Jason Moon <jmoon@socialcast.com>
|
||||
Jeffery To <jeffery.to@gmail.com>
|
||||
Kris Borchers <kris.borchers@gmail.com>
|
||||
Vladimir Zhuravlev <private.face@gmail.com>
|
||||
Jacob Thornton <jacobthornton@gmail.com>
|
||||
Chad Killingsworth <chadkillingsworth@missouristate.edu>
|
||||
Nowres Rafid <nowres.rafed@gmail.com>
|
||||
David Benjamin <davidben@mit.edu>
|
||||
Uri Gilad <antishok@gmail.com>
|
||||
Chris Faulkner <thefaulkner@gmail.com>
|
||||
Elijah Manor <elijah.manor@gmail.com>
|
||||
Daniel Chatfield <chatfielddaniel@gmail.com>
|
||||
Nikita Govorov <nikita.govorov@gmail.com>
|
||||
Wesley Walser <waw325@gmail.com>
|
||||
Mike Pennisi <mike@mikepennisi.com>
|
||||
Markus Staab <markus.staab@redaxo.de>
|
||||
Dave Riddle <david@joyvuu.com>
|
||||
Callum Macrae <callum@lynxphp.com>
|
||||
Benjamin Truyman <bentruyman@gmail.com>
|
||||
James Huston <james@jameshuston.net>
|
||||
Erick Ruiz de Chávez <erickrdch@gmail.com>
|
||||
David Bonner <dbonner@cogolabs.com>
|
||||
Akintayo Akinwunmi <aakinwunmi@judge.com>
|
||||
MORGAN <morgan@morgangraphics.com>
|
||||
Ismail Khair <ismail.khair@gmail.com>
|
||||
Carl Danley <carldanley@gmail.com>
|
||||
Mike Petrovich <michael.c.petrovich@gmail.com>
|
||||
Greg Lavallee <greglavallee@wapolabs.com>
|
||||
Daniel Gálvez <dgalvez@editablething.com>
|
||||
Sai Lung Wong <sai.wong@huffingtonpost.com>
|
||||
Tom H Fuertes <TomFuertes@gmail.com>
|
||||
Roland Eckl <eckl.roland@googlemail.com>
|
||||
Jay Merrifield <fracmak@gmail.com>
|
||||
Allen J Schmidt Jr <cobrasoft@gmail.com>
|
||||
Jonathan Sampson <jjdsampson@gmail.com>
|
||||
Marcel Greter <marcel.greter@ocbnet.ch>
|
||||
Matthias Jäggli <matthias.jaeggli@gmail.com>
|
||||
David Fox <dfoxinator@gmail.com>
|
||||
Yiming He <yiminghe@gmail.com>
|
||||
Devin Cooper <cooper.semantics@gmail.com>
|
||||
Paul Ramos <paul.b.ramos@gmail.com>
|
||||
Rod Vagg <rod@vagg.org>
|
||||
Bennett Sorbo <bsorbo@gmail.com>
|
||||
Sebastian Burkhard <sebi.burkhard@gmail.com>
|
||||
Zachary Adam Kaplan <razic@viralkitty.com>
|
||||
nanto_vi <nanto@moon.email.ne.jp>
|
||||
nanto <nanto@moon.email.ne.jp>
|
||||
Danil Somsikov <danilasomsikov@gmail.com>
|
||||
Ryunosuke SATO <tricknotes.rs@gmail.com>
|
||||
Jean Boussier <jean.boussier@gmail.com>
|
||||
Adam Coulombe <me@adam.co>
|
||||
Andrew Plummer <plummer.andrew@gmail.com>
|
||||
Mark Raddatz <mraddatz@gmail.com>
|
||||
Isaac Z. Schlueter <i@izs.me>
|
||||
Karl Sieburg <ksieburg@yahoo.com>
|
||||
Pascal Borreli <pascal@borreli.com>
|
||||
Nguyen Phuc Lam <ruado1987@gmail.com>
|
||||
Dmitry Gusev <dmitry.gusev@gmail.com>
|
||||
Michał Gołębiowski-Owczarek <m.goleb@gmail.com>
|
||||
Li Xudong <istonelee@gmail.com>
|
||||
Steven Benner <admin@stevenbenner.com>
|
||||
Tom H Fuertes <tomfuertes@gmail.com>
|
||||
Renato Oliveira dos Santos <ros3@cin.ufpe.br>
|
||||
ros3cin <ros3@cin.ufpe.br>
|
||||
Jason Bedard <jason+jquery@jbedard.ca>
|
||||
Kyle Robinson Young <kyle@dontkry.com>
|
||||
Chris Talkington <chris@talkingtontech.com>
|
||||
Eddie Monge <eddie@eddiemonge.com>
|
||||
Terry Jones <terry@jon.es>
|
||||
Jason Merino <jasonmerino@gmail.com>
|
||||
Jeremy Dunck <jdunck@gmail.com>
|
||||
Chris Price <price.c@gmail.com>
|
||||
Guy Bedford <guybedford@gmail.com>
|
||||
Amey Sakhadeo <me@ameyms.com>
|
||||
Mike Sidorov <mikes.ekb@gmail.com>
|
||||
Anthony Ryan <anthonyryan1@gmail.com>
|
||||
Dominik D. Geyer <dominik.geyer@gmail.com>
|
||||
George Kats <katsgeorgeek@gmail.com>
|
||||
Lihan Li <frankieteardrop@gmail.com>
|
||||
Ronny Springer <springer.ronny@gmail.com>
|
||||
Chris Antaki <ChrisAntaki@gmail.com>
|
||||
Marian Sollmann <marian.sollmann@cargomedia.ch>
|
||||
njhamann <njhamann@gmail.com>
|
||||
Ilya Kantor <iliakan@gmail.com>
|
||||
David Hong <d.hong@me.com>
|
||||
John Paul <john@johnkpaul.com>
|
||||
Jakob Stoeck <jakob@pokermania.de>
|
||||
Christopher Jones <chris@cjqed.com>
|
||||
Forbes Lindesay <forbes@lindesay.co.uk>
|
||||
S. Andrew Sheppard <andrew@wq.io>
|
||||
Leonardo Balter <leonardo.balter@gmail.com>
|
||||
Roman Reiß <me@silverwind.io>
|
||||
Benjy Cui <benjytrys@gmail.com>
|
||||
Rodrigo Rosenfeld Rosas <rr.rosas@gmail.com>
|
||||
John Hoven <hovenj@gmail.com>
|
||||
Philip Jägenstedt <philip@foolip.org>
|
||||
Christian Kosmowski <ksmwsk@gmail.com>
|
||||
Liang Peng <poppinlp@gmail.com>
|
||||
TJ VanToll <tj.vantoll@gmail.com>
|
||||
Senya Pugach <upisfree@outlook.com>
|
||||
Aurelio De Rosa <aurelioderosa@gmail.com>
|
||||
Nazar Mokrynskyi <nazar@mokrynskyi.com>
|
||||
Amit Merchant <bullredeyes@gmail.com>
|
||||
Jason Bedard <jason+github@jbedard.ca>
|
||||
Arthur Verschaeve <contact@arthurverschaeve.be>
|
||||
Dan Hart <danhart@notonthehighstreet.com>
|
||||
Bin Xin <rhyzix@gmail.com>
|
||||
David Corbacho <davidcorbacho@gmail.com>
|
||||
Veaceslav Grimalschi <grimalschi@yandex.ru>
|
||||
Daniel Husar <dano.husar@gmail.com>
|
||||
Frederic Hemberger <mail@frederic-hemberger.de>
|
||||
Ben Toews <mastahyeti@gmail.com>
|
||||
Aditya Raghavan <araghavan3@gmail.com>
|
||||
Victor Homyakov <vkhomyackov@gmail.com>
|
||||
Shivaji Varma <contact@shivajivarma.com>
|
||||
Nicolas HENRY <icewil@gmail.com>
|
||||
Anne-Gaelle Colom <coloma@westminster.ac.uk>
|
||||
George Mauer <gmauer@gmail.com>
|
||||
Leonardo Braga <leonardo.braga@gmail.com>
|
||||
Stephen Edgar <stephen@netweb.com.au>
|
||||
Thomas Tortorini <thomastortorini@gmail.com>
|
||||
Winston Howes <winstonhowes@gmail.com>
|
||||
Jon Hester <jon.d.hester@gmail.com>
|
||||
Alexander O'Mara <me@alexomara.com>
|
||||
Bastian Buchholz <buchholz.bastian@googlemail.com>
|
||||
Arthur Stolyar <nekr.fabula@gmail.com>
|
||||
Calvin Metcalf <calvin.metcalf@gmail.com>
|
||||
Mu Haibao <mhbseal@163.com>
|
||||
Richard McDaniel <rm0026@uah.edu>
|
||||
Chris Rebert <github@rebertia.com>
|
||||
Gabriel Schulhof <gabriel.schulhof@intel.com>
|
||||
Gilad Peleg <giladp007@gmail.com>
|
||||
Martin Naumann <martin@geekonaut.de>
|
||||
Marek Lewandowski <m.lewandowski@cksource.com>
|
||||
Bruno Pérel <brunoperel@gmail.com>
|
||||
Reed Loden <reed@reedloden.com>
|
||||
Daniel Nill <daniellnill@gmail.com>
|
||||
Yongwoo Jeon <yongwoo.jeon@navercorp.com>
|
||||
Sean Henderson <seanh.za@gmail.com>
|
||||
Richard Kraaijenhagen <stdin+git@riichard.com>
|
||||
Connor Atherton <c.liam.atherton@gmail.com>
|
||||
Gary Ye <garysye@gmail.com>
|
||||
Christian Grete <webmaster@christiangrete.com>
|
||||
Liza Ramo <liza.h.ramo@gmail.com>
|
||||
Julian Alexander Murillo <julian.alexander.murillo@gmail.com>
|
||||
Joelle Fleurantin <joasqueeniebee@gmail.com>
|
||||
Jae Sung Park <alberto.park@gmail.com>
|
||||
Jun Sun <klsforever@gmail.com>
|
||||
Josh Soref <apache@soref.com>
|
||||
Henry Wong <henryw4k@gmail.com>
|
||||
Jon Dufresne <jon.dufresne@gmail.com>
|
||||
Martijn W. van der Lee <martijn@vanderlee.com>
|
||||
Devin Wilson <dwilson6.github@gmail.com>
|
||||
Steve Mao <maochenyan@gmail.com>
|
||||
Zack Hall <zackhall@outlook.com>
|
||||
Bernhard M. Wiedemann <jquerybmw@lsmod.de>
|
||||
Todor Prikumov <tono_pr@abv.bg>
|
||||
Jha Naman <createnaman@gmail.com>
|
||||
William Robinet <william.robinet@conostix.com>
|
||||
Alexander Lisianoi <all3fox@gmail.com>
|
||||
Vitaliy Terziev <vitaliyterziev@gmail.com>
|
||||
Joe Trumbull <trumbull.j@gmail.com>
|
||||
Alexander K <xpyro@ya.ru>
|
||||
Damian Senn <jquery@topaxi.codes>
|
||||
Ralin Chimev <ralin.chimev@gmail.com>
|
||||
Felipe Sateler <fsateler@gmail.com>
|
||||
Christophe Tafani-Dereeper <christophetd@hotmail.fr>
|
||||
Manoj Kumar <nithmanoj@gmail.com>
|
||||
David Broder-Rodgers <broder93@gmail.com>
|
||||
Alex Louden <alex@louden.com>
|
||||
Alex Padilla <alexonezero@outlook.com>
|
||||
南漂一卒 <shiy007@qq.com>
|
||||
karan-96 <karanbatra96@gmail.com>
|
||||
Boom Lee <teabyii@gmail.com>
|
||||
Andreas Solleder <asol@num42.de>
|
||||
CDAGaming <cstack2011@yahoo.com>
|
||||
Pierre Spring <pierre@nelm.io>
|
||||
Shashanka Nataraj <shashankan.10@gmail.com>
|
||||
Erik Lax <erik@datahack.se>
|
||||
Matan Kotler-Berkowitz <205matan@gmail.com>
|
||||
Jordan Beland <jordan.beland@gmail.com>
|
||||
Henry Zhu <hi@henryzoo.com>
|
||||
Saptak Sengupta <saptak013@gmail.com>
|
||||
Nilton Cesar <niltoncms@gmail.com>
|
||||
basil.belokon <basil.belokon@gmail.com>
|
||||
tmybr11 <tomas.perone@gmail.com>
|
||||
Luis Emilio Velasco Sanchez <emibloque@gmail.com>
|
||||
Ed S <ejsanders@gmail.com>
|
||||
Bert Zhang <enbo@users.noreply.github.com>
|
||||
Andrei Fangli <andrei_fangli@outlook.com>
|
||||
Marja Hölttä <marja.holtta@gmail.com>
|
||||
abnud1 <ahmad13932013@hotmail.com>
|
||||
buddh4 <mail@jharrer.de>
|
||||
Pat O'Callaghan <patocallaghan@gmail.com>
|
||||
Ahmed.S.ElAfifi <ahmed.s.elafifi@gmail.com>
|
||||
Wonseop Kim <wonseop.kim@samsung.com>
|
||||
Christian Oliff <christianoliff@pm.me>
|
||||
Christian Wenz <christian@wenz.org>
|
||||
Sean Robinson <sean.robinson@scottsdalecc.edu>
|
||||
Jonathan <vanillajonathan@users.noreply.github.com>
|
||||
Pierre Grimaud <grimaud.pierre@gmail.com>
|
||||
Beatriz Rezener <beatrizrezener@users.noreply.github.com>
|
||||
Natalia Sroka <37873210+natipo@users.noreply.github.com>
|
||||
Wonhyoung Park <wh05.park@samsung.com>
|
||||
Dallas Fraser <dallas.fraser.waterloo@gmail.com>
|
||||
20
node_modules/jquery/LICENSE.txt
generated
vendored
Normal file
20
node_modules/jquery/LICENSE.txt
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
Copyright OpenJS Foundation and other contributors, https://openjsf.org/
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
62
node_modules/jquery/README.md
generated
vendored
Normal file
62
node_modules/jquery/README.md
generated
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
# jQuery
|
||||
|
||||
> jQuery is a fast, small, and feature-rich JavaScript library.
|
||||
|
||||
For information on how to get started and how to use jQuery, please see [jQuery's documentation](https://api.jquery.com/).
|
||||
For source files and issues, please visit the [jQuery repo](https://github.com/jquery/jquery).
|
||||
|
||||
If upgrading, please see the [blog post for 3.6.0](https://blog.jquery.com/2021/03/02/jquery-3-6-0-released/). This includes notable differences from the previous version and a more readable changelog.
|
||||
|
||||
## Including jQuery
|
||||
|
||||
Below are some of the most common ways to include jQuery.
|
||||
|
||||
### Browser
|
||||
|
||||
#### Script tag
|
||||
|
||||
```html
|
||||
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
||||
```
|
||||
|
||||
#### Babel
|
||||
|
||||
[Babel](https://babeljs.io/) is a next generation JavaScript compiler. One of the features is the ability to use ES6/ES2015 modules now, even though browsers do not yet support this feature natively.
|
||||
|
||||
```js
|
||||
import $ from "jquery";
|
||||
```
|
||||
|
||||
#### Browserify/Webpack
|
||||
|
||||
There are several ways to use [Browserify](http://browserify.org/) and [Webpack](https://webpack.github.io/). For more information on using these tools, please refer to the corresponding project's documentation. In the script, including jQuery will usually look like this...
|
||||
|
||||
```js
|
||||
var $ = require( "jquery" );
|
||||
```
|
||||
|
||||
#### AMD (Asynchronous Module Definition)
|
||||
|
||||
AMD is a module format built for the browser. For more information, we recommend [require.js' documentation](https://requirejs.org/docs/whyamd.html).
|
||||
|
||||
```js
|
||||
define( [ "jquery" ], function( $ ) {
|
||||
|
||||
} );
|
||||
```
|
||||
|
||||
### Node
|
||||
|
||||
To include jQuery in [Node](https://nodejs.org/), first install with npm.
|
||||
|
||||
```sh
|
||||
npm install jquery
|
||||
```
|
||||
|
||||
For jQuery to work in Node, a window with a document is required. Since no such window exists natively in Node, one can be mocked by tools such as [jsdom](https://github.com/jsdom/jsdom). This can be useful for testing purposes.
|
||||
|
||||
```js
|
||||
const { JSDOM } = require( "jsdom" );
|
||||
const { window } = new JSDOM( "" );
|
||||
const $ = require( "jquery" )( window );
|
||||
```
|
||||
14
node_modules/jquery/bower.json
generated
vendored
Normal file
14
node_modules/jquery/bower.json
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"name": "jquery",
|
||||
"main": "dist/jquery.js",
|
||||
"license": "MIT",
|
||||
"ignore": [
|
||||
"package.json"
|
||||
],
|
||||
"keywords": [
|
||||
"jquery",
|
||||
"javascript",
|
||||
"browser",
|
||||
"library"
|
||||
]
|
||||
}
|
||||
10881
node_modules/jquery/dist/jquery.js
generated
vendored
Normal file
10881
node_modules/jquery/dist/jquery.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
2
node_modules/jquery/dist/jquery.min.js
generated
vendored
Normal file
2
node_modules/jquery/dist/jquery.min.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
1
node_modules/jquery/dist/jquery.min.map
generated
vendored
Normal file
1
node_modules/jquery/dist/jquery.min.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
8782
node_modules/jquery/dist/jquery.slim.js
generated
vendored
Normal file
8782
node_modules/jquery/dist/jquery.slim.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
2
node_modules/jquery/dist/jquery.slim.min.js
generated
vendored
Normal file
2
node_modules/jquery/dist/jquery.slim.min.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
1
node_modules/jquery/dist/jquery.slim.min.map
generated
vendored
Normal file
1
node_modules/jquery/dist/jquery.slim.min.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
36
node_modules/jquery/external/sizzle/LICENSE.txt
generated
vendored
Normal file
36
node_modules/jquery/external/sizzle/LICENSE.txt
generated
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
Copyright JS Foundation and other contributors, https://js.foundation/
|
||||
|
||||
This software consists of voluntary contributions made by many
|
||||
individuals. For exact contribution history, see the revision history
|
||||
available at https://github.com/jquery/sizzle
|
||||
|
||||
The following license applies to all parts of this software except as
|
||||
documented below:
|
||||
|
||||
====
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
====
|
||||
|
||||
All files located in the node_modules and external directories are
|
||||
externally maintained libraries used by this software which have their
|
||||
own licenses; we recommend you read them, as their terms may differ from
|
||||
the terms above.
|
||||
2478
node_modules/jquery/external/sizzle/dist/sizzle.js
generated
vendored
Normal file
2478
node_modules/jquery/external/sizzle/dist/sizzle.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
3
node_modules/jquery/external/sizzle/dist/sizzle.min.js
generated
vendored
Normal file
3
node_modules/jquery/external/sizzle/dist/sizzle.min.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
1
node_modules/jquery/external/sizzle/dist/sizzle.min.map
generated
vendored
Normal file
1
node_modules/jquery/external/sizzle/dist/sizzle.min.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
142
node_modules/jquery/package.json
generated
vendored
Normal file
142
node_modules/jquery/package.json
generated
vendored
Normal file
@@ -0,0 +1,142 @@
|
||||
{
|
||||
"_development": true,
|
||||
"_from": "jquery@3.6.0",
|
||||
"_id": "jquery@3.6.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-JVzAR/AjBvVt2BmYhxRCSYysDsPcssdmTFnzyLEts9qNwmjmu4JTAMYubEfwVOSwpQ1I1sKKFcxhZCI2buerfw==",
|
||||
"_location": "/jquery",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "jquery@3.6.0",
|
||||
"name": "jquery",
|
||||
"escapedName": "jquery",
|
||||
"rawSpec": "3.6.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "3.6.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"#DEV:/"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/jquery/-/jquery-3.6.0.tgz",
|
||||
"_shasum": "c72a09f15c1bdce142f49dbf1170bdf8adac2470",
|
||||
"_spec": "jquery@3.6.0",
|
||||
"_where": "/home/veeck/Projekte/Modernizr",
|
||||
"author": {
|
||||
"name": "OpenJS Foundation and other contributors",
|
||||
"url": "https://github.com/jquery/jquery/blob/3.6.0/AUTHORS.txt"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/jquery/jquery/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"commitplease": {
|
||||
"nohook": true,
|
||||
"components": [
|
||||
"Docs",
|
||||
"Tests",
|
||||
"Build",
|
||||
"Support",
|
||||
"Release",
|
||||
"Core",
|
||||
"Ajax",
|
||||
"Attributes",
|
||||
"Callbacks",
|
||||
"CSS",
|
||||
"Data",
|
||||
"Deferred",
|
||||
"Deprecated",
|
||||
"Dimensions",
|
||||
"Effects",
|
||||
"Event",
|
||||
"Manipulation",
|
||||
"Offset",
|
||||
"Queue",
|
||||
"Selector",
|
||||
"Serialize",
|
||||
"Traversing",
|
||||
"Wrap"
|
||||
],
|
||||
"markerPattern": "^((clos|fix|resolv)(e[sd]|ing))|^(refs?)",
|
||||
"ticketPattern": "^((Closes|Fixes) ([a-zA-Z]{2,}-)[0-9]+)|^(Refs? [^#])"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "JavaScript library for DOM operations",
|
||||
"devDependencies": {
|
||||
"@babel/core": "7.3.3",
|
||||
"@babel/plugin-transform-for-of": "7.2.0",
|
||||
"commitplease": "3.2.0",
|
||||
"core-js": "2.6.5",
|
||||
"eslint-config-jquery": "3.0.0",
|
||||
"grunt": "1.3.0",
|
||||
"grunt-babel": "8.0.0",
|
||||
"grunt-cli": "1.3.2",
|
||||
"grunt-compare-size": "0.4.2",
|
||||
"grunt-contrib-uglify": "3.4.0",
|
||||
"grunt-contrib-watch": "1.1.0",
|
||||
"grunt-eslint": "22.0.0",
|
||||
"grunt-git-authors": "3.2.0",
|
||||
"grunt-jsonlint": "1.1.0",
|
||||
"grunt-karma": "4.0.0",
|
||||
"grunt-newer": "1.3.0",
|
||||
"grunt-npmcopy": "0.2.0",
|
||||
"gzip-js": "0.3.2",
|
||||
"husky": "1.3.1",
|
||||
"insight": "0.10.1",
|
||||
"jsdom": "13.2.0",
|
||||
"karma": "5.2.3",
|
||||
"karma-browserstack-launcher": "1.4.0",
|
||||
"karma-chrome-launcher": "2.2.0",
|
||||
"karma-firefox-launcher": "1.1.0",
|
||||
"karma-ie-launcher": "1.0.0",
|
||||
"karma-jsdom-launcher": "8.0.2",
|
||||
"karma-qunit": "3.0.0",
|
||||
"load-grunt-tasks": "5.1.0",
|
||||
"native-promise-only": "0.8.1",
|
||||
"promises-aplus-tests": "2.1.2",
|
||||
"q": "1.5.1",
|
||||
"qunit": "2.9.2",
|
||||
"raw-body": "2.3.3",
|
||||
"requirejs": "2.3.6",
|
||||
"sinon": "2.3.7",
|
||||
"sizzle": "2.3.6",
|
||||
"strip-json-comments": "2.0.1",
|
||||
"testswarm": "1.1.2",
|
||||
"uglify-js": "3.4.7"
|
||||
},
|
||||
"homepage": "https://jquery.com",
|
||||
"husky": {
|
||||
"hooks": {
|
||||
"commit-msg": "commitplease .git/COMMIT_EDITMSG",
|
||||
"pre-commit": "grunt lint:newer qunit_fixture"
|
||||
}
|
||||
},
|
||||
"keywords": [
|
||||
"jquery",
|
||||
"javascript",
|
||||
"browser",
|
||||
"library"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "dist/jquery.js",
|
||||
"name": "jquery",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/jquery/jquery.git"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "npm install && grunt",
|
||||
"jenkins": "npm run test:browserless",
|
||||
"start": "grunt watch",
|
||||
"test": "npm run test:slim && npm run test:no-deprecated && npm run test:no-sizzle && grunt && grunt test:slow && grunt karma:main && grunt karma:amd",
|
||||
"test:amd": "grunt && grunt karma:amd",
|
||||
"test:browser": "grunt && grunt karma:main",
|
||||
"test:browserless": "grunt && grunt test:slow",
|
||||
"test:no-deprecated": "grunt test:prepare && grunt custom:-deprecated && grunt karma:main",
|
||||
"test:no-sizzle": "grunt test:prepare && grunt custom:-sizzle && grunt karma:main",
|
||||
"test:slim": "grunt test:prepare && grunt custom:slim && grunt karma:main"
|
||||
},
|
||||
"title": "jQuery",
|
||||
"version": "3.6.0"
|
||||
}
|
||||
876
node_modules/jquery/src/ajax.js
generated
vendored
Normal file
876
node_modules/jquery/src/ajax.js
generated
vendored
Normal file
@@ -0,0 +1,876 @@
|
||||
define( [
|
||||
"./core",
|
||||
"./var/document",
|
||||
"./var/isFunction",
|
||||
"./var/rnothtmlwhite",
|
||||
"./ajax/var/location",
|
||||
"./ajax/var/nonce",
|
||||
"./ajax/var/rquery",
|
||||
|
||||
"./core/init",
|
||||
"./core/parseXML",
|
||||
"./event/trigger",
|
||||
"./deferred",
|
||||
"./serialize" // jQuery.param
|
||||
], function( jQuery, document, isFunction, rnothtmlwhite, location, nonce, rquery ) {
|
||||
|
||||
"use strict";
|
||||
|
||||
var
|
||||
r20 = /%20/g,
|
||||
rhash = /#.*$/,
|
||||
rantiCache = /([?&])_=[^&]*/,
|
||||
rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg,
|
||||
|
||||
// #7653, #8125, #8152: local protocol detection
|
||||
rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
|
||||
rnoContent = /^(?:GET|HEAD)$/,
|
||||
rprotocol = /^\/\//,
|
||||
|
||||
/* Prefilters
|
||||
* 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
|
||||
* 2) These are called:
|
||||
* - BEFORE asking for a transport
|
||||
* - AFTER param serialization (s.data is a string if s.processData is true)
|
||||
* 3) key is the dataType
|
||||
* 4) the catchall symbol "*" can be used
|
||||
* 5) execution will start with transport dataType and THEN continue down to "*" if needed
|
||||
*/
|
||||
prefilters = {},
|
||||
|
||||
/* Transports bindings
|
||||
* 1) key is the dataType
|
||||
* 2) the catchall symbol "*" can be used
|
||||
* 3) selection will start with transport dataType and THEN go to "*" if needed
|
||||
*/
|
||||
transports = {},
|
||||
|
||||
// Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
|
||||
allTypes = "*/".concat( "*" ),
|
||||
|
||||
// Anchor tag for parsing the document origin
|
||||
originAnchor = document.createElement( "a" );
|
||||
|
||||
originAnchor.href = location.href;
|
||||
|
||||
// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
|
||||
function addToPrefiltersOrTransports( structure ) {
|
||||
|
||||
// dataTypeExpression is optional and defaults to "*"
|
||||
return function( dataTypeExpression, func ) {
|
||||
|
||||
if ( typeof dataTypeExpression !== "string" ) {
|
||||
func = dataTypeExpression;
|
||||
dataTypeExpression = "*";
|
||||
}
|
||||
|
||||
var dataType,
|
||||
i = 0,
|
||||
dataTypes = dataTypeExpression.toLowerCase().match( rnothtmlwhite ) || [];
|
||||
|
||||
if ( isFunction( func ) ) {
|
||||
|
||||
// For each dataType in the dataTypeExpression
|
||||
while ( ( dataType = dataTypes[ i++ ] ) ) {
|
||||
|
||||
// Prepend if requested
|
||||
if ( dataType[ 0 ] === "+" ) {
|
||||
dataType = dataType.slice( 1 ) || "*";
|
||||
( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func );
|
||||
|
||||
// Otherwise append
|
||||
} else {
|
||||
( structure[ dataType ] = structure[ dataType ] || [] ).push( func );
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// Base inspection function for prefilters and transports
|
||||
function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {
|
||||
|
||||
var inspected = {},
|
||||
seekingTransport = ( structure === transports );
|
||||
|
||||
function inspect( dataType ) {
|
||||
var selected;
|
||||
inspected[ dataType ] = true;
|
||||
jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
|
||||
var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
|
||||
if ( typeof dataTypeOrTransport === "string" &&
|
||||
!seekingTransport && !inspected[ dataTypeOrTransport ] ) {
|
||||
|
||||
options.dataTypes.unshift( dataTypeOrTransport );
|
||||
inspect( dataTypeOrTransport );
|
||||
return false;
|
||||
} else if ( seekingTransport ) {
|
||||
return !( selected = dataTypeOrTransport );
|
||||
}
|
||||
} );
|
||||
return selected;
|
||||
}
|
||||
|
||||
return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );
|
||||
}
|
||||
|
||||
// A special extend for ajax options
|
||||
// that takes "flat" options (not to be deep extended)
|
||||
// Fixes #9887
|
||||
function ajaxExtend( target, src ) {
|
||||
var key, deep,
|
||||
flatOptions = jQuery.ajaxSettings.flatOptions || {};
|
||||
|
||||
for ( key in src ) {
|
||||
if ( src[ key ] !== undefined ) {
|
||||
( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ];
|
||||
}
|
||||
}
|
||||
if ( deep ) {
|
||||
jQuery.extend( true, target, deep );
|
||||
}
|
||||
|
||||
return target;
|
||||
}
|
||||
|
||||
/* Handles responses to an ajax request:
|
||||
* - finds the right dataType (mediates between content-type and expected dataType)
|
||||
* - returns the corresponding response
|
||||
*/
|
||||
function ajaxHandleResponses( s, jqXHR, responses ) {
|
||||
|
||||
var ct, type, finalDataType, firstDataType,
|
||||
contents = s.contents,
|
||||
dataTypes = s.dataTypes;
|
||||
|
||||
// Remove auto dataType and get content-type in the process
|
||||
while ( dataTypes[ 0 ] === "*" ) {
|
||||
dataTypes.shift();
|
||||
if ( ct === undefined ) {
|
||||
ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" );
|
||||
}
|
||||
}
|
||||
|
||||
// Check if we're dealing with a known content-type
|
||||
if ( ct ) {
|
||||
for ( type in contents ) {
|
||||
if ( contents[ type ] && contents[ type ].test( ct ) ) {
|
||||
dataTypes.unshift( type );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Check to see if we have a response for the expected dataType
|
||||
if ( dataTypes[ 0 ] in responses ) {
|
||||
finalDataType = dataTypes[ 0 ];
|
||||
} else {
|
||||
|
||||
// Try convertible dataTypes
|
||||
for ( type in responses ) {
|
||||
if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) {
|
||||
finalDataType = type;
|
||||
break;
|
||||
}
|
||||
if ( !firstDataType ) {
|
||||
firstDataType = type;
|
||||
}
|
||||
}
|
||||
|
||||
// Or just use first one
|
||||
finalDataType = finalDataType || firstDataType;
|
||||
}
|
||||
|
||||
// If we found a dataType
|
||||
// We add the dataType to the list if needed
|
||||
// and return the corresponding response
|
||||
if ( finalDataType ) {
|
||||
if ( finalDataType !== dataTypes[ 0 ] ) {
|
||||
dataTypes.unshift( finalDataType );
|
||||
}
|
||||
return responses[ finalDataType ];
|
||||
}
|
||||
}
|
||||
|
||||
/* Chain conversions given the request and the original response
|
||||
* Also sets the responseXXX fields on the jqXHR instance
|
||||
*/
|
||||
function ajaxConvert( s, response, jqXHR, isSuccess ) {
|
||||
var conv2, current, conv, tmp, prev,
|
||||
converters = {},
|
||||
|
||||
// Work with a copy of dataTypes in case we need to modify it for conversion
|
||||
dataTypes = s.dataTypes.slice();
|
||||
|
||||
// Create converters map with lowercased keys
|
||||
if ( dataTypes[ 1 ] ) {
|
||||
for ( conv in s.converters ) {
|
||||
converters[ conv.toLowerCase() ] = s.converters[ conv ];
|
||||
}
|
||||
}
|
||||
|
||||
current = dataTypes.shift();
|
||||
|
||||
// Convert to each sequential dataType
|
||||
while ( current ) {
|
||||
|
||||
if ( s.responseFields[ current ] ) {
|
||||
jqXHR[ s.responseFields[ current ] ] = response;
|
||||
}
|
||||
|
||||
// Apply the dataFilter if provided
|
||||
if ( !prev && isSuccess && s.dataFilter ) {
|
||||
response = s.dataFilter( response, s.dataType );
|
||||
}
|
||||
|
||||
prev = current;
|
||||
current = dataTypes.shift();
|
||||
|
||||
if ( current ) {
|
||||
|
||||
// There's only work to do if current dataType is non-auto
|
||||
if ( current === "*" ) {
|
||||
|
||||
current = prev;
|
||||
|
||||
// Convert response if prev dataType is non-auto and differs from current
|
||||
} else if ( prev !== "*" && prev !== current ) {
|
||||
|
||||
// Seek a direct converter
|
||||
conv = converters[ prev + " " + current ] || converters[ "* " + current ];
|
||||
|
||||
// If none found, seek a pair
|
||||
if ( !conv ) {
|
||||
for ( conv2 in converters ) {
|
||||
|
||||
// If conv2 outputs current
|
||||
tmp = conv2.split( " " );
|
||||
if ( tmp[ 1 ] === current ) {
|
||||
|
||||
// If prev can be converted to accepted input
|
||||
conv = converters[ prev + " " + tmp[ 0 ] ] ||
|
||||
converters[ "* " + tmp[ 0 ] ];
|
||||
if ( conv ) {
|
||||
|
||||
// Condense equivalence converters
|
||||
if ( conv === true ) {
|
||||
conv = converters[ conv2 ];
|
||||
|
||||
// Otherwise, insert the intermediate dataType
|
||||
} else if ( converters[ conv2 ] !== true ) {
|
||||
current = tmp[ 0 ];
|
||||
dataTypes.unshift( tmp[ 1 ] );
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Apply converter (if not an equivalence)
|
||||
if ( conv !== true ) {
|
||||
|
||||
// Unless errors are allowed to bubble, catch and return them
|
||||
if ( conv && s.throws ) {
|
||||
response = conv( response );
|
||||
} else {
|
||||
try {
|
||||
response = conv( response );
|
||||
} catch ( e ) {
|
||||
return {
|
||||
state: "parsererror",
|
||||
error: conv ? e : "No conversion from " + prev + " to " + current
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return { state: "success", data: response };
|
||||
}
|
||||
|
||||
jQuery.extend( {
|
||||
|
||||
// Counter for holding the number of active queries
|
||||
active: 0,
|
||||
|
||||
// Last-Modified header cache for next request
|
||||
lastModified: {},
|
||||
etag: {},
|
||||
|
||||
ajaxSettings: {
|
||||
url: location.href,
|
||||
type: "GET",
|
||||
isLocal: rlocalProtocol.test( location.protocol ),
|
||||
global: true,
|
||||
processData: true,
|
||||
async: true,
|
||||
contentType: "application/x-www-form-urlencoded; charset=UTF-8",
|
||||
|
||||
/*
|
||||
timeout: 0,
|
||||
data: null,
|
||||
dataType: null,
|
||||
username: null,
|
||||
password: null,
|
||||
cache: null,
|
||||
throws: false,
|
||||
traditional: false,
|
||||
headers: {},
|
||||
*/
|
||||
|
||||
accepts: {
|
||||
"*": allTypes,
|
||||
text: "text/plain",
|
||||
html: "text/html",
|
||||
xml: "application/xml, text/xml",
|
||||
json: "application/json, text/javascript"
|
||||
},
|
||||
|
||||
contents: {
|
||||
xml: /\bxml\b/,
|
||||
html: /\bhtml/,
|
||||
json: /\bjson\b/
|
||||
},
|
||||
|
||||
responseFields: {
|
||||
xml: "responseXML",
|
||||
text: "responseText",
|
||||
json: "responseJSON"
|
||||
},
|
||||
|
||||
// Data converters
|
||||
// Keys separate source (or catchall "*") and destination types with a single space
|
||||
converters: {
|
||||
|
||||
// Convert anything to text
|
||||
"* text": String,
|
||||
|
||||
// Text to html (true = no transformation)
|
||||
"text html": true,
|
||||
|
||||
// Evaluate text as a json expression
|
||||
"text json": JSON.parse,
|
||||
|
||||
// Parse text as xml
|
||||
"text xml": jQuery.parseXML
|
||||
},
|
||||
|
||||
// For options that shouldn't be deep extended:
|
||||
// you can add your own custom options here if
|
||||
// and when you create one that shouldn't be
|
||||
// deep extended (see ajaxExtend)
|
||||
flatOptions: {
|
||||
url: true,
|
||||
context: true
|
||||
}
|
||||
},
|
||||
|
||||
// Creates a full fledged settings object into target
|
||||
// with both ajaxSettings and settings fields.
|
||||
// If target is omitted, writes into ajaxSettings.
|
||||
ajaxSetup: function( target, settings ) {
|
||||
return settings ?
|
||||
|
||||
// Building a settings object
|
||||
ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :
|
||||
|
||||
// Extending ajaxSettings
|
||||
ajaxExtend( jQuery.ajaxSettings, target );
|
||||
},
|
||||
|
||||
ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
|
||||
ajaxTransport: addToPrefiltersOrTransports( transports ),
|
||||
|
||||
// Main method
|
||||
ajax: function( url, options ) {
|
||||
|
||||
// If url is an object, simulate pre-1.5 signature
|
||||
if ( typeof url === "object" ) {
|
||||
options = url;
|
||||
url = undefined;
|
||||
}
|
||||
|
||||
// Force options to be an object
|
||||
options = options || {};
|
||||
|
||||
var transport,
|
||||
|
||||
// URL without anti-cache param
|
||||
cacheURL,
|
||||
|
||||
// Response headers
|
||||
responseHeadersString,
|
||||
responseHeaders,
|
||||
|
||||
// timeout handle
|
||||
timeoutTimer,
|
||||
|
||||
// Url cleanup var
|
||||
urlAnchor,
|
||||
|
||||
// Request state (becomes false upon send and true upon completion)
|
||||
completed,
|
||||
|
||||
// To know if global events are to be dispatched
|
||||
fireGlobals,
|
||||
|
||||
// Loop variable
|
||||
i,
|
||||
|
||||
// uncached part of the url
|
||||
uncached,
|
||||
|
||||
// Create the final options object
|
||||
s = jQuery.ajaxSetup( {}, options ),
|
||||
|
||||
// Callbacks context
|
||||
callbackContext = s.context || s,
|
||||
|
||||
// Context for global events is callbackContext if it is a DOM node or jQuery collection
|
||||
globalEventContext = s.context &&
|
||||
( callbackContext.nodeType || callbackContext.jquery ) ?
|
||||
jQuery( callbackContext ) :
|
||||
jQuery.event,
|
||||
|
||||
// Deferreds
|
||||
deferred = jQuery.Deferred(),
|
||||
completeDeferred = jQuery.Callbacks( "once memory" ),
|
||||
|
||||
// Status-dependent callbacks
|
||||
statusCode = s.statusCode || {},
|
||||
|
||||
// Headers (they are sent all at once)
|
||||
requestHeaders = {},
|
||||
requestHeadersNames = {},
|
||||
|
||||
// Default abort message
|
||||
strAbort = "canceled",
|
||||
|
||||
// Fake xhr
|
||||
jqXHR = {
|
||||
readyState: 0,
|
||||
|
||||
// Builds headers hashtable if needed
|
||||
getResponseHeader: function( key ) {
|
||||
var match;
|
||||
if ( completed ) {
|
||||
if ( !responseHeaders ) {
|
||||
responseHeaders = {};
|
||||
while ( ( match = rheaders.exec( responseHeadersString ) ) ) {
|
||||
responseHeaders[ match[ 1 ].toLowerCase() + " " ] =
|
||||
( responseHeaders[ match[ 1 ].toLowerCase() + " " ] || [] )
|
||||
.concat( match[ 2 ] );
|
||||
}
|
||||
}
|
||||
match = responseHeaders[ key.toLowerCase() + " " ];
|
||||
}
|
||||
return match == null ? null : match.join( ", " );
|
||||
},
|
||||
|
||||
// Raw string
|
||||
getAllResponseHeaders: function() {
|
||||
return completed ? responseHeadersString : null;
|
||||
},
|
||||
|
||||
// Caches the header
|
||||
setRequestHeader: function( name, value ) {
|
||||
if ( completed == null ) {
|
||||
name = requestHeadersNames[ name.toLowerCase() ] =
|
||||
requestHeadersNames[ name.toLowerCase() ] || name;
|
||||
requestHeaders[ name ] = value;
|
||||
}
|
||||
return this;
|
||||
},
|
||||
|
||||
// Overrides response content-type header
|
||||
overrideMimeType: function( type ) {
|
||||
if ( completed == null ) {
|
||||
s.mimeType = type;
|
||||
}
|
||||
return this;
|
||||
},
|
||||
|
||||
// Status-dependent callbacks
|
||||
statusCode: function( map ) {
|
||||
var code;
|
||||
if ( map ) {
|
||||
if ( completed ) {
|
||||
|
||||
// Execute the appropriate callbacks
|
||||
jqXHR.always( map[ jqXHR.status ] );
|
||||
} else {
|
||||
|
||||
// Lazy-add the new callbacks in a way that preserves old ones
|
||||
for ( code in map ) {
|
||||
statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
|
||||
}
|
||||
}
|
||||
}
|
||||
return this;
|
||||
},
|
||||
|
||||
// Cancel the request
|
||||
abort: function( statusText ) {
|
||||
var finalText = statusText || strAbort;
|
||||
if ( transport ) {
|
||||
transport.abort( finalText );
|
||||
}
|
||||
done( 0, finalText );
|
||||
return this;
|
||||
}
|
||||
};
|
||||
|
||||
// Attach deferreds
|
||||
deferred.promise( jqXHR );
|
||||
|
||||
// Add protocol if not provided (prefilters might expect it)
|
||||
// Handle falsy url in the settings object (#10093: consistency with old signature)
|
||||
// We also use the url parameter if available
|
||||
s.url = ( ( url || s.url || location.href ) + "" )
|
||||
.replace( rprotocol, location.protocol + "//" );
|
||||
|
||||
// Alias method option to type as per ticket #12004
|
||||
s.type = options.method || options.type || s.method || s.type;
|
||||
|
||||
// Extract dataTypes list
|
||||
s.dataTypes = ( s.dataType || "*" ).toLowerCase().match( rnothtmlwhite ) || [ "" ];
|
||||
|
||||
// A cross-domain request is in order when the origin doesn't match the current origin.
|
||||
if ( s.crossDomain == null ) {
|
||||
urlAnchor = document.createElement( "a" );
|
||||
|
||||
// Support: IE <=8 - 11, Edge 12 - 15
|
||||
// IE throws exception on accessing the href property if url is malformed,
|
||||
// e.g. http://example.com:80x/
|
||||
try {
|
||||
urlAnchor.href = s.url;
|
||||
|
||||
// Support: IE <=8 - 11 only
|
||||
// Anchor's host property isn't correctly set when s.url is relative
|
||||
urlAnchor.href = urlAnchor.href;
|
||||
s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !==
|
||||
urlAnchor.protocol + "//" + urlAnchor.host;
|
||||
} catch ( e ) {
|
||||
|
||||
// If there is an error parsing the URL, assume it is crossDomain,
|
||||
// it can be rejected by the transport if it is invalid
|
||||
s.crossDomain = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Convert data if not already a string
|
||||
if ( s.data && s.processData && typeof s.data !== "string" ) {
|
||||
s.data = jQuery.param( s.data, s.traditional );
|
||||
}
|
||||
|
||||
// Apply prefilters
|
||||
inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
|
||||
|
||||
// If request was aborted inside a prefilter, stop there
|
||||
if ( completed ) {
|
||||
return jqXHR;
|
||||
}
|
||||
|
||||
// We can fire global events as of now if asked to
|
||||
// Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118)
|
||||
fireGlobals = jQuery.event && s.global;
|
||||
|
||||
// Watch for a new set of requests
|
||||
if ( fireGlobals && jQuery.active++ === 0 ) {
|
||||
jQuery.event.trigger( "ajaxStart" );
|
||||
}
|
||||
|
||||
// Uppercase the type
|
||||
s.type = s.type.toUpperCase();
|
||||
|
||||
// Determine if request has content
|
||||
s.hasContent = !rnoContent.test( s.type );
|
||||
|
||||
// Save the URL in case we're toying with the If-Modified-Since
|
||||
// and/or If-None-Match header later on
|
||||
// Remove hash to simplify url manipulation
|
||||
cacheURL = s.url.replace( rhash, "" );
|
||||
|
||||
// More options handling for requests with no content
|
||||
if ( !s.hasContent ) {
|
||||
|
||||
// Remember the hash so we can put it back
|
||||
uncached = s.url.slice( cacheURL.length );
|
||||
|
||||
// If data is available and should be processed, append data to url
|
||||
if ( s.data && ( s.processData || typeof s.data === "string" ) ) {
|
||||
cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data;
|
||||
|
||||
// #9682: remove data so that it's not used in an eventual retry
|
||||
delete s.data;
|
||||
}
|
||||
|
||||
// Add or update anti-cache param if needed
|
||||
if ( s.cache === false ) {
|
||||
cacheURL = cacheURL.replace( rantiCache, "$1" );
|
||||
uncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ( nonce.guid++ ) +
|
||||
uncached;
|
||||
}
|
||||
|
||||
// Put hash and anti-cache on the URL that will be requested (gh-1732)
|
||||
s.url = cacheURL + uncached;
|
||||
|
||||
// Change '%20' to '+' if this is encoded form body content (gh-2658)
|
||||
} else if ( s.data && s.processData &&
|
||||
( s.contentType || "" ).indexOf( "application/x-www-form-urlencoded" ) === 0 ) {
|
||||
s.data = s.data.replace( r20, "+" );
|
||||
}
|
||||
|
||||
// Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
|
||||
if ( s.ifModified ) {
|
||||
if ( jQuery.lastModified[ cacheURL ] ) {
|
||||
jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] );
|
||||
}
|
||||
if ( jQuery.etag[ cacheURL ] ) {
|
||||
jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] );
|
||||
}
|
||||
}
|
||||
|
||||
// Set the correct header, if data is being sent
|
||||
if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
|
||||
jqXHR.setRequestHeader( "Content-Type", s.contentType );
|
||||
}
|
||||
|
||||
// Set the Accepts header for the server, depending on the dataType
|
||||
jqXHR.setRequestHeader(
|
||||
"Accept",
|
||||
s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ?
|
||||
s.accepts[ s.dataTypes[ 0 ] ] +
|
||||
( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
|
||||
s.accepts[ "*" ]
|
||||
);
|
||||
|
||||
// Check for headers option
|
||||
for ( i in s.headers ) {
|
||||
jqXHR.setRequestHeader( i, s.headers[ i ] );
|
||||
}
|
||||
|
||||
// Allow custom headers/mimetypes and early abort
|
||||
if ( s.beforeSend &&
|
||||
( s.beforeSend.call( callbackContext, jqXHR, s ) === false || completed ) ) {
|
||||
|
||||
// Abort if not done already and return
|
||||
return jqXHR.abort();
|
||||
}
|
||||
|
||||
// Aborting is no longer a cancellation
|
||||
strAbort = "abort";
|
||||
|
||||
// Install callbacks on deferreds
|
||||
completeDeferred.add( s.complete );
|
||||
jqXHR.done( s.success );
|
||||
jqXHR.fail( s.error );
|
||||
|
||||
// Get transport
|
||||
transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
|
||||
|
||||
// If no transport, we auto-abort
|
||||
if ( !transport ) {
|
||||
done( -1, "No Transport" );
|
||||
} else {
|
||||
jqXHR.readyState = 1;
|
||||
|
||||
// Send global event
|
||||
if ( fireGlobals ) {
|
||||
globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
|
||||
}
|
||||
|
||||
// If request was aborted inside ajaxSend, stop there
|
||||
if ( completed ) {
|
||||
return jqXHR;
|
||||
}
|
||||
|
||||
// Timeout
|
||||
if ( s.async && s.timeout > 0 ) {
|
||||
timeoutTimer = window.setTimeout( function() {
|
||||
jqXHR.abort( "timeout" );
|
||||
}, s.timeout );
|
||||
}
|
||||
|
||||
try {
|
||||
completed = false;
|
||||
transport.send( requestHeaders, done );
|
||||
} catch ( e ) {
|
||||
|
||||
// Rethrow post-completion exceptions
|
||||
if ( completed ) {
|
||||
throw e;
|
||||
}
|
||||
|
||||
// Propagate others as results
|
||||
done( -1, e );
|
||||
}
|
||||
}
|
||||
|
||||
// Callback for when everything is done
|
||||
function done( status, nativeStatusText, responses, headers ) {
|
||||
var isSuccess, success, error, response, modified,
|
||||
statusText = nativeStatusText;
|
||||
|
||||
// Ignore repeat invocations
|
||||
if ( completed ) {
|
||||
return;
|
||||
}
|
||||
|
||||
completed = true;
|
||||
|
||||
// Clear timeout if it exists
|
||||
if ( timeoutTimer ) {
|
||||
window.clearTimeout( timeoutTimer );
|
||||
}
|
||||
|
||||
// Dereference transport for early garbage collection
|
||||
// (no matter how long the jqXHR object will be used)
|
||||
transport = undefined;
|
||||
|
||||
// Cache response headers
|
||||
responseHeadersString = headers || "";
|
||||
|
||||
// Set readyState
|
||||
jqXHR.readyState = status > 0 ? 4 : 0;
|
||||
|
||||
// Determine if successful
|
||||
isSuccess = status >= 200 && status < 300 || status === 304;
|
||||
|
||||
// Get response data
|
||||
if ( responses ) {
|
||||
response = ajaxHandleResponses( s, jqXHR, responses );
|
||||
}
|
||||
|
||||
// Use a noop converter for missing script but not if jsonp
|
||||
if ( !isSuccess &&
|
||||
jQuery.inArray( "script", s.dataTypes ) > -1 &&
|
||||
jQuery.inArray( "json", s.dataTypes ) < 0 ) {
|
||||
s.converters[ "text script" ] = function() {};
|
||||
}
|
||||
|
||||
// Convert no matter what (that way responseXXX fields are always set)
|
||||
response = ajaxConvert( s, response, jqXHR, isSuccess );
|
||||
|
||||
// If successful, handle type chaining
|
||||
if ( isSuccess ) {
|
||||
|
||||
// Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
|
||||
if ( s.ifModified ) {
|
||||
modified = jqXHR.getResponseHeader( "Last-Modified" );
|
||||
if ( modified ) {
|
||||
jQuery.lastModified[ cacheURL ] = modified;
|
||||
}
|
||||
modified = jqXHR.getResponseHeader( "etag" );
|
||||
if ( modified ) {
|
||||
jQuery.etag[ cacheURL ] = modified;
|
||||
}
|
||||
}
|
||||
|
||||
// if no content
|
||||
if ( status === 204 || s.type === "HEAD" ) {
|
||||
statusText = "nocontent";
|
||||
|
||||
// if not modified
|
||||
} else if ( status === 304 ) {
|
||||
statusText = "notmodified";
|
||||
|
||||
// If we have data, let's convert it
|
||||
} else {
|
||||
statusText = response.state;
|
||||
success = response.data;
|
||||
error = response.error;
|
||||
isSuccess = !error;
|
||||
}
|
||||
} else {
|
||||
|
||||
// Extract error from statusText and normalize for non-aborts
|
||||
error = statusText;
|
||||
if ( status || !statusText ) {
|
||||
statusText = "error";
|
||||
if ( status < 0 ) {
|
||||
status = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Set data for the fake xhr object
|
||||
jqXHR.status = status;
|
||||
jqXHR.statusText = ( nativeStatusText || statusText ) + "";
|
||||
|
||||
// Success/Error
|
||||
if ( isSuccess ) {
|
||||
deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
|
||||
} else {
|
||||
deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
|
||||
}
|
||||
|
||||
// Status-dependent callbacks
|
||||
jqXHR.statusCode( statusCode );
|
||||
statusCode = undefined;
|
||||
|
||||
if ( fireGlobals ) {
|
||||
globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",
|
||||
[ jqXHR, s, isSuccess ? success : error ] );
|
||||
}
|
||||
|
||||
// Complete
|
||||
completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
|
||||
|
||||
if ( fireGlobals ) {
|
||||
globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
|
||||
|
||||
// Handle the global AJAX counter
|
||||
if ( !( --jQuery.active ) ) {
|
||||
jQuery.event.trigger( "ajaxStop" );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return jqXHR;
|
||||
},
|
||||
|
||||
getJSON: function( url, data, callback ) {
|
||||
return jQuery.get( url, data, callback, "json" );
|
||||
},
|
||||
|
||||
getScript: function( url, callback ) {
|
||||
return jQuery.get( url, undefined, callback, "script" );
|
||||
}
|
||||
} );
|
||||
|
||||
jQuery.each( [ "get", "post" ], function( _i, method ) {
|
||||
jQuery[ method ] = function( url, data, callback, type ) {
|
||||
|
||||
// Shift arguments if data argument was omitted
|
||||
if ( isFunction( data ) ) {
|
||||
type = type || callback;
|
||||
callback = data;
|
||||
data = undefined;
|
||||
}
|
||||
|
||||
// The url can be an options object (which then must have .url)
|
||||
return jQuery.ajax( jQuery.extend( {
|
||||
url: url,
|
||||
type: method,
|
||||
dataType: type,
|
||||
data: data,
|
||||
success: callback
|
||||
}, jQuery.isPlainObject( url ) && url ) );
|
||||
};
|
||||
} );
|
||||
|
||||
jQuery.ajaxPrefilter( function( s ) {
|
||||
var i;
|
||||
for ( i in s.headers ) {
|
||||
if ( i.toLowerCase() === "content-type" ) {
|
||||
s.contentType = s.headers[ i ] || "";
|
||||
}
|
||||
}
|
||||
} );
|
||||
|
||||
return jQuery;
|
||||
} );
|
||||
103
node_modules/jquery/src/ajax/jsonp.js
generated
vendored
Normal file
103
node_modules/jquery/src/ajax/jsonp.js
generated
vendored
Normal file
@@ -0,0 +1,103 @@
|
||||
define( [
|
||||
"../core",
|
||||
"../var/isFunction",
|
||||
"./var/nonce",
|
||||
"./var/rquery",
|
||||
"../ajax"
|
||||
], function( jQuery, isFunction, nonce, rquery ) {
|
||||
|
||||
"use strict";
|
||||
|
||||
var oldCallbacks = [],
|
||||
rjsonp = /(=)\?(?=&|$)|\?\?/;
|
||||
|
||||
// Default jsonp settings
|
||||
jQuery.ajaxSetup( {
|
||||
jsonp: "callback",
|
||||
jsonpCallback: function() {
|
||||
var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce.guid++ ) );
|
||||
this[ callback ] = true;
|
||||
return callback;
|
||||
}
|
||||
} );
|
||||
|
||||
// Detect, normalize options and install callbacks for jsonp requests
|
||||
jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
|
||||
|
||||
var callbackName, overwritten, responseContainer,
|
||||
jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
|
||||
"url" :
|
||||
typeof s.data === "string" &&
|
||||
( s.contentType || "" )
|
||||
.indexOf( "application/x-www-form-urlencoded" ) === 0 &&
|
||||
rjsonp.test( s.data ) && "data"
|
||||
);
|
||||
|
||||
// Handle iff the expected data type is "jsonp" or we have a parameter to set
|
||||
if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) {
|
||||
|
||||
// Get callback name, remembering preexisting value associated with it
|
||||
callbackName = s.jsonpCallback = isFunction( s.jsonpCallback ) ?
|
||||
s.jsonpCallback() :
|
||||
s.jsonpCallback;
|
||||
|
||||
// Insert callback into url or form data
|
||||
if ( jsonProp ) {
|
||||
s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName );
|
||||
} else if ( s.jsonp !== false ) {
|
||||
s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
|
||||
}
|
||||
|
||||
// Use data converter to retrieve json after script execution
|
||||
s.converters[ "script json" ] = function() {
|
||||
if ( !responseContainer ) {
|
||||
jQuery.error( callbackName + " was not called" );
|
||||
}
|
||||
return responseContainer[ 0 ];
|
||||
};
|
||||
|
||||
// Force json dataType
|
||||
s.dataTypes[ 0 ] = "json";
|
||||
|
||||
// Install callback
|
||||
overwritten = window[ callbackName ];
|
||||
window[ callbackName ] = function() {
|
||||
responseContainer = arguments;
|
||||
};
|
||||
|
||||
// Clean-up function (fires after converters)
|
||||
jqXHR.always( function() {
|
||||
|
||||
// If previous value didn't exist - remove it
|
||||
if ( overwritten === undefined ) {
|
||||
jQuery( window ).removeProp( callbackName );
|
||||
|
||||
// Otherwise restore preexisting value
|
||||
} else {
|
||||
window[ callbackName ] = overwritten;
|
||||
}
|
||||
|
||||
// Save back as free
|
||||
if ( s[ callbackName ] ) {
|
||||
|
||||
// Make sure that re-using the options doesn't screw things around
|
||||
s.jsonpCallback = originalSettings.jsonpCallback;
|
||||
|
||||
// Save the callback name for future use
|
||||
oldCallbacks.push( callbackName );
|
||||
}
|
||||
|
||||
// Call if it was a function and we have a response
|
||||
if ( responseContainer && isFunction( overwritten ) ) {
|
||||
overwritten( responseContainer[ 0 ] );
|
||||
}
|
||||
|
||||
responseContainer = overwritten = undefined;
|
||||
} );
|
||||
|
||||
// Delegate to script
|
||||
return "script";
|
||||
}
|
||||
} );
|
||||
|
||||
} );
|
||||
77
node_modules/jquery/src/ajax/load.js
generated
vendored
Normal file
77
node_modules/jquery/src/ajax/load.js
generated
vendored
Normal file
@@ -0,0 +1,77 @@
|
||||
define( [
|
||||
"../core",
|
||||
"../core/stripAndCollapse",
|
||||
"../var/isFunction",
|
||||
"../core/parseHTML",
|
||||
"../ajax",
|
||||
"../traversing",
|
||||
"../manipulation",
|
||||
"../selector"
|
||||
], function( jQuery, stripAndCollapse, isFunction ) {
|
||||
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* Load a url into a page
|
||||
*/
|
||||
jQuery.fn.load = function( url, params, callback ) {
|
||||
var selector, type, response,
|
||||
self = this,
|
||||
off = url.indexOf( " " );
|
||||
|
||||
if ( off > -1 ) {
|
||||
selector = stripAndCollapse( url.slice( off ) );
|
||||
url = url.slice( 0, off );
|
||||
}
|
||||
|
||||
// If it's a function
|
||||
if ( isFunction( params ) ) {
|
||||
|
||||
// We assume that it's the callback
|
||||
callback = params;
|
||||
params = undefined;
|
||||
|
||||
// Otherwise, build a param string
|
||||
} else if ( params && typeof params === "object" ) {
|
||||
type = "POST";
|
||||
}
|
||||
|
||||
// If we have elements to modify, make the request
|
||||
if ( self.length > 0 ) {
|
||||
jQuery.ajax( {
|
||||
url: url,
|
||||
|
||||
// If "type" variable is undefined, then "GET" method will be used.
|
||||
// Make value of this field explicit since
|
||||
// user can override it through ajaxSetup method
|
||||
type: type || "GET",
|
||||
dataType: "html",
|
||||
data: params
|
||||
} ).done( function( responseText ) {
|
||||
|
||||
// Save response for use in complete callback
|
||||
response = arguments;
|
||||
|
||||
self.html( selector ?
|
||||
|
||||
// If a selector was specified, locate the right elements in a dummy div
|
||||
// Exclude scripts to avoid IE 'Permission Denied' errors
|
||||
jQuery( "<div>" ).append( jQuery.parseHTML( responseText ) ).find( selector ) :
|
||||
|
||||
// Otherwise use the full result
|
||||
responseText );
|
||||
|
||||
// If the request succeeds, this function gets "data", "status", "jqXHR"
|
||||
// but they are ignored because response was set above.
|
||||
// If it fails, this function gets "jqXHR", "status", "error"
|
||||
} ).always( callback && function( jqXHR, status ) {
|
||||
self.each( function() {
|
||||
callback.apply( this, response || [ jqXHR.responseText, status, jqXHR ] );
|
||||
} );
|
||||
} );
|
||||
}
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
} );
|
||||
74
node_modules/jquery/src/ajax/script.js
generated
vendored
Normal file
74
node_modules/jquery/src/ajax/script.js
generated
vendored
Normal file
@@ -0,0 +1,74 @@
|
||||
define( [
|
||||
"../core",
|
||||
"../var/document",
|
||||
"../ajax"
|
||||
], function( jQuery, document ) {
|
||||
|
||||
"use strict";
|
||||
|
||||
// Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432)
|
||||
jQuery.ajaxPrefilter( function( s ) {
|
||||
if ( s.crossDomain ) {
|
||||
s.contents.script = false;
|
||||
}
|
||||
} );
|
||||
|
||||
// Install script dataType
|
||||
jQuery.ajaxSetup( {
|
||||
accepts: {
|
||||
script: "text/javascript, application/javascript, " +
|
||||
"application/ecmascript, application/x-ecmascript"
|
||||
},
|
||||
contents: {
|
||||
script: /\b(?:java|ecma)script\b/
|
||||
},
|
||||
converters: {
|
||||
"text script": function( text ) {
|
||||
jQuery.globalEval( text );
|
||||
return text;
|
||||
}
|
||||
}
|
||||
} );
|
||||
|
||||
// Handle cache's special case and crossDomain
|
||||
jQuery.ajaxPrefilter( "script", function( s ) {
|
||||
if ( s.cache === undefined ) {
|
||||
s.cache = false;
|
||||
}
|
||||
if ( s.crossDomain ) {
|
||||
s.type = "GET";
|
||||
}
|
||||
} );
|
||||
|
||||
// Bind script tag hack transport
|
||||
jQuery.ajaxTransport( "script", function( s ) {
|
||||
|
||||
// This transport only deals with cross domain or forced-by-attrs requests
|
||||
if ( s.crossDomain || s.scriptAttrs ) {
|
||||
var script, callback;
|
||||
return {
|
||||
send: function( _, complete ) {
|
||||
script = jQuery( "<script>" )
|
||||
.attr( s.scriptAttrs || {} )
|
||||
.prop( { charset: s.scriptCharset, src: s.url } )
|
||||
.on( "load error", callback = function( evt ) {
|
||||
script.remove();
|
||||
callback = null;
|
||||
if ( evt ) {
|
||||
complete( evt.type === "error" ? 404 : 200, evt.type );
|
||||
}
|
||||
} );
|
||||
|
||||
// Use native DOM manipulation to avoid our domManip AJAX trickery
|
||||
document.head.appendChild( script[ 0 ] );
|
||||
},
|
||||
abort: function() {
|
||||
if ( callback ) {
|
||||
callback();
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
} );
|
||||
|
||||
} );
|
||||
5
node_modules/jquery/src/ajax/var/location.js
generated
vendored
Normal file
5
node_modules/jquery/src/ajax/var/location.js
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
define( function() {
|
||||
"use strict";
|
||||
|
||||
return window.location;
|
||||
} );
|
||||
5
node_modules/jquery/src/ajax/var/nonce.js
generated
vendored
Normal file
5
node_modules/jquery/src/ajax/var/nonce.js
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
define( function() {
|
||||
"use strict";
|
||||
|
||||
return { guid: Date.now() };
|
||||
} );
|
||||
5
node_modules/jquery/src/ajax/var/rquery.js
generated
vendored
Normal file
5
node_modules/jquery/src/ajax/var/rquery.js
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
define( function() {
|
||||
"use strict";
|
||||
|
||||
return ( /\?/ );
|
||||
} );
|
||||
170
node_modules/jquery/src/ajax/xhr.js
generated
vendored
Normal file
170
node_modules/jquery/src/ajax/xhr.js
generated
vendored
Normal file
@@ -0,0 +1,170 @@
|
||||
define( [
|
||||
"../core",
|
||||
"../var/support",
|
||||
"../ajax"
|
||||
], function( jQuery, support ) {
|
||||
|
||||
"use strict";
|
||||
|
||||
jQuery.ajaxSettings.xhr = function() {
|
||||
try {
|
||||
return new window.XMLHttpRequest();
|
||||
} catch ( e ) {}
|
||||
};
|
||||
|
||||
var xhrSuccessStatus = {
|
||||
|
||||
// File protocol always yields status code 0, assume 200
|
||||
0: 200,
|
||||
|
||||
// Support: IE <=9 only
|
||||
// #1450: sometimes IE returns 1223 when it should be 204
|
||||
1223: 204
|
||||
},
|
||||
xhrSupported = jQuery.ajaxSettings.xhr();
|
||||
|
||||
support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
|
||||
support.ajax = xhrSupported = !!xhrSupported;
|
||||
|
||||
jQuery.ajaxTransport( function( options ) {
|
||||
var callback, errorCallback;
|
||||
|
||||
// Cross domain only allowed if supported through XMLHttpRequest
|
||||
if ( support.cors || xhrSupported && !options.crossDomain ) {
|
||||
return {
|
||||
send: function( headers, complete ) {
|
||||
var i,
|
||||
xhr = options.xhr();
|
||||
|
||||
xhr.open(
|
||||
options.type,
|
||||
options.url,
|
||||
options.async,
|
||||
options.username,
|
||||
options.password
|
||||
);
|
||||
|
||||
// Apply custom fields if provided
|
||||
if ( options.xhrFields ) {
|
||||
for ( i in options.xhrFields ) {
|
||||
xhr[ i ] = options.xhrFields[ i ];
|
||||
}
|
||||
}
|
||||
|
||||
// Override mime type if needed
|
||||
if ( options.mimeType && xhr.overrideMimeType ) {
|
||||
xhr.overrideMimeType( options.mimeType );
|
||||
}
|
||||
|
||||
// X-Requested-With header
|
||||
// For cross-domain requests, seeing as conditions for a preflight are
|
||||
// akin to a jigsaw puzzle, we simply never set it to be sure.
|
||||
// (it can always be set on a per-request basis or even using ajaxSetup)
|
||||
// For same-domain requests, won't change header if already provided.
|
||||
if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) {
|
||||
headers[ "X-Requested-With" ] = "XMLHttpRequest";
|
||||
}
|
||||
|
||||
// Set headers
|
||||
for ( i in headers ) {
|
||||
xhr.setRequestHeader( i, headers[ i ] );
|
||||
}
|
||||
|
||||
// Callback
|
||||
callback = function( type ) {
|
||||
return function() {
|
||||
if ( callback ) {
|
||||
callback = errorCallback = xhr.onload =
|
||||
xhr.onerror = xhr.onabort = xhr.ontimeout =
|
||||
xhr.onreadystatechange = null;
|
||||
|
||||
if ( type === "abort" ) {
|
||||
xhr.abort();
|
||||
} else if ( type === "error" ) {
|
||||
|
||||
// Support: IE <=9 only
|
||||
// On a manual native abort, IE9 throws
|
||||
// errors on any property access that is not readyState
|
||||
if ( typeof xhr.status !== "number" ) {
|
||||
complete( 0, "error" );
|
||||
} else {
|
||||
complete(
|
||||
|
||||
// File: protocol always yields status 0; see #8605, #14207
|
||||
xhr.status,
|
||||
xhr.statusText
|
||||
);
|
||||
}
|
||||
} else {
|
||||
complete(
|
||||
xhrSuccessStatus[ xhr.status ] || xhr.status,
|
||||
xhr.statusText,
|
||||
|
||||
// Support: IE <=9 only
|
||||
// IE9 has no XHR2 but throws on binary (trac-11426)
|
||||
// For XHR2 non-text, let the caller handle it (gh-2498)
|
||||
( xhr.responseType || "text" ) !== "text" ||
|
||||
typeof xhr.responseText !== "string" ?
|
||||
{ binary: xhr.response } :
|
||||
{ text: xhr.responseText },
|
||||
xhr.getAllResponseHeaders()
|
||||
);
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
// Listen to events
|
||||
xhr.onload = callback();
|
||||
errorCallback = xhr.onerror = xhr.ontimeout = callback( "error" );
|
||||
|
||||
// Support: IE 9 only
|
||||
// Use onreadystatechange to replace onabort
|
||||
// to handle uncaught aborts
|
||||
if ( xhr.onabort !== undefined ) {
|
||||
xhr.onabort = errorCallback;
|
||||
} else {
|
||||
xhr.onreadystatechange = function() {
|
||||
|
||||
// Check readyState before timeout as it changes
|
||||
if ( xhr.readyState === 4 ) {
|
||||
|
||||
// Allow onerror to be called first,
|
||||
// but that will not handle a native abort
|
||||
// Also, save errorCallback to a variable
|
||||
// as xhr.onerror cannot be accessed
|
||||
window.setTimeout( function() {
|
||||
if ( callback ) {
|
||||
errorCallback();
|
||||
}
|
||||
} );
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// Create the abort callback
|
||||
callback = callback( "abort" );
|
||||
|
||||
try {
|
||||
|
||||
// Do send the request (this may raise an exception)
|
||||
xhr.send( options.hasContent && options.data || null );
|
||||
} catch ( e ) {
|
||||
|
||||
// #14683: Only rethrow if this hasn't been notified as an error yet
|
||||
if ( callback ) {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
abort: function() {
|
||||
if ( callback ) {
|
||||
callback();
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
} );
|
||||
|
||||
} );
|
||||
13
node_modules/jquery/src/attributes.js
generated
vendored
Normal file
13
node_modules/jquery/src/attributes.js
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
define( [
|
||||
"./core",
|
||||
"./attributes/attr",
|
||||
"./attributes/prop",
|
||||
"./attributes/classes",
|
||||
"./attributes/val"
|
||||
], function( jQuery ) {
|
||||
|
||||
"use strict";
|
||||
|
||||
// Return jQuery for attributes-only inclusion
|
||||
return jQuery;
|
||||
} );
|
||||
141
node_modules/jquery/src/attributes/attr.js
generated
vendored
Normal file
141
node_modules/jquery/src/attributes/attr.js
generated
vendored
Normal file
@@ -0,0 +1,141 @@
|
||||
define( [
|
||||
"../core",
|
||||
"../core/access",
|
||||
"../core/nodeName",
|
||||
"./support",
|
||||
"../var/rnothtmlwhite",
|
||||
"../selector"
|
||||
], function( jQuery, access, nodeName, support, rnothtmlwhite ) {
|
||||
|
||||
"use strict";
|
||||
|
||||
var boolHook,
|
||||
attrHandle = jQuery.expr.attrHandle;
|
||||
|
||||
jQuery.fn.extend( {
|
||||
attr: function( name, value ) {
|
||||
return access( this, jQuery.attr, name, value, arguments.length > 1 );
|
||||
},
|
||||
|
||||
removeAttr: function( name ) {
|
||||
return this.each( function() {
|
||||
jQuery.removeAttr( this, name );
|
||||
} );
|
||||
}
|
||||
} );
|
||||
|
||||
jQuery.extend( {
|
||||
attr: function( elem, name, value ) {
|
||||
var ret, hooks,
|
||||
nType = elem.nodeType;
|
||||
|
||||
// Don't get/set attributes on text, comment and attribute nodes
|
||||
if ( nType === 3 || nType === 8 || nType === 2 ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Fallback to prop when attributes are not supported
|
||||
if ( typeof elem.getAttribute === "undefined" ) {
|
||||
return jQuery.prop( elem, name, value );
|
||||
}
|
||||
|
||||
// Attribute hooks are determined by the lowercase version
|
||||
// Grab necessary hook if one is defined
|
||||
if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
|
||||
hooks = jQuery.attrHooks[ name.toLowerCase() ] ||
|
||||
( jQuery.expr.match.bool.test( name ) ? boolHook : undefined );
|
||||
}
|
||||
|
||||
if ( value !== undefined ) {
|
||||
if ( value === null ) {
|
||||
jQuery.removeAttr( elem, name );
|
||||
return;
|
||||
}
|
||||
|
||||
if ( hooks && "set" in hooks &&
|
||||
( ret = hooks.set( elem, value, name ) ) !== undefined ) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
elem.setAttribute( name, value + "" );
|
||||
return value;
|
||||
}
|
||||
|
||||
if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = jQuery.find.attr( elem, name );
|
||||
|
||||
// Non-existent attributes return null, we normalize to undefined
|
||||
return ret == null ? undefined : ret;
|
||||
},
|
||||
|
||||
attrHooks: {
|
||||
type: {
|
||||
set: function( elem, value ) {
|
||||
if ( !support.radioValue && value === "radio" &&
|
||||
nodeName( elem, "input" ) ) {
|
||||
var val = elem.value;
|
||||
elem.setAttribute( "type", value );
|
||||
if ( val ) {
|
||||
elem.value = val;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
removeAttr: function( elem, value ) {
|
||||
var name,
|
||||
i = 0,
|
||||
|
||||
// Attribute names can contain non-HTML whitespace characters
|
||||
// https://html.spec.whatwg.org/multipage/syntax.html#attributes-2
|
||||
attrNames = value && value.match( rnothtmlwhite );
|
||||
|
||||
if ( attrNames && elem.nodeType === 1 ) {
|
||||
while ( ( name = attrNames[ i++ ] ) ) {
|
||||
elem.removeAttribute( name );
|
||||
}
|
||||
}
|
||||
}
|
||||
} );
|
||||
|
||||
// Hooks for boolean attributes
|
||||
boolHook = {
|
||||
set: function( elem, value, name ) {
|
||||
if ( value === false ) {
|
||||
|
||||
// Remove boolean attributes when set to false
|
||||
jQuery.removeAttr( elem, name );
|
||||
} else {
|
||||
elem.setAttribute( name, name );
|
||||
}
|
||||
return name;
|
||||
}
|
||||
};
|
||||
|
||||
jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( _i, name ) {
|
||||
var getter = attrHandle[ name ] || jQuery.find.attr;
|
||||
|
||||
attrHandle[ name ] = function( elem, name, isXML ) {
|
||||
var ret, handle,
|
||||
lowercaseName = name.toLowerCase();
|
||||
|
||||
if ( !isXML ) {
|
||||
|
||||
// Avoid an infinite loop by temporarily removing this function from the getter
|
||||
handle = attrHandle[ lowercaseName ];
|
||||
attrHandle[ lowercaseName ] = ret;
|
||||
ret = getter( elem, name, isXML ) != null ?
|
||||
lowercaseName :
|
||||
null;
|
||||
attrHandle[ lowercaseName ] = handle;
|
||||
}
|
||||
return ret;
|
||||
};
|
||||
} );
|
||||
|
||||
} );
|
||||
186
node_modules/jquery/src/attributes/classes.js
generated
vendored
Normal file
186
node_modules/jquery/src/attributes/classes.js
generated
vendored
Normal file
@@ -0,0 +1,186 @@
|
||||
define( [
|
||||
"../core",
|
||||
"../core/stripAndCollapse",
|
||||
"../var/isFunction",
|
||||
"../var/rnothtmlwhite",
|
||||
"../data/var/dataPriv",
|
||||
"../core/init"
|
||||
], function( jQuery, stripAndCollapse, isFunction, rnothtmlwhite, dataPriv ) {
|
||||
|
||||
"use strict";
|
||||
|
||||
function getClass( elem ) {
|
||||
return elem.getAttribute && elem.getAttribute( "class" ) || "";
|
||||
}
|
||||
|
||||
function classesToArray( value ) {
|
||||
if ( Array.isArray( value ) ) {
|
||||
return value;
|
||||
}
|
||||
if ( typeof value === "string" ) {
|
||||
return value.match( rnothtmlwhite ) || [];
|
||||
}
|
||||
return [];
|
||||
}
|
||||
|
||||
jQuery.fn.extend( {
|
||||
addClass: function( value ) {
|
||||
var classes, elem, cur, curValue, clazz, j, finalValue,
|
||||
i = 0;
|
||||
|
||||
if ( isFunction( value ) ) {
|
||||
return this.each( function( j ) {
|
||||
jQuery( this ).addClass( value.call( this, j, getClass( this ) ) );
|
||||
} );
|
||||
}
|
||||
|
||||
classes = classesToArray( value );
|
||||
|
||||
if ( classes.length ) {
|
||||
while ( ( elem = this[ i++ ] ) ) {
|
||||
curValue = getClass( elem );
|
||||
cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
|
||||
|
||||
if ( cur ) {
|
||||
j = 0;
|
||||
while ( ( clazz = classes[ j++ ] ) ) {
|
||||
if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
|
||||
cur += clazz + " ";
|
||||
}
|
||||
}
|
||||
|
||||
// Only assign if different to avoid unneeded rendering.
|
||||
finalValue = stripAndCollapse( cur );
|
||||
if ( curValue !== finalValue ) {
|
||||
elem.setAttribute( "class", finalValue );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
removeClass: function( value ) {
|
||||
var classes, elem, cur, curValue, clazz, j, finalValue,
|
||||
i = 0;
|
||||
|
||||
if ( isFunction( value ) ) {
|
||||
return this.each( function( j ) {
|
||||
jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) );
|
||||
} );
|
||||
}
|
||||
|
||||
if ( !arguments.length ) {
|
||||
return this.attr( "class", "" );
|
||||
}
|
||||
|
||||
classes = classesToArray( value );
|
||||
|
||||
if ( classes.length ) {
|
||||
while ( ( elem = this[ i++ ] ) ) {
|
||||
curValue = getClass( elem );
|
||||
|
||||
// This expression is here for better compressibility (see addClass)
|
||||
cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
|
||||
|
||||
if ( cur ) {
|
||||
j = 0;
|
||||
while ( ( clazz = classes[ j++ ] ) ) {
|
||||
|
||||
// Remove *all* instances
|
||||
while ( cur.indexOf( " " + clazz + " " ) > -1 ) {
|
||||
cur = cur.replace( " " + clazz + " ", " " );
|
||||
}
|
||||
}
|
||||
|
||||
// Only assign if different to avoid unneeded rendering.
|
||||
finalValue = stripAndCollapse( cur );
|
||||
if ( curValue !== finalValue ) {
|
||||
elem.setAttribute( "class", finalValue );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
toggleClass: function( value, stateVal ) {
|
||||
var type = typeof value,
|
||||
isValidValue = type === "string" || Array.isArray( value );
|
||||
|
||||
if ( typeof stateVal === "boolean" && isValidValue ) {
|
||||
return stateVal ? this.addClass( value ) : this.removeClass( value );
|
||||
}
|
||||
|
||||
if ( isFunction( value ) ) {
|
||||
return this.each( function( i ) {
|
||||
jQuery( this ).toggleClass(
|
||||
value.call( this, i, getClass( this ), stateVal ),
|
||||
stateVal
|
||||
);
|
||||
} );
|
||||
}
|
||||
|
||||
return this.each( function() {
|
||||
var className, i, self, classNames;
|
||||
|
||||
if ( isValidValue ) {
|
||||
|
||||
// Toggle individual class names
|
||||
i = 0;
|
||||
self = jQuery( this );
|
||||
classNames = classesToArray( value );
|
||||
|
||||
while ( ( className = classNames[ i++ ] ) ) {
|
||||
|
||||
// Check each className given, space separated list
|
||||
if ( self.hasClass( className ) ) {
|
||||
self.removeClass( className );
|
||||
} else {
|
||||
self.addClass( className );
|
||||
}
|
||||
}
|
||||
|
||||
// Toggle whole class name
|
||||
} else if ( value === undefined || type === "boolean" ) {
|
||||
className = getClass( this );
|
||||
if ( className ) {
|
||||
|
||||
// Store className if set
|
||||
dataPriv.set( this, "__className__", className );
|
||||
}
|
||||
|
||||
// If the element has a class name or if we're passed `false`,
|
||||
// then remove the whole classname (if there was one, the above saved it).
|
||||
// Otherwise bring back whatever was previously saved (if anything),
|
||||
// falling back to the empty string if nothing was stored.
|
||||
if ( this.setAttribute ) {
|
||||
this.setAttribute( "class",
|
||||
className || value === false ?
|
||||
"" :
|
||||
dataPriv.get( this, "__className__" ) || ""
|
||||
);
|
||||
}
|
||||
}
|
||||
} );
|
||||
},
|
||||
|
||||
hasClass: function( selector ) {
|
||||
var className, elem,
|
||||
i = 0;
|
||||
|
||||
className = " " + selector + " ";
|
||||
while ( ( elem = this[ i++ ] ) ) {
|
||||
if ( elem.nodeType === 1 &&
|
||||
( " " + stripAndCollapse( getClass( elem ) ) + " " ).indexOf( className ) > -1 ) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
} );
|
||||
|
||||
} );
|
||||
143
node_modules/jquery/src/attributes/prop.js
generated
vendored
Normal file
143
node_modules/jquery/src/attributes/prop.js
generated
vendored
Normal file
@@ -0,0 +1,143 @@
|
||||
define( [
|
||||
"../core",
|
||||
"../core/access",
|
||||
"./support",
|
||||
"../selector"
|
||||
], function( jQuery, access, support ) {
|
||||
|
||||
"use strict";
|
||||
|
||||
var rfocusable = /^(?:input|select|textarea|button)$/i,
|
||||
rclickable = /^(?:a|area)$/i;
|
||||
|
||||
jQuery.fn.extend( {
|
||||
prop: function( name, value ) {
|
||||
return access( this, jQuery.prop, name, value, arguments.length > 1 );
|
||||
},
|
||||
|
||||
removeProp: function( name ) {
|
||||
return this.each( function() {
|
||||
delete this[ jQuery.propFix[ name ] || name ];
|
||||
} );
|
||||
}
|
||||
} );
|
||||
|
||||
jQuery.extend( {
|
||||
prop: function( elem, name, value ) {
|
||||
var ret, hooks,
|
||||
nType = elem.nodeType;
|
||||
|
||||
// Don't get/set properties on text, comment and attribute nodes
|
||||
if ( nType === 3 || nType === 8 || nType === 2 ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
|
||||
|
||||
// Fix name and attach hooks
|
||||
name = jQuery.propFix[ name ] || name;
|
||||
hooks = jQuery.propHooks[ name ];
|
||||
}
|
||||
|
||||
if ( value !== undefined ) {
|
||||
if ( hooks && "set" in hooks &&
|
||||
( ret = hooks.set( elem, value, name ) ) !== undefined ) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
return ( elem[ name ] = value );
|
||||
}
|
||||
|
||||
if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
return elem[ name ];
|
||||
},
|
||||
|
||||
propHooks: {
|
||||
tabIndex: {
|
||||
get: function( elem ) {
|
||||
|
||||
// Support: IE <=9 - 11 only
|
||||
// elem.tabIndex doesn't always return the
|
||||
// correct value when it hasn't been explicitly set
|
||||
// https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
|
||||
// Use proper attribute retrieval(#12072)
|
||||
var tabindex = jQuery.find.attr( elem, "tabindex" );
|
||||
|
||||
if ( tabindex ) {
|
||||
return parseInt( tabindex, 10 );
|
||||
}
|
||||
|
||||
if (
|
||||
rfocusable.test( elem.nodeName ) ||
|
||||
rclickable.test( elem.nodeName ) &&
|
||||
elem.href
|
||||
) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
propFix: {
|
||||
"for": "htmlFor",
|
||||
"class": "className"
|
||||
}
|
||||
} );
|
||||
|
||||
// Support: IE <=11 only
|
||||
// Accessing the selectedIndex property
|
||||
// forces the browser to respect setting selected
|
||||
// on the option
|
||||
// The getter ensures a default option is selected
|
||||
// when in an optgroup
|
||||
// eslint rule "no-unused-expressions" is disabled for this code
|
||||
// since it considers such accessions noop
|
||||
if ( !support.optSelected ) {
|
||||
jQuery.propHooks.selected = {
|
||||
get: function( elem ) {
|
||||
|
||||
/* eslint no-unused-expressions: "off" */
|
||||
|
||||
var parent = elem.parentNode;
|
||||
if ( parent && parent.parentNode ) {
|
||||
parent.parentNode.selectedIndex;
|
||||
}
|
||||
return null;
|
||||
},
|
||||
set: function( elem ) {
|
||||
|
||||
/* eslint no-unused-expressions: "off" */
|
||||
|
||||
var parent = elem.parentNode;
|
||||
if ( parent ) {
|
||||
parent.selectedIndex;
|
||||
|
||||
if ( parent.parentNode ) {
|
||||
parent.parentNode.selectedIndex;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
jQuery.each( [
|
||||
"tabIndex",
|
||||
"readOnly",
|
||||
"maxLength",
|
||||
"cellSpacing",
|
||||
"cellPadding",
|
||||
"rowSpan",
|
||||
"colSpan",
|
||||
"useMap",
|
||||
"frameBorder",
|
||||
"contentEditable"
|
||||
], function() {
|
||||
jQuery.propFix[ this.toLowerCase() ] = this;
|
||||
} );
|
||||
|
||||
} );
|
||||
33
node_modules/jquery/src/attributes/support.js
generated
vendored
Normal file
33
node_modules/jquery/src/attributes/support.js
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
define( [
|
||||
"../var/document",
|
||||
"../var/support"
|
||||
], function( document, support ) {
|
||||
|
||||
"use strict";
|
||||
|
||||
( function() {
|
||||
var input = document.createElement( "input" ),
|
||||
select = document.createElement( "select" ),
|
||||
opt = select.appendChild( document.createElement( "option" ) );
|
||||
|
||||
input.type = "checkbox";
|
||||
|
||||
// Support: Android <=4.3 only
|
||||
// Default value for a checkbox should be "on"
|
||||
support.checkOn = input.value !== "";
|
||||
|
||||
// Support: IE <=11 only
|
||||
// Must access selectedIndex to make default options select
|
||||
support.optSelected = opt.selected;
|
||||
|
||||
// Support: IE <=11 only
|
||||
// An input loses its value after becoming a radio
|
||||
input = document.createElement( "input" );
|
||||
input.value = "t";
|
||||
input.type = "radio";
|
||||
support.radioValue = input.value === "t";
|
||||
} )();
|
||||
|
||||
return support;
|
||||
|
||||
} );
|
||||
191
node_modules/jquery/src/attributes/val.js
generated
vendored
Normal file
191
node_modules/jquery/src/attributes/val.js
generated
vendored
Normal file
@@ -0,0 +1,191 @@
|
||||
define( [
|
||||
"../core",
|
||||
"../core/stripAndCollapse",
|
||||
"./support",
|
||||
"../core/nodeName",
|
||||
"../var/isFunction",
|
||||
|
||||
"../core/init"
|
||||
], function( jQuery, stripAndCollapse, support, nodeName, isFunction ) {
|
||||
|
||||
"use strict";
|
||||
|
||||
var rreturn = /\r/g;
|
||||
|
||||
jQuery.fn.extend( {
|
||||
val: function( value ) {
|
||||
var hooks, ret, valueIsFunction,
|
||||
elem = this[ 0 ];
|
||||
|
||||
if ( !arguments.length ) {
|
||||
if ( elem ) {
|
||||
hooks = jQuery.valHooks[ elem.type ] ||
|
||||
jQuery.valHooks[ elem.nodeName.toLowerCase() ];
|
||||
|
||||
if ( hooks &&
|
||||
"get" in hooks &&
|
||||
( ret = hooks.get( elem, "value" ) ) !== undefined
|
||||
) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = elem.value;
|
||||
|
||||
// Handle most common string cases
|
||||
if ( typeof ret === "string" ) {
|
||||
return ret.replace( rreturn, "" );
|
||||
}
|
||||
|
||||
// Handle cases where value is null/undef or number
|
||||
return ret == null ? "" : ret;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
valueIsFunction = isFunction( value );
|
||||
|
||||
return this.each( function( i ) {
|
||||
var val;
|
||||
|
||||
if ( this.nodeType !== 1 ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( valueIsFunction ) {
|
||||
val = value.call( this, i, jQuery( this ).val() );
|
||||
} else {
|
||||
val = value;
|
||||
}
|
||||
|
||||
// Treat null/undefined as ""; convert numbers to string
|
||||
if ( val == null ) {
|
||||
val = "";
|
||||
|
||||
} else if ( typeof val === "number" ) {
|
||||
val += "";
|
||||
|
||||
} else if ( Array.isArray( val ) ) {
|
||||
val = jQuery.map( val, function( value ) {
|
||||
return value == null ? "" : value + "";
|
||||
} );
|
||||
}
|
||||
|
||||
hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
|
||||
|
||||
// If set returns undefined, fall back to normal setting
|
||||
if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) {
|
||||
this.value = val;
|
||||
}
|
||||
} );
|
||||
}
|
||||
} );
|
||||
|
||||
jQuery.extend( {
|
||||
valHooks: {
|
||||
option: {
|
||||
get: function( elem ) {
|
||||
|
||||
var val = jQuery.find.attr( elem, "value" );
|
||||
return val != null ?
|
||||
val :
|
||||
|
||||
// Support: IE <=10 - 11 only
|
||||
// option.text throws exceptions (#14686, #14858)
|
||||
// Strip and collapse whitespace
|
||||
// https://html.spec.whatwg.org/#strip-and-collapse-whitespace
|
||||
stripAndCollapse( jQuery.text( elem ) );
|
||||
}
|
||||
},
|
||||
select: {
|
||||
get: function( elem ) {
|
||||
var value, option, i,
|
||||
options = elem.options,
|
||||
index = elem.selectedIndex,
|
||||
one = elem.type === "select-one",
|
||||
values = one ? null : [],
|
||||
max = one ? index + 1 : options.length;
|
||||
|
||||
if ( index < 0 ) {
|
||||
i = max;
|
||||
|
||||
} else {
|
||||
i = one ? index : 0;
|
||||
}
|
||||
|
||||
// Loop through all the selected options
|
||||
for ( ; i < max; i++ ) {
|
||||
option = options[ i ];
|
||||
|
||||
// Support: IE <=9 only
|
||||
// IE8-9 doesn't update selected after form reset (#2551)
|
||||
if ( ( option.selected || i === index ) &&
|
||||
|
||||
// Don't return options that are disabled or in a disabled optgroup
|
||||
!option.disabled &&
|
||||
( !option.parentNode.disabled ||
|
||||
!nodeName( option.parentNode, "optgroup" ) ) ) {
|
||||
|
||||
// Get the specific value for the option
|
||||
value = jQuery( option ).val();
|
||||
|
||||
// We don't need an array for one selects
|
||||
if ( one ) {
|
||||
return value;
|
||||
}
|
||||
|
||||
// Multi-Selects return an array
|
||||
values.push( value );
|
||||
}
|
||||
}
|
||||
|
||||
return values;
|
||||
},
|
||||
|
||||
set: function( elem, value ) {
|
||||
var optionSet, option,
|
||||
options = elem.options,
|
||||
values = jQuery.makeArray( value ),
|
||||
i = options.length;
|
||||
|
||||
while ( i-- ) {
|
||||
option = options[ i ];
|
||||
|
||||
/* eslint-disable no-cond-assign */
|
||||
|
||||
if ( option.selected =
|
||||
jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1
|
||||
) {
|
||||
optionSet = true;
|
||||
}
|
||||
|
||||
/* eslint-enable no-cond-assign */
|
||||
}
|
||||
|
||||
// Force browsers to behave consistently when non-matching value is set
|
||||
if ( !optionSet ) {
|
||||
elem.selectedIndex = -1;
|
||||
}
|
||||
return values;
|
||||
}
|
||||
}
|
||||
}
|
||||
} );
|
||||
|
||||
// Radios and checkboxes getter/setter
|
||||
jQuery.each( [ "radio", "checkbox" ], function() {
|
||||
jQuery.valHooks[ this ] = {
|
||||
set: function( elem, value ) {
|
||||
if ( Array.isArray( value ) ) {
|
||||
return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 );
|
||||
}
|
||||
}
|
||||
};
|
||||
if ( !support.checkOn ) {
|
||||
jQuery.valHooks[ this ].get = function( elem ) {
|
||||
return elem.getAttribute( "value" ) === null ? "on" : elem.value;
|
||||
};
|
||||
}
|
||||
} );
|
||||
|
||||
} );
|
||||
236
node_modules/jquery/src/callbacks.js
generated
vendored
Normal file
236
node_modules/jquery/src/callbacks.js
generated
vendored
Normal file
@@ -0,0 +1,236 @@
|
||||
define( [
|
||||
"./core",
|
||||
"./core/toType",
|
||||
"./var/isFunction",
|
||||
"./var/rnothtmlwhite"
|
||||
], function( jQuery, toType, isFunction, rnothtmlwhite ) {
|
||||
|
||||
"use strict";
|
||||
|
||||
// Convert String-formatted options into Object-formatted ones
|
||||
function createOptions( options ) {
|
||||
var object = {};
|
||||
jQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) {
|
||||
object[ flag ] = true;
|
||||
} );
|
||||
return object;
|
||||
}
|
||||
|
||||
/*
|
||||
* Create a callback list using the following parameters:
|
||||
*
|
||||
* options: an optional list of space-separated options that will change how
|
||||
* the callback list behaves or a more traditional option object
|
||||
*
|
||||
* By default a callback list will act like an event callback list and can be
|
||||
* "fired" multiple times.
|
||||
*
|
||||
* Possible options:
|
||||
*
|
||||
* once: will ensure the callback list can only be fired once (like a Deferred)
|
||||
*
|
||||
* memory: will keep track of previous values and will call any callback added
|
||||
* after the list has been fired right away with the latest "memorized"
|
||||
* values (like a Deferred)
|
||||
*
|
||||
* unique: will ensure a callback can only be added once (no duplicate in the list)
|
||||
*
|
||||
* stopOnFalse: interrupt callings when a callback returns false
|
||||
*
|
||||
*/
|
||||
jQuery.Callbacks = function( options ) {
|
||||
|
||||
// Convert options from String-formatted to Object-formatted if needed
|
||||
// (we check in cache first)
|
||||
options = typeof options === "string" ?
|
||||
createOptions( options ) :
|
||||
jQuery.extend( {}, options );
|
||||
|
||||
var // Flag to know if list is currently firing
|
||||
firing,
|
||||
|
||||
// Last fire value for non-forgettable lists
|
||||
memory,
|
||||
|
||||
// Flag to know if list was already fired
|
||||
fired,
|
||||
|
||||
// Flag to prevent firing
|
||||
locked,
|
||||
|
||||
// Actual callback list
|
||||
list = [],
|
||||
|
||||
// Queue of execution data for repeatable lists
|
||||
queue = [],
|
||||
|
||||
// Index of currently firing callback (modified by add/remove as needed)
|
||||
firingIndex = -1,
|
||||
|
||||
// Fire callbacks
|
||||
fire = function() {
|
||||
|
||||
// Enforce single-firing
|
||||
locked = locked || options.once;
|
||||
|
||||
// Execute callbacks for all pending executions,
|
||||
// respecting firingIndex overrides and runtime changes
|
||||
fired = firing = true;
|
||||
for ( ; queue.length; firingIndex = -1 ) {
|
||||
memory = queue.shift();
|
||||
while ( ++firingIndex < list.length ) {
|
||||
|
||||
// Run callback and check for early termination
|
||||
if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false &&
|
||||
options.stopOnFalse ) {
|
||||
|
||||
// Jump to end and forget the data so .add doesn't re-fire
|
||||
firingIndex = list.length;
|
||||
memory = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Forget the data if we're done with it
|
||||
if ( !options.memory ) {
|
||||
memory = false;
|
||||
}
|
||||
|
||||
firing = false;
|
||||
|
||||
// Clean up if we're done firing for good
|
||||
if ( locked ) {
|
||||
|
||||
// Keep an empty list if we have data for future add calls
|
||||
if ( memory ) {
|
||||
list = [];
|
||||
|
||||
// Otherwise, this object is spent
|
||||
} else {
|
||||
list = "";
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
// Actual Callbacks object
|
||||
self = {
|
||||
|
||||
// Add a callback or a collection of callbacks to the list
|
||||
add: function() {
|
||||
if ( list ) {
|
||||
|
||||
// If we have memory from a past run, we should fire after adding
|
||||
if ( memory && !firing ) {
|
||||
firingIndex = list.length - 1;
|
||||
queue.push( memory );
|
||||
}
|
||||
|
||||
( function add( args ) {
|
||||
jQuery.each( args, function( _, arg ) {
|
||||
if ( isFunction( arg ) ) {
|
||||
if ( !options.unique || !self.has( arg ) ) {
|
||||
list.push( arg );
|
||||
}
|
||||
} else if ( arg && arg.length && toType( arg ) !== "string" ) {
|
||||
|
||||
// Inspect recursively
|
||||
add( arg );
|
||||
}
|
||||
} );
|
||||
} )( arguments );
|
||||
|
||||
if ( memory && !firing ) {
|
||||
fire();
|
||||
}
|
||||
}
|
||||
return this;
|
||||
},
|
||||
|
||||
// Remove a callback from the list
|
||||
remove: function() {
|
||||
jQuery.each( arguments, function( _, arg ) {
|
||||
var index;
|
||||
while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
|
||||
list.splice( index, 1 );
|
||||
|
||||
// Handle firing indexes
|
||||
if ( index <= firingIndex ) {
|
||||
firingIndex--;
|
||||
}
|
||||
}
|
||||
} );
|
||||
return this;
|
||||
},
|
||||
|
||||
// Check if a given callback is in the list.
|
||||
// If no argument is given, return whether or not list has callbacks attached.
|
||||
has: function( fn ) {
|
||||
return fn ?
|
||||
jQuery.inArray( fn, list ) > -1 :
|
||||
list.length > 0;
|
||||
},
|
||||
|
||||
// Remove all callbacks from the list
|
||||
empty: function() {
|
||||
if ( list ) {
|
||||
list = [];
|
||||
}
|
||||
return this;
|
||||
},
|
||||
|
||||
// Disable .fire and .add
|
||||
// Abort any current/pending executions
|
||||
// Clear all callbacks and values
|
||||
disable: function() {
|
||||
locked = queue = [];
|
||||
list = memory = "";
|
||||
return this;
|
||||
},
|
||||
disabled: function() {
|
||||
return !list;
|
||||
},
|
||||
|
||||
// Disable .fire
|
||||
// Also disable .add unless we have memory (since it would have no effect)
|
||||
// Abort any pending executions
|
||||
lock: function() {
|
||||
locked = queue = [];
|
||||
if ( !memory && !firing ) {
|
||||
list = memory = "";
|
||||
}
|
||||
return this;
|
||||
},
|
||||
locked: function() {
|
||||
return !!locked;
|
||||
},
|
||||
|
||||
// Call all callbacks with the given context and arguments
|
||||
fireWith: function( context, args ) {
|
||||
if ( !locked ) {
|
||||
args = args || [];
|
||||
args = [ context, args.slice ? args.slice() : args ];
|
||||
queue.push( args );
|
||||
if ( !firing ) {
|
||||
fire();
|
||||
}
|
||||
}
|
||||
return this;
|
||||
},
|
||||
|
||||
// Call all the callbacks with the given arguments
|
||||
fire: function() {
|
||||
self.fireWith( this, arguments );
|
||||
return this;
|
||||
},
|
||||
|
||||
// To know if the callbacks have already been called at least once
|
||||
fired: function() {
|
||||
return !!fired;
|
||||
}
|
||||
};
|
||||
|
||||
return self;
|
||||
};
|
||||
|
||||
return jQuery;
|
||||
} );
|
||||
400
node_modules/jquery/src/core.js
generated
vendored
Normal file
400
node_modules/jquery/src/core.js
generated
vendored
Normal file
@@ -0,0 +1,400 @@
|
||||
/* global Symbol */
|
||||
// Defining this global in .eslintrc.json would create a danger of using the global
|
||||
// unguarded in another place, it seems safer to define global only for this module
|
||||
|
||||
define( [
|
||||
"./var/arr",
|
||||
"./var/getProto",
|
||||
"./var/slice",
|
||||
"./var/flat",
|
||||
"./var/push",
|
||||
"./var/indexOf",
|
||||
"./var/class2type",
|
||||
"./var/toString",
|
||||
"./var/hasOwn",
|
||||
"./var/fnToString",
|
||||
"./var/ObjectFunctionString",
|
||||
"./var/support",
|
||||
"./var/isFunction",
|
||||
"./var/isWindow",
|
||||
"./core/DOMEval",
|
||||
"./core/toType"
|
||||
], function( arr, getProto, slice, flat, push, indexOf,
|
||||
class2type, toString, hasOwn, fnToString, ObjectFunctionString,
|
||||
support, isFunction, isWindow, DOMEval, toType ) {
|
||||
|
||||
"use strict";
|
||||
|
||||
var
|
||||
version = "3.6.0",
|
||||
|
||||
// Define a local copy of jQuery
|
||||
jQuery = function( selector, context ) {
|
||||
|
||||
// The jQuery object is actually just the init constructor 'enhanced'
|
||||
// Need init if jQuery is called (just allow error to be thrown if not included)
|
||||
return new jQuery.fn.init( selector, context );
|
||||
};
|
||||
|
||||
jQuery.fn = jQuery.prototype = {
|
||||
|
||||
// The current version of jQuery being used
|
||||
jquery: version,
|
||||
|
||||
constructor: jQuery,
|
||||
|
||||
// The default length of a jQuery object is 0
|
||||
length: 0,
|
||||
|
||||
toArray: function() {
|
||||
return slice.call( this );
|
||||
},
|
||||
|
||||
// Get the Nth element in the matched element set OR
|
||||
// Get the whole matched element set as a clean array
|
||||
get: function( num ) {
|
||||
|
||||
// Return all the elements in a clean array
|
||||
if ( num == null ) {
|
||||
return slice.call( this );
|
||||
}
|
||||
|
||||
// Return just the one element from the set
|
||||
return num < 0 ? this[ num + this.length ] : this[ num ];
|
||||
},
|
||||
|
||||
// Take an array of elements and push it onto the stack
|
||||
// (returning the new matched element set)
|
||||
pushStack: function( elems ) {
|
||||
|
||||
// Build a new jQuery matched element set
|
||||
var ret = jQuery.merge( this.constructor(), elems );
|
||||
|
||||
// Add the old object onto the stack (as a reference)
|
||||
ret.prevObject = this;
|
||||
|
||||
// Return the newly-formed element set
|
||||
return ret;
|
||||
},
|
||||
|
||||
// Execute a callback for every element in the matched set.
|
||||
each: function( callback ) {
|
||||
return jQuery.each( this, callback );
|
||||
},
|
||||
|
||||
map: function( callback ) {
|
||||
return this.pushStack( jQuery.map( this, function( elem, i ) {
|
||||
return callback.call( elem, i, elem );
|
||||
} ) );
|
||||
},
|
||||
|
||||
slice: function() {
|
||||
return this.pushStack( slice.apply( this, arguments ) );
|
||||
},
|
||||
|
||||
first: function() {
|
||||
return this.eq( 0 );
|
||||
},
|
||||
|
||||
last: function() {
|
||||
return this.eq( -1 );
|
||||
},
|
||||
|
||||
even: function() {
|
||||
return this.pushStack( jQuery.grep( this, function( _elem, i ) {
|
||||
return ( i + 1 ) % 2;
|
||||
} ) );
|
||||
},
|
||||
|
||||
odd: function() {
|
||||
return this.pushStack( jQuery.grep( this, function( _elem, i ) {
|
||||
return i % 2;
|
||||
} ) );
|
||||
},
|
||||
|
||||
eq: function( i ) {
|
||||
var len = this.length,
|
||||
j = +i + ( i < 0 ? len : 0 );
|
||||
return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] );
|
||||
},
|
||||
|
||||
end: function() {
|
||||
return this.prevObject || this.constructor();
|
||||
},
|
||||
|
||||
// For internal use only.
|
||||
// Behaves like an Array's method, not like a jQuery method.
|
||||
push: push,
|
||||
sort: arr.sort,
|
||||
splice: arr.splice
|
||||
};
|
||||
|
||||
jQuery.extend = jQuery.fn.extend = function() {
|
||||
var options, name, src, copy, copyIsArray, clone,
|
||||
target = arguments[ 0 ] || {},
|
||||
i = 1,
|
||||
length = arguments.length,
|
||||
deep = false;
|
||||
|
||||
// Handle a deep copy situation
|
||||
if ( typeof target === "boolean" ) {
|
||||
deep = target;
|
||||
|
||||
// Skip the boolean and the target
|
||||
target = arguments[ i ] || {};
|
||||
i++;
|
||||
}
|
||||
|
||||
// Handle case when target is a string or something (possible in deep copy)
|
||||
if ( typeof target !== "object" && !isFunction( target ) ) {
|
||||
target = {};
|
||||
}
|
||||
|
||||
// Extend jQuery itself if only one argument is passed
|
||||
if ( i === length ) {
|
||||
target = this;
|
||||
i--;
|
||||
}
|
||||
|
||||
for ( ; i < length; i++ ) {
|
||||
|
||||
// Only deal with non-null/undefined values
|
||||
if ( ( options = arguments[ i ] ) != null ) {
|
||||
|
||||
// Extend the base object
|
||||
for ( name in options ) {
|
||||
copy = options[ name ];
|
||||
|
||||
// Prevent Object.prototype pollution
|
||||
// Prevent never-ending loop
|
||||
if ( name === "__proto__" || target === copy ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Recurse if we're merging plain objects or arrays
|
||||
if ( deep && copy && ( jQuery.isPlainObject( copy ) ||
|
||||
( copyIsArray = Array.isArray( copy ) ) ) ) {
|
||||
src = target[ name ];
|
||||
|
||||
// Ensure proper type for the source value
|
||||
if ( copyIsArray && !Array.isArray( src ) ) {
|
||||
clone = [];
|
||||
} else if ( !copyIsArray && !jQuery.isPlainObject( src ) ) {
|
||||
clone = {};
|
||||
} else {
|
||||
clone = src;
|
||||
}
|
||||
copyIsArray = false;
|
||||
|
||||
// Never move original objects, clone them
|
||||
target[ name ] = jQuery.extend( deep, clone, copy );
|
||||
|
||||
// Don't bring in undefined values
|
||||
} else if ( copy !== undefined ) {
|
||||
target[ name ] = copy;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Return the modified object
|
||||
return target;
|
||||
};
|
||||
|
||||
jQuery.extend( {
|
||||
|
||||
// Unique for each copy of jQuery on the page
|
||||
expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ),
|
||||
|
||||
// Assume jQuery is ready without the ready module
|
||||
isReady: true,
|
||||
|
||||
error: function( msg ) {
|
||||
throw new Error( msg );
|
||||
},
|
||||
|
||||
noop: function() {},
|
||||
|
||||
isPlainObject: function( obj ) {
|
||||
var proto, Ctor;
|
||||
|
||||
// Detect obvious negatives
|
||||
// Use toString instead of jQuery.type to catch host objects
|
||||
if ( !obj || toString.call( obj ) !== "[object Object]" ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
proto = getProto( obj );
|
||||
|
||||
// Objects with no prototype (e.g., `Object.create( null )`) are plain
|
||||
if ( !proto ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Objects with prototype are plain iff they were constructed by a global Object function
|
||||
Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor;
|
||||
return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString;
|
||||
},
|
||||
|
||||
isEmptyObject: function( obj ) {
|
||||
var name;
|
||||
|
||||
for ( name in obj ) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
},
|
||||
|
||||
// Evaluates a script in a provided context; falls back to the global one
|
||||
// if not specified.
|
||||
globalEval: function( code, options, doc ) {
|
||||
DOMEval( code, { nonce: options && options.nonce }, doc );
|
||||
},
|
||||
|
||||
each: function( obj, callback ) {
|
||||
var length, i = 0;
|
||||
|
||||
if ( isArrayLike( obj ) ) {
|
||||
length = obj.length;
|
||||
for ( ; i < length; i++ ) {
|
||||
if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for ( i in obj ) {
|
||||
if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return obj;
|
||||
},
|
||||
|
||||
// results is for internal usage only
|
||||
makeArray: function( arr, results ) {
|
||||
var ret = results || [];
|
||||
|
||||
if ( arr != null ) {
|
||||
if ( isArrayLike( Object( arr ) ) ) {
|
||||
jQuery.merge( ret,
|
||||
typeof arr === "string" ?
|
||||
[ arr ] : arr
|
||||
);
|
||||
} else {
|
||||
push.call( ret, arr );
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
},
|
||||
|
||||
inArray: function( elem, arr, i ) {
|
||||
return arr == null ? -1 : indexOf.call( arr, elem, i );
|
||||
},
|
||||
|
||||
// Support: Android <=4.0 only, PhantomJS 1 only
|
||||
// push.apply(_, arraylike) throws on ancient WebKit
|
||||
merge: function( first, second ) {
|
||||
var len = +second.length,
|
||||
j = 0,
|
||||
i = first.length;
|
||||
|
||||
for ( ; j < len; j++ ) {
|
||||
first[ i++ ] = second[ j ];
|
||||
}
|
||||
|
||||
first.length = i;
|
||||
|
||||
return first;
|
||||
},
|
||||
|
||||
grep: function( elems, callback, invert ) {
|
||||
var callbackInverse,
|
||||
matches = [],
|
||||
i = 0,
|
||||
length = elems.length,
|
||||
callbackExpect = !invert;
|
||||
|
||||
// Go through the array, only saving the items
|
||||
// that pass the validator function
|
||||
for ( ; i < length; i++ ) {
|
||||
callbackInverse = !callback( elems[ i ], i );
|
||||
if ( callbackInverse !== callbackExpect ) {
|
||||
matches.push( elems[ i ] );
|
||||
}
|
||||
}
|
||||
|
||||
return matches;
|
||||
},
|
||||
|
||||
// arg is for internal usage only
|
||||
map: function( elems, callback, arg ) {
|
||||
var length, value,
|
||||
i = 0,
|
||||
ret = [];
|
||||
|
||||
// Go through the array, translating each of the items to their new values
|
||||
if ( isArrayLike( elems ) ) {
|
||||
length = elems.length;
|
||||
for ( ; i < length; i++ ) {
|
||||
value = callback( elems[ i ], i, arg );
|
||||
|
||||
if ( value != null ) {
|
||||
ret.push( value );
|
||||
}
|
||||
}
|
||||
|
||||
// Go through every key on the object,
|
||||
} else {
|
||||
for ( i in elems ) {
|
||||
value = callback( elems[ i ], i, arg );
|
||||
|
||||
if ( value != null ) {
|
||||
ret.push( value );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Flatten any nested arrays
|
||||
return flat( ret );
|
||||
},
|
||||
|
||||
// A global GUID counter for objects
|
||||
guid: 1,
|
||||
|
||||
// jQuery.support is not used in Core but other projects attach their
|
||||
// properties to it so it needs to exist.
|
||||
support: support
|
||||
} );
|
||||
|
||||
if ( typeof Symbol === "function" ) {
|
||||
jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ];
|
||||
}
|
||||
|
||||
// Populate the class2type map
|
||||
jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ),
|
||||
function( _i, name ) {
|
||||
class2type[ "[object " + name + "]" ] = name.toLowerCase();
|
||||
} );
|
||||
|
||||
function isArrayLike( obj ) {
|
||||
|
||||
// Support: real iOS 8.2 only (not reproducible in simulator)
|
||||
// `in` check used to prevent JIT error (gh-2145)
|
||||
// hasOwn isn't used here due to false negatives
|
||||
// regarding Nodelist length in IE
|
||||
var length = !!obj && "length" in obj && obj.length,
|
||||
type = toType( obj );
|
||||
|
||||
if ( isFunction( obj ) || isWindow( obj ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return type === "array" || length === 0 ||
|
||||
typeof length === "number" && length > 0 && ( length - 1 ) in obj;
|
||||
}
|
||||
|
||||
return jQuery;
|
||||
} );
|
||||
43
node_modules/jquery/src/core/DOMEval.js
generated
vendored
Normal file
43
node_modules/jquery/src/core/DOMEval.js
generated
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
define( [
|
||||
"../var/document"
|
||||
], function( document ) {
|
||||
"use strict";
|
||||
|
||||
var preservedScriptAttributes = {
|
||||
type: true,
|
||||
src: true,
|
||||
nonce: true,
|
||||
noModule: true
|
||||
};
|
||||
|
||||
function DOMEval( code, node, doc ) {
|
||||
doc = doc || document;
|
||||
|
||||
var i, val,
|
||||
script = doc.createElement( "script" );
|
||||
|
||||
script.text = code;
|
||||
if ( node ) {
|
||||
for ( i in preservedScriptAttributes ) {
|
||||
|
||||
// Support: Firefox 64+, Edge 18+
|
||||
// Some browsers don't support the "nonce" property on scripts.
|
||||
// On the other hand, just using `getAttribute` is not enough as
|
||||
// the `nonce` attribute is reset to an empty string whenever it
|
||||
// becomes browsing-context connected.
|
||||
// See https://github.com/whatwg/html/issues/2369
|
||||
// See https://html.spec.whatwg.org/#nonce-attributes
|
||||
// The `node.getAttribute` check was added for the sake of
|
||||
// `jQuery.globalEval` so that it can fake a nonce-containing node
|
||||
// via an object.
|
||||
val = node[ i ] || node.getAttribute && node.getAttribute( i );
|
||||
if ( val ) {
|
||||
script.setAttribute( i, val );
|
||||
}
|
||||
}
|
||||
}
|
||||
doc.head.appendChild( script ).parentNode.removeChild( script );
|
||||
}
|
||||
|
||||
return DOMEval;
|
||||
} );
|
||||
72
node_modules/jquery/src/core/access.js
generated
vendored
Normal file
72
node_modules/jquery/src/core/access.js
generated
vendored
Normal file
@@ -0,0 +1,72 @@
|
||||
define( [
|
||||
"../core",
|
||||
"../core/toType",
|
||||
"../var/isFunction"
|
||||
], function( jQuery, toType, isFunction ) {
|
||||
|
||||
"use strict";
|
||||
|
||||
// Multifunctional method to get and set values of a collection
|
||||
// The value/s can optionally be executed if it's a function
|
||||
var access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
|
||||
var i = 0,
|
||||
len = elems.length,
|
||||
bulk = key == null;
|
||||
|
||||
// Sets many values
|
||||
if ( toType( key ) === "object" ) {
|
||||
chainable = true;
|
||||
for ( i in key ) {
|
||||
access( elems, fn, i, key[ i ], true, emptyGet, raw );
|
||||
}
|
||||
|
||||
// Sets one value
|
||||
} else if ( value !== undefined ) {
|
||||
chainable = true;
|
||||
|
||||
if ( !isFunction( value ) ) {
|
||||
raw = true;
|
||||
}
|
||||
|
||||
if ( bulk ) {
|
||||
|
||||
// Bulk operations run against the entire set
|
||||
if ( raw ) {
|
||||
fn.call( elems, value );
|
||||
fn = null;
|
||||
|
||||
// ...except when executing function values
|
||||
} else {
|
||||
bulk = fn;
|
||||
fn = function( elem, _key, value ) {
|
||||
return bulk.call( jQuery( elem ), value );
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
if ( fn ) {
|
||||
for ( ; i < len; i++ ) {
|
||||
fn(
|
||||
elems[ i ], key, raw ?
|
||||
value :
|
||||
value.call( elems[ i ], i, fn( elems[ i ], key ) )
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( chainable ) {
|
||||
return elems;
|
||||
}
|
||||
|
||||
// Gets
|
||||
if ( bulk ) {
|
||||
return fn.call( elems );
|
||||
}
|
||||
|
||||
return len ? fn( elems[ 0 ], key ) : emptyGet;
|
||||
};
|
||||
|
||||
return access;
|
||||
|
||||
} );
|
||||
23
node_modules/jquery/src/core/camelCase.js
generated
vendored
Normal file
23
node_modules/jquery/src/core/camelCase.js
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
define( [], function() {
|
||||
|
||||
"use strict";
|
||||
|
||||
// Matches dashed string for camelizing
|
||||
var rmsPrefix = /^-ms-/,
|
||||
rdashAlpha = /-([a-z])/g;
|
||||
|
||||
// Used by camelCase as callback to replace()
|
||||
function fcamelCase( _all, letter ) {
|
||||
return letter.toUpperCase();
|
||||
}
|
||||
|
||||
// Convert dashed to camelCase; used by the css and data modules
|
||||
// Support: IE <=9 - 11, Edge 12 - 15
|
||||
// Microsoft forgot to hump their vendor prefix (#9572)
|
||||
function camelCase( string ) {
|
||||
return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
|
||||
}
|
||||
|
||||
return camelCase;
|
||||
|
||||
} );
|
||||
129
node_modules/jquery/src/core/init.js
generated
vendored
Normal file
129
node_modules/jquery/src/core/init.js
generated
vendored
Normal file
@@ -0,0 +1,129 @@
|
||||
// Initialize a jQuery object
|
||||
define( [
|
||||
"../core",
|
||||
"../var/document",
|
||||
"../var/isFunction",
|
||||
"./var/rsingleTag",
|
||||
|
||||
"../traversing/findFilter"
|
||||
], function( jQuery, document, isFunction, rsingleTag ) {
|
||||
|
||||
"use strict";
|
||||
|
||||
// A central reference to the root jQuery(document)
|
||||
var rootjQuery,
|
||||
|
||||
// A simple way to check for HTML strings
|
||||
// Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
|
||||
// Strict HTML recognition (#11290: must start with <)
|
||||
// Shortcut simple #id case for speed
|
||||
rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,
|
||||
|
||||
init = jQuery.fn.init = function( selector, context, root ) {
|
||||
var match, elem;
|
||||
|
||||
// HANDLE: $(""), $(null), $(undefined), $(false)
|
||||
if ( !selector ) {
|
||||
return this;
|
||||
}
|
||||
|
||||
// Method init() accepts an alternate rootjQuery
|
||||
// so migrate can support jQuery.sub (gh-2101)
|
||||
root = root || rootjQuery;
|
||||
|
||||
// Handle HTML strings
|
||||
if ( typeof selector === "string" ) {
|
||||
if ( selector[ 0 ] === "<" &&
|
||||
selector[ selector.length - 1 ] === ">" &&
|
||||
selector.length >= 3 ) {
|
||||
|
||||
// Assume that strings that start and end with <> are HTML and skip the regex check
|
||||
match = [ null, selector, null ];
|
||||
|
||||
} else {
|
||||
match = rquickExpr.exec( selector );
|
||||
}
|
||||
|
||||
// Match html or make sure no context is specified for #id
|
||||
if ( match && ( match[ 1 ] || !context ) ) {
|
||||
|
||||
// HANDLE: $(html) -> $(array)
|
||||
if ( match[ 1 ] ) {
|
||||
context = context instanceof jQuery ? context[ 0 ] : context;
|
||||
|
||||
// Option to run scripts is true for back-compat
|
||||
// Intentionally let the error be thrown if parseHTML is not present
|
||||
jQuery.merge( this, jQuery.parseHTML(
|
||||
match[ 1 ],
|
||||
context && context.nodeType ? context.ownerDocument || context : document,
|
||||
true
|
||||
) );
|
||||
|
||||
// HANDLE: $(html, props)
|
||||
if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) {
|
||||
for ( match in context ) {
|
||||
|
||||
// Properties of context are called as methods if possible
|
||||
if ( isFunction( this[ match ] ) ) {
|
||||
this[ match ]( context[ match ] );
|
||||
|
||||
// ...and otherwise set as attributes
|
||||
} else {
|
||||
this.attr( match, context[ match ] );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return this;
|
||||
|
||||
// HANDLE: $(#id)
|
||||
} else {
|
||||
elem = document.getElementById( match[ 2 ] );
|
||||
|
||||
if ( elem ) {
|
||||
|
||||
// Inject the element directly into the jQuery object
|
||||
this[ 0 ] = elem;
|
||||
this.length = 1;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
// HANDLE: $(expr, $(...))
|
||||
} else if ( !context || context.jquery ) {
|
||||
return ( context || root ).find( selector );
|
||||
|
||||
// HANDLE: $(expr, context)
|
||||
// (which is just equivalent to: $(context).find(expr)
|
||||
} else {
|
||||
return this.constructor( context ).find( selector );
|
||||
}
|
||||
|
||||
// HANDLE: $(DOMElement)
|
||||
} else if ( selector.nodeType ) {
|
||||
this[ 0 ] = selector;
|
||||
this.length = 1;
|
||||
return this;
|
||||
|
||||
// HANDLE: $(function)
|
||||
// Shortcut for document ready
|
||||
} else if ( isFunction( selector ) ) {
|
||||
return root.ready !== undefined ?
|
||||
root.ready( selector ) :
|
||||
|
||||
// Execute immediately if ready is not present
|
||||
selector( jQuery );
|
||||
}
|
||||
|
||||
return jQuery.makeArray( selector, this );
|
||||
};
|
||||
|
||||
// Give the init function the jQuery prototype for later instantiation
|
||||
init.prototype = jQuery.fn;
|
||||
|
||||
// Initialize central reference
|
||||
rootjQuery = jQuery( document );
|
||||
|
||||
return init;
|
||||
|
||||
} );
|
||||
26
node_modules/jquery/src/core/isAttached.js
generated
vendored
Normal file
26
node_modules/jquery/src/core/isAttached.js
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
define( [
|
||||
"../core",
|
||||
"../var/documentElement",
|
||||
"../selector" // jQuery.contains
|
||||
], function( jQuery, documentElement ) {
|
||||
"use strict";
|
||||
|
||||
var isAttached = function( elem ) {
|
||||
return jQuery.contains( elem.ownerDocument, elem );
|
||||
},
|
||||
composed = { composed: true };
|
||||
|
||||
// Support: IE 9 - 11+, Edge 12 - 18+, iOS 10.0 - 10.2 only
|
||||
// Check attachment across shadow DOM boundaries when possible (gh-3504)
|
||||
// Support: iOS 10.0-10.2 only
|
||||
// Early iOS 10 versions support `attachShadow` but not `getRootNode`,
|
||||
// leading to errors. We need to check for `getRootNode`.
|
||||
if ( documentElement.getRootNode ) {
|
||||
isAttached = function( elem ) {
|
||||
return jQuery.contains( elem.ownerDocument, elem ) ||
|
||||
elem.getRootNode( composed ) === elem.ownerDocument;
|
||||
};
|
||||
}
|
||||
|
||||
return isAttached;
|
||||
} );
|
||||
13
node_modules/jquery/src/core/nodeName.js
generated
vendored
Normal file
13
node_modules/jquery/src/core/nodeName.js
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
define( function() {
|
||||
|
||||
"use strict";
|
||||
|
||||
function nodeName( elem, name ) {
|
||||
|
||||
return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
|
||||
|
||||
}
|
||||
|
||||
return nodeName;
|
||||
|
||||
} );
|
||||
65
node_modules/jquery/src/core/parseHTML.js
generated
vendored
Normal file
65
node_modules/jquery/src/core/parseHTML.js
generated
vendored
Normal file
@@ -0,0 +1,65 @@
|
||||
define( [
|
||||
"../core",
|
||||
"../var/document",
|
||||
"./var/rsingleTag",
|
||||
"../manipulation/buildFragment",
|
||||
|
||||
// This is the only module that needs core/support
|
||||
"./support"
|
||||
], function( jQuery, document, rsingleTag, buildFragment, support ) {
|
||||
|
||||
"use strict";
|
||||
|
||||
// Argument "data" should be string of html
|
||||
// context (optional): If specified, the fragment will be created in this context,
|
||||
// defaults to document
|
||||
// keepScripts (optional): If true, will include scripts passed in the html string
|
||||
jQuery.parseHTML = function( data, context, keepScripts ) {
|
||||
if ( typeof data !== "string" ) {
|
||||
return [];
|
||||
}
|
||||
if ( typeof context === "boolean" ) {
|
||||
keepScripts = context;
|
||||
context = false;
|
||||
}
|
||||
|
||||
var base, parsed, scripts;
|
||||
|
||||
if ( !context ) {
|
||||
|
||||
// Stop scripts or inline event handlers from being executed immediately
|
||||
// by using document.implementation
|
||||
if ( support.createHTMLDocument ) {
|
||||
context = document.implementation.createHTMLDocument( "" );
|
||||
|
||||
// Set the base href for the created document
|
||||
// so any parsed elements with URLs
|
||||
// are based on the document's URL (gh-2965)
|
||||
base = context.createElement( "base" );
|
||||
base.href = document.location.href;
|
||||
context.head.appendChild( base );
|
||||
} else {
|
||||
context = document;
|
||||
}
|
||||
}
|
||||
|
||||
parsed = rsingleTag.exec( data );
|
||||
scripts = !keepScripts && [];
|
||||
|
||||
// Single tag
|
||||
if ( parsed ) {
|
||||
return [ context.createElement( parsed[ 1 ] ) ];
|
||||
}
|
||||
|
||||
parsed = buildFragment( [ data ], context, scripts );
|
||||
|
||||
if ( scripts && scripts.length ) {
|
||||
jQuery( scripts ).remove();
|
||||
}
|
||||
|
||||
return jQuery.merge( [], parsed.childNodes );
|
||||
};
|
||||
|
||||
return jQuery.parseHTML;
|
||||
|
||||
} );
|
||||
35
node_modules/jquery/src/core/parseXML.js
generated
vendored
Normal file
35
node_modules/jquery/src/core/parseXML.js
generated
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
define( [
|
||||
"../core"
|
||||
], function( jQuery ) {
|
||||
|
||||
"use strict";
|
||||
|
||||
// Cross-browser xml parsing
|
||||
jQuery.parseXML = function( data ) {
|
||||
var xml, parserErrorElem;
|
||||
if ( !data || typeof data !== "string" ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Support: IE 9 - 11 only
|
||||
// IE throws on parseFromString with invalid input.
|
||||
try {
|
||||
xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" );
|
||||
} catch ( e ) {}
|
||||
|
||||
parserErrorElem = xml && xml.getElementsByTagName( "parsererror" )[ 0 ];
|
||||
if ( !xml || parserErrorElem ) {
|
||||
jQuery.error( "Invalid XML: " + (
|
||||
parserErrorElem ?
|
||||
jQuery.map( parserErrorElem.childNodes, function( el ) {
|
||||
return el.textContent;
|
||||
} ).join( "\n" ) :
|
||||
data
|
||||
) );
|
||||
}
|
||||
return xml;
|
||||
};
|
||||
|
||||
return jQuery.parseXML;
|
||||
|
||||
} );
|
||||
97
node_modules/jquery/src/core/ready-no-deferred.js
generated
vendored
Normal file
97
node_modules/jquery/src/core/ready-no-deferred.js
generated
vendored
Normal file
@@ -0,0 +1,97 @@
|
||||
define( [
|
||||
"../core",
|
||||
"../var/document",
|
||||
"../var/isFunction"
|
||||
], function( jQuery, document, isFunction ) {
|
||||
|
||||
"use strict";
|
||||
|
||||
var readyCallbacks = [],
|
||||
whenReady = function( fn ) {
|
||||
readyCallbacks.push( fn );
|
||||
},
|
||||
executeReady = function( fn ) {
|
||||
|
||||
// Prevent errors from freezing future callback execution (gh-1823)
|
||||
// Not backwards-compatible as this does not execute sync
|
||||
window.setTimeout( function() {
|
||||
fn.call( document, jQuery );
|
||||
} );
|
||||
};
|
||||
|
||||
jQuery.fn.ready = function( fn ) {
|
||||
whenReady( fn );
|
||||
return this;
|
||||
};
|
||||
|
||||
jQuery.extend( {
|
||||
|
||||
// Is the DOM ready to be used? Set to true once it occurs.
|
||||
isReady: false,
|
||||
|
||||
// A counter to track how many items to wait for before
|
||||
// the ready event fires. See #6781
|
||||
readyWait: 1,
|
||||
|
||||
ready: function( wait ) {
|
||||
|
||||
// Abort if there are pending holds or we're already ready
|
||||
if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Remember that the DOM is ready
|
||||
jQuery.isReady = true;
|
||||
|
||||
// If a normal DOM Ready event fired, decrement, and wait if need be
|
||||
if ( wait !== true && --jQuery.readyWait > 0 ) {
|
||||
return;
|
||||
}
|
||||
|
||||
whenReady = function( fn ) {
|
||||
readyCallbacks.push( fn );
|
||||
|
||||
while ( readyCallbacks.length ) {
|
||||
fn = readyCallbacks.shift();
|
||||
if ( isFunction( fn ) ) {
|
||||
executeReady( fn );
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
whenReady();
|
||||
}
|
||||
} );
|
||||
|
||||
// Make jQuery.ready Promise consumable (gh-1778)
|
||||
jQuery.ready.then = jQuery.fn.ready;
|
||||
|
||||
/**
|
||||
* The ready event handler and self cleanup method
|
||||
*/
|
||||
function completed() {
|
||||
document.removeEventListener( "DOMContentLoaded", completed );
|
||||
window.removeEventListener( "load", completed );
|
||||
jQuery.ready();
|
||||
}
|
||||
|
||||
// Catch cases where $(document).ready() is called
|
||||
// after the browser event has already occurred.
|
||||
// Support: IE9-10 only
|
||||
// Older IE sometimes signals "interactive" too soon
|
||||
if ( document.readyState === "complete" ||
|
||||
( document.readyState !== "loading" && !document.documentElement.doScroll ) ) {
|
||||
|
||||
// Handle it asynchronously to allow scripts the opportunity to delay ready
|
||||
window.setTimeout( jQuery.ready );
|
||||
|
||||
} else {
|
||||
|
||||
// Use the handy event callback
|
||||
document.addEventListener( "DOMContentLoaded", completed );
|
||||
|
||||
// A fallback to window.onload, that will always work
|
||||
window.addEventListener( "load", completed );
|
||||
}
|
||||
|
||||
} );
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user