mirror of
https://github.com/jquery/sizzle.git
synced 2025-12-28 04:43:44 +00:00
parent
547394c844
commit
a9fc69660b
@ -132,7 +132,9 @@ module.exports = function( grunt ) {
|
||||
"qunit/qunit.css": "qunitjs/qunit/qunit.css",
|
||||
"qunit/LICENSE.txt": "qunitjs/LICENSE.txt",
|
||||
|
||||
"requirejs/require.js": "requirejs/require.js"
|
||||
"requirejs/require.js": "requirejs/require.js",
|
||||
"requirejs-domready/domReady.js": "requirejs-domready/domReady.js",
|
||||
"requirejs-text/text.js": "requirejs-text/text.js",
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
2840
external/benchmark/benchmark.js
vendored
2840
external/benchmark/benchmark.js
vendored
File diff suppressed because it is too large
Load Diff
12
external/qunit/qunit.css
vendored
12
external/qunit/qunit.css
vendored
@ -1,12 +1,12 @@
|
||||
/*!
|
||||
* QUnit 1.20.0
|
||||
* http://qunitjs.com/
|
||||
* QUnit 1.23.1
|
||||
* https://qunitjs.com/
|
||||
*
|
||||
* Copyright jQuery Foundation and other contributors
|
||||
* Released under the MIT license
|
||||
* http://jquery.org/license
|
||||
* https://jquery.org/license
|
||||
*
|
||||
* Date: 2015-10-27T17:53Z
|
||||
* Date: 2016-04-12T17:29Z
|
||||
*/
|
||||
|
||||
/** Font Family and Sizes */
|
||||
@ -120,6 +120,10 @@
|
||||
display: list-item;
|
||||
}
|
||||
|
||||
#qunit-tests.hidepass {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
#qunit-tests.hidepass li.running,
|
||||
#qunit-tests.hidepass li.pass {
|
||||
visibility: hidden;
|
||||
|
||||
2460
external/qunit/qunit.js
vendored
2460
external/qunit/qunit.js
vendored
File diff suppressed because it is too large
Load Diff
119
external/requirejs-domready/domReady.js
vendored
Normal file
119
external/requirejs-domready/domReady.js
vendored
Normal file
@ -0,0 +1,119 @@
|
||||
|
||||
define(function () {
|
||||
'use strict';
|
||||
|
||||
var isTop, testDiv, scrollIntervalId,
|
||||
isBrowser = typeof window !== "undefined" && window.document,
|
||||
isPageLoaded = !isBrowser,
|
||||
doc = isBrowser ? document : null,
|
||||
readyCalls = [];
|
||||
|
||||
function runCallbacks(callbacks) {
|
||||
var i;
|
||||
for (i = 0; i < callbacks.length; i += 1) {
|
||||
callbacks[i](doc);
|
||||
}
|
||||
}
|
||||
|
||||
function callReady() {
|
||||
var callbacks = readyCalls;
|
||||
|
||||
if (isPageLoaded) {
|
||||
//Call the DOM ready callbacks
|
||||
if (callbacks.length) {
|
||||
readyCalls = [];
|
||||
runCallbacks(callbacks);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the page as loaded.
|
||||
*/
|
||||
function pageLoaded() {
|
||||
if (!isPageLoaded) {
|
||||
isPageLoaded = true;
|
||||
if (scrollIntervalId) {
|
||||
clearInterval(scrollIntervalId);
|
||||
}
|
||||
|
||||
callReady();
|
||||
}
|
||||
}
|
||||
|
||||
if (isBrowser) {
|
||||
if (document.addEventListener) {
|
||||
//Standards. Hooray! Assumption here that if standards based,
|
||||
//it knows about DOMContentLoaded.
|
||||
document.addEventListener("DOMContentLoaded", pageLoaded, false);
|
||||
window.addEventListener("load", pageLoaded, false);
|
||||
} else if (window.attachEvent) {
|
||||
window.attachEvent("onload", pageLoaded);
|
||||
|
||||
testDiv = document.createElement('div');
|
||||
try {
|
||||
isTop = window.frameElement === null;
|
||||
} catch (e) {}
|
||||
|
||||
//DOMContentLoaded approximation that uses a doScroll, as found by
|
||||
//Diego Perini: http://javascript.nwbox.com/IEContentLoaded/,
|
||||
//but modified by other contributors, including jdalton
|
||||
if (testDiv.doScroll && isTop && window.external) {
|
||||
scrollIntervalId = setInterval(function () {
|
||||
try {
|
||||
testDiv.doScroll();
|
||||
pageLoaded();
|
||||
} catch (e) {}
|
||||
}, 30);
|
||||
}
|
||||
}
|
||||
|
||||
//Check if document already complete, and if so, just trigger page load
|
||||
//listeners. Latest webkit browsers also use "interactive", and
|
||||
//will fire the onDOMContentLoaded before "interactive" but not after
|
||||
//entering "interactive" or "complete". More details:
|
||||
//http://dev.w3.org/html5/spec/the-end.html#the-end
|
||||
//http://stackoverflow.com/questions/3665561/document-readystate-of-interactive-vs-ondomcontentloaded
|
||||
//Hmm, this is more complicated on further use, see "firing too early"
|
||||
//bug: https://github.com/requirejs/domReady/issues/1
|
||||
//so removing the || document.readyState === "interactive" test.
|
||||
//There is still a window.onload binding that should get fired if
|
||||
//DOMContentLoaded is missed.
|
||||
if (document.readyState === "complete") {
|
||||
pageLoaded();
|
||||
}
|
||||
}
|
||||
|
||||
/** START OF PUBLIC API **/
|
||||
|
||||
/**
|
||||
* Registers a callback for DOM ready. If DOM is already ready, the
|
||||
* callback is called immediately.
|
||||
* @param {Function} callback
|
||||
*/
|
||||
function domReady(callback) {
|
||||
if (isPageLoaded) {
|
||||
callback(doc);
|
||||
} else {
|
||||
readyCalls.push(callback);
|
||||
}
|
||||
return domReady;
|
||||
}
|
||||
|
||||
domReady.version = '2.0.1';
|
||||
|
||||
/**
|
||||
* Loader Plugin API method
|
||||
*/
|
||||
domReady.load = function (name, req, onLoad, config) {
|
||||
if (config.isBuild) {
|
||||
onLoad(null);
|
||||
} else {
|
||||
domReady(onLoad);
|
||||
}
|
||||
};
|
||||
|
||||
/** END OF PUBLIC API **/
|
||||
|
||||
return domReady;
|
||||
});
|
||||
408
external/requirejs-text/text.js
vendored
Normal file
408
external/requirejs-text/text.js
vendored
Normal file
@ -0,0 +1,408 @@
|
||||
/**
|
||||
* @license text 2.0.15 Copyright jQuery Foundation and other contributors.
|
||||
* Released under MIT license, http://github.com/requirejs/text/LICENSE
|
||||
*/
|
||||
/*jslint regexp: true */
|
||||
/*global require, XMLHttpRequest, ActiveXObject,
|
||||
define, window, process, Packages,
|
||||
java, location, Components, FileUtils */
|
||||
|
||||
define(['module'], function (module) {
|
||||
'use strict';
|
||||
|
||||
var text, fs, Cc, Ci, xpcIsWindows,
|
||||
progIds = ['Msxml2.XMLHTTP', 'Microsoft.XMLHTTP', 'Msxml2.XMLHTTP.4.0'],
|
||||
xmlRegExp = /^\s*<\?xml(\s)+version=[\'\"](\d)*.(\d)*[\'\"](\s)*\?>/im,
|
||||
bodyRegExp = /<body[^>]*>\s*([\s\S]+)\s*<\/body>/im,
|
||||
hasLocation = typeof location !== 'undefined' && location.href,
|
||||
defaultProtocol = hasLocation && location.protocol && location.protocol.replace(/\:/, ''),
|
||||
defaultHostName = hasLocation && location.hostname,
|
||||
defaultPort = hasLocation && (location.port || undefined),
|
||||
buildMap = {},
|
||||
masterConfig = (module.config && module.config()) || {};
|
||||
|
||||
function useDefault(value, defaultValue) {
|
||||
return value === undefined || value === '' ? defaultValue : value;
|
||||
}
|
||||
|
||||
//Allow for default ports for http and https.
|
||||
function isSamePort(protocol1, port1, protocol2, port2) {
|
||||
if (port1 === port2) {
|
||||
return true;
|
||||
} else if (protocol1 === protocol2) {
|
||||
if (protocol1 === 'http') {
|
||||
return useDefault(port1, '80') === useDefault(port2, '80');
|
||||
} else if (protocol1 === 'https') {
|
||||
return useDefault(port1, '443') === useDefault(port2, '443');
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
text = {
|
||||
version: '2.0.15',
|
||||
|
||||
strip: function (content) {
|
||||
//Strips <?xml ...?> declarations so that external SVG and XML
|
||||
//documents can be added to a document without worry. Also, if the string
|
||||
//is an HTML document, only the part inside the body tag is returned.
|
||||
if (content) {
|
||||
content = content.replace(xmlRegExp, "");
|
||||
var matches = content.match(bodyRegExp);
|
||||
if (matches) {
|
||||
content = matches[1];
|
||||
}
|
||||
} else {
|
||||
content = "";
|
||||
}
|
||||
return content;
|
||||
},
|
||||
|
||||
jsEscape: function (content) {
|
||||
return content.replace(/(['\\])/g, '\\$1')
|
||||
.replace(/[\f]/g, "\\f")
|
||||
.replace(/[\b]/g, "\\b")
|
||||
.replace(/[\n]/g, "\\n")
|
||||
.replace(/[\t]/g, "\\t")
|
||||
.replace(/[\r]/g, "\\r")
|
||||
.replace(/[\u2028]/g, "\\u2028")
|
||||
.replace(/[\u2029]/g, "\\u2029");
|
||||
},
|
||||
|
||||
createXhr: masterConfig.createXhr || function () {
|
||||
//Would love to dump the ActiveX crap in here. Need IE 6 to die first.
|
||||
var xhr, i, progId;
|
||||
if (typeof XMLHttpRequest !== "undefined") {
|
||||
return new XMLHttpRequest();
|
||||
} else if (typeof ActiveXObject !== "undefined") {
|
||||
for (i = 0; i < 3; i += 1) {
|
||||
progId = progIds[i];
|
||||
try {
|
||||
xhr = new ActiveXObject(progId);
|
||||
} catch (e) {}
|
||||
|
||||
if (xhr) {
|
||||
progIds = [progId]; // so faster next time
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return xhr;
|
||||
},
|
||||
|
||||
/**
|
||||
* Parses a resource name into its component parts. Resource names
|
||||
* look like: module/name.ext!strip, where the !strip part is
|
||||
* optional.
|
||||
* @param {String} name the resource name
|
||||
* @returns {Object} with properties "moduleName", "ext" and "strip"
|
||||
* where strip is a boolean.
|
||||
*/
|
||||
parseName: function (name) {
|
||||
var modName, ext, temp,
|
||||
strip = false,
|
||||
index = name.lastIndexOf("."),
|
||||
isRelative = name.indexOf('./') === 0 ||
|
||||
name.indexOf('../') === 0;
|
||||
|
||||
if (index !== -1 && (!isRelative || index > 1)) {
|
||||
modName = name.substring(0, index);
|
||||
ext = name.substring(index + 1);
|
||||
} else {
|
||||
modName = name;
|
||||
}
|
||||
|
||||
temp = ext || modName;
|
||||
index = temp.indexOf("!");
|
||||
if (index !== -1) {
|
||||
//Pull off the strip arg.
|
||||
strip = temp.substring(index + 1) === "strip";
|
||||
temp = temp.substring(0, index);
|
||||
if (ext) {
|
||||
ext = temp;
|
||||
} else {
|
||||
modName = temp;
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
moduleName: modName,
|
||||
ext: ext,
|
||||
strip: strip
|
||||
};
|
||||
},
|
||||
|
||||
xdRegExp: /^((\w+)\:)?\/\/([^\/\\]+)/,
|
||||
|
||||
/**
|
||||
* Is an URL on another domain. Only works for browser use, returns
|
||||
* false in non-browser environments. Only used to know if an
|
||||
* optimized .js version of a text resource should be loaded
|
||||
* instead.
|
||||
* @param {String} url
|
||||
* @returns Boolean
|
||||
*/
|
||||
useXhr: function (url, protocol, hostname, port) {
|
||||
var uProtocol, uHostName, uPort,
|
||||
match = text.xdRegExp.exec(url);
|
||||
if (!match) {
|
||||
return true;
|
||||
}
|
||||
uProtocol = match[2];
|
||||
uHostName = match[3];
|
||||
|
||||
uHostName = uHostName.split(':');
|
||||
uPort = uHostName[1];
|
||||
uHostName = uHostName[0];
|
||||
|
||||
return (!uProtocol || uProtocol === protocol) &&
|
||||
(!uHostName || uHostName.toLowerCase() === hostname.toLowerCase()) &&
|
||||
((!uPort && !uHostName) || isSamePort(uProtocol, uPort, protocol, port));
|
||||
},
|
||||
|
||||
finishLoad: function (name, strip, content, onLoad) {
|
||||
content = strip ? text.strip(content) : content;
|
||||
if (masterConfig.isBuild) {
|
||||
buildMap[name] = content;
|
||||
}
|
||||
onLoad(content);
|
||||
},
|
||||
|
||||
load: function (name, req, onLoad, config) {
|
||||
//Name has format: some.module.filext!strip
|
||||
//The strip part is optional.
|
||||
//if strip is present, then that means only get the string contents
|
||||
//inside a body tag in an HTML string. For XML/SVG content it means
|
||||
//removing the <?xml ...?> declarations so the content can be inserted
|
||||
//into the current doc without problems.
|
||||
|
||||
// Do not bother with the work if a build and text will
|
||||
// not be inlined.
|
||||
if (config && config.isBuild && !config.inlineText) {
|
||||
onLoad();
|
||||
return;
|
||||
}
|
||||
|
||||
masterConfig.isBuild = config && config.isBuild;
|
||||
|
||||
var parsed = text.parseName(name),
|
||||
nonStripName = parsed.moduleName +
|
||||
(parsed.ext ? '.' + parsed.ext : ''),
|
||||
url = req.toUrl(nonStripName),
|
||||
useXhr = (masterConfig.useXhr) ||
|
||||
text.useXhr;
|
||||
|
||||
// Do not load if it is an empty: url
|
||||
if (url.indexOf('empty:') === 0) {
|
||||
onLoad();
|
||||
return;
|
||||
}
|
||||
|
||||
//Load the text. Use XHR if possible and in a browser.
|
||||
if (!hasLocation || useXhr(url, defaultProtocol, defaultHostName, defaultPort)) {
|
||||
text.get(url, function (content) {
|
||||
text.finishLoad(name, parsed.strip, content, onLoad);
|
||||
}, function (err) {
|
||||
if (onLoad.error) {
|
||||
onLoad.error(err);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
//Need to fetch the resource across domains. Assume
|
||||
//the resource has been optimized into a JS module. Fetch
|
||||
//by the module name + extension, but do not include the
|
||||
//!strip part to avoid file system issues.
|
||||
req([nonStripName], function (content) {
|
||||
text.finishLoad(parsed.moduleName + '.' + parsed.ext,
|
||||
parsed.strip, content, onLoad);
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
write: function (pluginName, moduleName, write, config) {
|
||||
if (buildMap.hasOwnProperty(moduleName)) {
|
||||
var content = text.jsEscape(buildMap[moduleName]);
|
||||
write.asModule(pluginName + "!" + moduleName,
|
||||
"define(function () { return '" +
|
||||
content +
|
||||
"';});\n");
|
||||
}
|
||||
},
|
||||
|
||||
writeFile: function (pluginName, moduleName, req, write, config) {
|
||||
var parsed = text.parseName(moduleName),
|
||||
extPart = parsed.ext ? '.' + parsed.ext : '',
|
||||
nonStripName = parsed.moduleName + extPart,
|
||||
//Use a '.js' file name so that it indicates it is a
|
||||
//script that can be loaded across domains.
|
||||
fileName = req.toUrl(parsed.moduleName + extPart) + '.js';
|
||||
|
||||
//Leverage own load() method to load plugin value, but only
|
||||
//write out values that do not have the strip argument,
|
||||
//to avoid any potential issues with ! in file names.
|
||||
text.load(nonStripName, req, function (value) {
|
||||
//Use own write() method to construct full module value.
|
||||
//But need to create shell that translates writeFile's
|
||||
//write() to the right interface.
|
||||
var textWrite = function (contents) {
|
||||
return write(fileName, contents);
|
||||
};
|
||||
textWrite.asModule = function (moduleName, contents) {
|
||||
return write.asModule(moduleName, fileName, contents);
|
||||
};
|
||||
|
||||
text.write(pluginName, nonStripName, textWrite, config);
|
||||
}, config);
|
||||
}
|
||||
};
|
||||
|
||||
if (masterConfig.env === 'node' || (!masterConfig.env &&
|
||||
typeof process !== "undefined" &&
|
||||
process.versions &&
|
||||
!!process.versions.node &&
|
||||
!process.versions['node-webkit'] &&
|
||||
!process.versions['atom-shell'])) {
|
||||
//Using special require.nodeRequire, something added by r.js.
|
||||
fs = require.nodeRequire('fs');
|
||||
|
||||
text.get = function (url, callback, errback) {
|
||||
try {
|
||||
var file = fs.readFileSync(url, 'utf8');
|
||||
//Remove BOM (Byte Mark Order) from utf8 files if it is there.
|
||||
if (file[0] === '\uFEFF') {
|
||||
file = file.substring(1);
|
||||
}
|
||||
callback(file);
|
||||
} catch (e) {
|
||||
if (errback) {
|
||||
errback(e);
|
||||
}
|
||||
}
|
||||
};
|
||||
} else if (masterConfig.env === 'xhr' || (!masterConfig.env &&
|
||||
text.createXhr())) {
|
||||
text.get = function (url, callback, errback, headers) {
|
||||
var xhr = text.createXhr(), header;
|
||||
xhr.open('GET', url, true);
|
||||
|
||||
//Allow plugins direct access to xhr headers
|
||||
if (headers) {
|
||||
for (header in headers) {
|
||||
if (headers.hasOwnProperty(header)) {
|
||||
xhr.setRequestHeader(header.toLowerCase(), headers[header]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Allow overrides specified in config
|
||||
if (masterConfig.onXhr) {
|
||||
masterConfig.onXhr(xhr, url);
|
||||
}
|
||||
|
||||
xhr.onreadystatechange = function (evt) {
|
||||
var status, err;
|
||||
//Do not explicitly handle errors, those should be
|
||||
//visible via console output in the browser.
|
||||
if (xhr.readyState === 4) {
|
||||
status = xhr.status || 0;
|
||||
if (status > 399 && status < 600) {
|
||||
//An http 4xx or 5xx error. Signal an error.
|
||||
err = new Error(url + ' HTTP status: ' + status);
|
||||
err.xhr = xhr;
|
||||
if (errback) {
|
||||
errback(err);
|
||||
}
|
||||
} else {
|
||||
callback(xhr.responseText);
|
||||
}
|
||||
|
||||
if (masterConfig.onXhrComplete) {
|
||||
masterConfig.onXhrComplete(xhr, url);
|
||||
}
|
||||
}
|
||||
};
|
||||
xhr.send(null);
|
||||
};
|
||||
} else if (masterConfig.env === 'rhino' || (!masterConfig.env &&
|
||||
typeof Packages !== 'undefined' && typeof java !== 'undefined')) {
|
||||
//Why Java, why is this so awkward?
|
||||
text.get = function (url, callback) {
|
||||
var stringBuffer, line,
|
||||
encoding = "utf-8",
|
||||
file = new java.io.File(url),
|
||||
lineSeparator = java.lang.System.getProperty("line.separator"),
|
||||
input = new java.io.BufferedReader(new java.io.InputStreamReader(new java.io.FileInputStream(file), encoding)),
|
||||
content = '';
|
||||
try {
|
||||
stringBuffer = new java.lang.StringBuffer();
|
||||
line = input.readLine();
|
||||
|
||||
// Byte Order Mark (BOM) - The Unicode Standard, version 3.0, page 324
|
||||
// http://www.unicode.org/faq/utf_bom.html
|
||||
|
||||
// Note that when we use utf-8, the BOM should appear as "EF BB BF", but it doesn't due to this bug in the JDK:
|
||||
// http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4508058
|
||||
if (line && line.length() && line.charAt(0) === 0xfeff) {
|
||||
// Eat the BOM, since we've already found the encoding on this file,
|
||||
// and we plan to concatenating this buffer with others; the BOM should
|
||||
// only appear at the top of a file.
|
||||
line = line.substring(1);
|
||||
}
|
||||
|
||||
if (line !== null) {
|
||||
stringBuffer.append(line);
|
||||
}
|
||||
|
||||
while ((line = input.readLine()) !== null) {
|
||||
stringBuffer.append(lineSeparator);
|
||||
stringBuffer.append(line);
|
||||
}
|
||||
//Make sure we return a JavaScript string and not a Java string.
|
||||
content = String(stringBuffer.toString()); //String
|
||||
} finally {
|
||||
input.close();
|
||||
}
|
||||
callback(content);
|
||||
};
|
||||
} else if (masterConfig.env === 'xpconnect' || (!masterConfig.env &&
|
||||
typeof Components !== 'undefined' && Components.classes &&
|
||||
Components.interfaces)) {
|
||||
//Avert your gaze!
|
||||
Cc = Components.classes;
|
||||
Ci = Components.interfaces;
|
||||
Components.utils['import']('resource://gre/modules/FileUtils.jsm');
|
||||
xpcIsWindows = ('@mozilla.org/windows-registry-key;1' in Cc);
|
||||
|
||||
text.get = function (url, callback) {
|
||||
var inStream, convertStream, fileObj,
|
||||
readData = {};
|
||||
|
||||
if (xpcIsWindows) {
|
||||
url = url.replace(/\//g, '\\');
|
||||
}
|
||||
|
||||
fileObj = new FileUtils.File(url);
|
||||
|
||||
//XPCOM, you so crazy
|
||||
try {
|
||||
inStream = Cc['@mozilla.org/network/file-input-stream;1']
|
||||
.createInstance(Ci.nsIFileInputStream);
|
||||
inStream.init(fileObj, 1, 0, false);
|
||||
|
||||
convertStream = Cc['@mozilla.org/intl/converter-input-stream;1']
|
||||
.createInstance(Ci.nsIConverterInputStream);
|
||||
convertStream.init(inStream, "utf-8", inStream.available(),
|
||||
Ci.nsIConverterInputStream.DEFAULT_REPLACEMENT_CHARACTER);
|
||||
|
||||
convertStream.readString(inStream.available(), readData);
|
||||
convertStream.close();
|
||||
inStream.close();
|
||||
callback(readData.value);
|
||||
} catch (e) {
|
||||
throw new Error((fileObj && fileObj.path || '') + ': ' + e);
|
||||
}
|
||||
};
|
||||
}
|
||||
return text;
|
||||
});
|
||||
96
external/requirejs/require.js
vendored
96
external/requirejs/require.js
vendored
@ -1,7 +1,6 @@
|
||||
/** vim: et:ts=4:sw=4:sts=4
|
||||
* @license RequireJS 2.1.20 Copyright (c) 2010-2015, The Dojo Foundation All Rights Reserved.
|
||||
* Available via the MIT or new BSD license.
|
||||
* see: http://github.com/jrburke/requirejs for details
|
||||
* @license RequireJS 2.3.5 Copyright jQuery Foundation and other contributors.
|
||||
* Released under MIT license, https://github.com/requirejs/requirejs/blob/master/LICENSE
|
||||
*/
|
||||
//Not using strict: uneven strict support in browsers, #392, and causes
|
||||
//problems with requirejs.exec()/transpiler plugins that may not be strict.
|
||||
@ -9,18 +8,17 @@
|
||||
/*global window, navigator, document, importScripts, setTimeout, opera */
|
||||
|
||||
var requirejs, require, define;
|
||||
(function (global) {
|
||||
(function (global, setTimeout) {
|
||||
var req, s, head, baseElement, dataMain, src,
|
||||
interactiveScript, currentlyAddingScript, mainScript, subPath,
|
||||
version = '2.1.20',
|
||||
commentRegExp = /(\/\*([\s\S]*?)\*\/|([^:]|^)\/\/(.*)$)/mg,
|
||||
version = '2.3.5',
|
||||
commentRegExp = /\/\*[\s\S]*?\*\/|([^:"'=]|^)\/\/.*$/mg,
|
||||
cjsRequireRegExp = /[^.]\s*require\s*\(\s*["']([^'"\s]+)["']\s*\)/g,
|
||||
jsSuffixRegExp = /\.js$/,
|
||||
currDirRegExp = /^\.\//,
|
||||
op = Object.prototype,
|
||||
ostring = op.toString,
|
||||
hasOwn = op.hasOwnProperty,
|
||||
ap = Array.prototype,
|
||||
isBrowser = !!(typeof window !== 'undefined' && typeof navigator !== 'undefined' && window.document),
|
||||
isWebWorker = !isBrowser && typeof importScripts !== 'undefined',
|
||||
//PS3 indicates loaded and complete, but need to wait for complete
|
||||
@ -37,6 +35,11 @@ var requirejs, require, define;
|
||||
globalDefQueue = [],
|
||||
useInteractive = false;
|
||||
|
||||
//Could match something like ')//comment', do not lose the prefix to comment.
|
||||
function commentReplace(match, singlePrefix) {
|
||||
return singlePrefix || '';
|
||||
}
|
||||
|
||||
function isFunction(it) {
|
||||
return ostring.call(it) === '[object Function]';
|
||||
}
|
||||
@ -437,7 +440,9 @@ var requirejs, require, define;
|
||||
//Account for relative paths if there is a base name.
|
||||
if (name) {
|
||||
if (prefix) {
|
||||
if (pluginModule && pluginModule.normalize) {
|
||||
if (isNormalized) {
|
||||
normalizedName = name;
|
||||
} else if (pluginModule && pluginModule.normalize) {
|
||||
//Plugin is loaded, use its normalize method.
|
||||
normalizedName = pluginModule.normalize(name, function (name) {
|
||||
return normalize(name, parentName, applyMap);
|
||||
@ -909,7 +914,11 @@ var requirejs, require, define;
|
||||
defined[id] = exports;
|
||||
|
||||
if (req.onResourceLoad) {
|
||||
req.onResourceLoad(context, this.map, this.depMaps);
|
||||
var resLoadMaps = [];
|
||||
each(this.depMaps, function (depMap) {
|
||||
resLoadMaps.push(depMap.normalizedMap || depMap);
|
||||
});
|
||||
req.onResourceLoad(context, this.map, resLoadMaps);
|
||||
}
|
||||
}
|
||||
|
||||
@ -965,9 +974,11 @@ var requirejs, require, define;
|
||||
//prefix and name should already be normalized, no need
|
||||
//for applying map config again either.
|
||||
normalizedMap = makeModuleMap(map.prefix + '!' + name,
|
||||
this.map.parentMap);
|
||||
this.map.parentMap,
|
||||
true);
|
||||
on(normalizedMap,
|
||||
'defined', bind(this, function (value) {
|
||||
this.map.normalizedMap = normalizedMap;
|
||||
this.init([], function () { return value; }, null, {
|
||||
enabled: true,
|
||||
ignore: true
|
||||
@ -1276,6 +1287,14 @@ var requirejs, require, define;
|
||||
}
|
||||
}
|
||||
|
||||
// Convert old style urlArgs string to a function.
|
||||
if (typeof cfg.urlArgs === 'string') {
|
||||
var urlArgs = cfg.urlArgs;
|
||||
cfg.urlArgs = function(id, url) {
|
||||
return (url.indexOf('?') === -1 ? '?' : '&') + urlArgs;
|
||||
};
|
||||
}
|
||||
|
||||
//Save off the paths since they require special processing,
|
||||
//they are additive.
|
||||
var shim = config.shim,
|
||||
@ -1652,13 +1671,12 @@ var requirejs, require, define;
|
||||
|
||||
//Join the path parts together, then figure out if baseUrl is needed.
|
||||
url = syms.join('/');
|
||||
url += (ext || (/^data\:|\?/.test(url) || skipExt ? '' : '.js'));
|
||||
url += (ext || (/^data\:|^blob\:|\?/.test(url) || skipExt ? '' : '.js'));
|
||||
url = (url.charAt(0) === '/' || url.match(/^[\w\+\.\-]+:/) ? '' : config.baseUrl) + url;
|
||||
}
|
||||
|
||||
return config.urlArgs ? url +
|
||||
((url.indexOf('?') === -1 ? '?' : '&') +
|
||||
config.urlArgs) : url;
|
||||
return config.urlArgs && !/^blob\:/.test(url) ?
|
||||
url + config.urlArgs(moduleName, url) : url;
|
||||
},
|
||||
|
||||
//Delegates to req.load. Broken out as a separate function to
|
||||
@ -1706,7 +1724,21 @@ var requirejs, require, define;
|
||||
onScriptError: function (evt) {
|
||||
var data = getScriptData(evt);
|
||||
if (!hasPathFallback(data.id)) {
|
||||
return onError(makeError('scripterror', 'Script error for: ' + data.id, evt, [data.id]));
|
||||
var parents = [];
|
||||
eachProp(registry, function(value, key) {
|
||||
if (key.indexOf('_@r') !== 0) {
|
||||
each(value.depMaps, function(depMap) {
|
||||
if (depMap.id === data.id) {
|
||||
parents.push(key);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
return onError(makeError('scripterror', 'Script error for "' + data.id +
|
||||
(parents.length ?
|
||||
'", needed by: ' + parents.join(', ') :
|
||||
'"'), evt, [data.id]));
|
||||
}
|
||||
}
|
||||
};
|
||||
@ -1865,9 +1897,6 @@ var requirejs, require, define;
|
||||
if (isBrowser) {
|
||||
//In the browser so use a script tag
|
||||
node = req.createNode(config, moduleName, url);
|
||||
if (config.onNodeCreated) {
|
||||
config.onNodeCreated(node, config, moduleName, url);
|
||||
}
|
||||
|
||||
node.setAttribute('data-requirecontext', context.contextName);
|
||||
node.setAttribute('data-requiremodule', moduleName);
|
||||
@ -1883,11 +1912,11 @@ var requirejs, require, define;
|
||||
if (node.attachEvent &&
|
||||
//Check if node.attachEvent is artificially added by custom script or
|
||||
//natively supported by browser
|
||||
//read https://github.com/jrburke/requirejs/issues/187
|
||||
//read https://github.com/requirejs/requirejs/issues/187
|
||||
//if we can NOT find [native code] then it must NOT natively supported.
|
||||
//in IE8, node.attachEvent does not have toString()
|
||||
//Note the test for "[native code" with no closing brace, see:
|
||||
//https://github.com/jrburke/requirejs/issues/273
|
||||
//https://github.com/requirejs/requirejs/issues/273
|
||||
!(node.attachEvent.toString && node.attachEvent.toString().indexOf('[native code') < 0) &&
|
||||
!isOpera) {
|
||||
//Probably IE. IE (at least 6-8) do not fire
|
||||
@ -1915,6 +1944,12 @@ var requirejs, require, define;
|
||||
}
|
||||
node.src = url;
|
||||
|
||||
//Calling onNodeCreated after all properties on the node have been
|
||||
//set, but before it is placed in the DOM.
|
||||
if (config.onNodeCreated) {
|
||||
config.onNodeCreated(node, config, moduleName, url);
|
||||
}
|
||||
|
||||
//For some cache cases in IE 6-8, the script executes before the end
|
||||
//of the appendChild execution, so to tie an anonymous define
|
||||
//call to the module name (which is stored on the node), hold on
|
||||
@ -1933,9 +1968,14 @@ var requirejs, require, define;
|
||||
//In a web worker, use importScripts. This is not a very
|
||||
//efficient use of importScripts, importScripts will block until
|
||||
//its script is downloaded and evaluated. However, if web workers
|
||||
//are in play, the expectation that a build has been done so that
|
||||
//only one script needs to be loaded anyway. This may need to be
|
||||
//reevaluated if other use cases become common.
|
||||
//are in play, the expectation is that a build has been done so
|
||||
//that only one script needs to be loaded anyway. This may need
|
||||
//to be reevaluated if other use cases become common.
|
||||
|
||||
// Post a task to the event loop to work around a bug in WebKit
|
||||
// where the worker gets garbage-collected after calling
|
||||
// importScripts(): https://webkit.org/b/153317
|
||||
setTimeout(function() {}, 0);
|
||||
importScripts(url);
|
||||
|
||||
//Account for anonymous modules
|
||||
@ -1981,8 +2021,10 @@ var requirejs, require, define;
|
||||
//Preserve dataMain in case it is a path (i.e. contains '?')
|
||||
mainScript = dataMain;
|
||||
|
||||
//Set final baseUrl if there is not already an explicit one.
|
||||
if (!cfg.baseUrl) {
|
||||
//Set final baseUrl if there is not already an explicit one,
|
||||
//but only do so if the data-main value is not a loader plugin
|
||||
//module ID.
|
||||
if (!cfg.baseUrl && mainScript.indexOf('!') === -1) {
|
||||
//Pull off the directory of data-main for use as the
|
||||
//baseUrl.
|
||||
src = mainScript.split('/');
|
||||
@ -2043,7 +2085,7 @@ var requirejs, require, define;
|
||||
if (callback.length) {
|
||||
callback
|
||||
.toString()
|
||||
.replace(commentRegExp, '')
|
||||
.replace(commentRegExp, commentReplace)
|
||||
.replace(cjsRequireRegExp, function (match, dep) {
|
||||
deps.push(dep);
|
||||
});
|
||||
@ -2100,4 +2142,4 @@ var requirejs, require, define;
|
||||
|
||||
//Set up with config info.
|
||||
req(cfg);
|
||||
}(this));
|
||||
}(this, (typeof setTimeout === 'undefined' ? undefined : setTimeout)));
|
||||
|
||||
12
package-lock.json
generated
12
package-lock.json
generated
@ -4591,6 +4591,18 @@
|
||||
"integrity": "sha512-svnO+aNcR/an9Dpi44C7KSAy5fFGLtmPbaaCeQaklUz8BQhS64tWWIIlvEA5jrWICzlO/X9KSzSeXFnZdBu8nw==",
|
||||
"dev": true
|
||||
},
|
||||
"requirejs-domready": {
|
||||
"version": "2.0.3",
|
||||
"resolved": "https://registry.npmjs.org/requirejs-domready/-/requirejs-domready-2.0.3.tgz",
|
||||
"integrity": "sha1-BJ2xlljPrAdIWVLTUhMFq4NtrFI=",
|
||||
"dev": true
|
||||
},
|
||||
"requirejs-text": {
|
||||
"version": "2.0.15",
|
||||
"resolved": "https://registry.npmjs.org/requirejs-text/-/requirejs-text-2.0.15.tgz",
|
||||
"integrity": "sha1-ExOHM2E/xEV7fhJH6Mt1HfeqVCk=",
|
||||
"dev": true
|
||||
},
|
||||
"requires-port": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz",
|
||||
|
||||
@ -59,7 +59,9 @@
|
||||
"load-grunt-tasks": "3.5.2",
|
||||
"phantomjs-prebuilt": "2.1.15",
|
||||
"qunitjs": "1.23.1",
|
||||
"requirejs": "2.3.5"
|
||||
"requirejs": "2.3.5",
|
||||
"requirejs-domready": "2.0.3",
|
||||
"requirejs-text": "2.0.15"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "npm install && grunt",
|
||||
|
||||
Loading…
Reference in New Issue
Block a user