3.0 source code
This commit is contained in:
32
OfficeWeb/vendor/requirejs/tests/NAMESPACE.html
vendored
Normal file
32
OfficeWeb/vendor/requirejs/tests/NAMESPACE.html
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>require.js: NAMESPACE Test</title>
|
||||
<script type="text/javascript" src="NAMESPACE.js"></script>
|
||||
<script type="text/javascript" src="doh/runner.js"></script>
|
||||
<script type="text/javascript" src="doh/_browserRunner.js"></script>
|
||||
<script type="text/javascript">
|
||||
NAMESPACE.require(['one', 'dimple'], function(one, dimple) {
|
||||
doh.register(
|
||||
"namespaceTest",
|
||||
[
|
||||
function namespaceTest(t){
|
||||
t.is("large", one.size);
|
||||
t.is("dimple-blue", dimple.color);
|
||||
}
|
||||
]
|
||||
);
|
||||
doh.run();
|
||||
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>require.js: NAMESPACE Test</h1>
|
||||
|
||||
<p>Only works after doing a build using the simpleNamespace.build.js file
|
||||
in the r.js project.</p>
|
||||
|
||||
<p>Check console for messages</p>
|
||||
</body>
|
||||
</html>
|
||||
96
OfficeWeb/vendor/requirejs/tests/afterload.html
vendored
Normal file
96
OfficeWeb/vendor/requirejs/tests/afterload.html
vendored
Normal file
@@ -0,0 +1,96 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>require.js: After Load</title>
|
||||
<script type="text/javascript" src="doh/runner.js"></script>
|
||||
<script type="text/javascript" src="doh/_browserRunner.js"></script>
|
||||
<script type="text/javascript">
|
||||
var d, s, head;
|
||||
|
||||
function goRequire() {
|
||||
//Need a hack to trigger require.pageLoaded() for pre Firefox 3.6 browsers.
|
||||
var ff = parseFloat(navigator.userAgent.split("Firefox/")[1]) || null;
|
||||
if (ff && ff < 3.6) {
|
||||
require.pageLoaded();
|
||||
}
|
||||
|
||||
require({
|
||||
paths: {
|
||||
domReady: "../../domReady/domReady"
|
||||
}
|
||||
},
|
||||
["require", "simple", "domReady"],
|
||||
function (require, simple, domReady) {
|
||||
domReady(function() {
|
||||
doh.is("blue", simple.color);
|
||||
|
||||
//Now test another script getting loaded will see
|
||||
//document.readyState === "complete".
|
||||
var s = document.createElement("script");
|
||||
s.src = "afterloadreadystate.js";
|
||||
s.charset = "utf-8";
|
||||
head.appendChild(s);
|
||||
});
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
function loadRequire() {
|
||||
var readyRegExp = /complete|loaded/;
|
||||
function onScriptLoad(evt) {
|
||||
var node = evt.target || evt.srcElement;
|
||||
if (evt.type === "load" || readyRegExp.test(node.readyState)) {
|
||||
//Clean up script binding, otherwise, Opera in particular
|
||||
//may trigger it again.
|
||||
if (node.removeEventListener) {
|
||||
node.removeEventListener("load", onScriptLoad, false);
|
||||
} else {
|
||||
//Probably IE.
|
||||
node.detachEvent("onreadystatechange", onScriptLoad);
|
||||
}
|
||||
goRequire();
|
||||
}
|
||||
};
|
||||
|
||||
//Create script tag for require.js
|
||||
s = document.createElement("script");
|
||||
s.src = "../require.js";
|
||||
s.charset = "utf-8";
|
||||
|
||||
//Set up load listener.
|
||||
if (s.addEventListener) {
|
||||
s.addEventListener("load", onScriptLoad, false);
|
||||
} else {
|
||||
//Probably IE.
|
||||
s.attachEvent("onreadystatechange", onScriptLoad);
|
||||
}
|
||||
|
||||
head = (document.getElementsByTagName("head")[0] ||
|
||||
document.getElementsByTagName("html")[0]);
|
||||
head.appendChild(s);
|
||||
}
|
||||
|
||||
doh.register(
|
||||
"afterload",
|
||||
[
|
||||
{
|
||||
name: "afterload",
|
||||
timeout: 5000,
|
||||
runTest: function() {
|
||||
d = new doh.Deferred();
|
||||
return d;
|
||||
}
|
||||
}
|
||||
]
|
||||
);
|
||||
doh.run();
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body onload="loadRequire()">
|
||||
<h1>require.js: After Load Test</h1>
|
||||
<p>Tests adding require after the page loads, and tests that require.js patches
|
||||
up document.readyState for Firefox less than 3.6.</p>
|
||||
<p>Check console for messages</p>
|
||||
</body>
|
||||
</html>
|
||||
2
OfficeWeb/vendor/requirejs/tests/afterloadreadystate.js
vendored
Normal file
2
OfficeWeb/vendor/requirejs/tests/afterloadreadystate.js
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
doh.is("complete", document.readyState);
|
||||
d.callback(true);
|
||||
195
OfficeWeb/vendor/requirejs/tests/all.js
vendored
Normal file
195
OfficeWeb/vendor/requirejs/tests/all.js
vendored
Normal file
@@ -0,0 +1,195 @@
|
||||
//PS3 does not have a usable Function.prototype.toString,
|
||||
//so avoid those tests.
|
||||
var hasToString = (function () {
|
||||
var test = 'hello world';
|
||||
}).toString().indexOf('hello world') !== -1;
|
||||
|
||||
doh.registerUrl("simple", "../simple.html");
|
||||
|
||||
//PS3 does not like this test
|
||||
doh.registerUrl("baseUrl", "../baseUrl.html");
|
||||
|
||||
doh.registerUrl("toUrl", "../toUrl/toUrl.html");
|
||||
doh.registerUrl("urlArgsToUrl", "../urlArgsToUrl.html");
|
||||
|
||||
doh.registerUrl("config", "../config.html");
|
||||
doh.registerUrl("configRequirejs", "../configRequirejs.html");
|
||||
doh.registerUrl("dataMain", "../dataMain/dataMain.html");
|
||||
doh.registerUrl("skipDataMain", "../dataMain/skipDataMain/skipDataMain.html");
|
||||
doh.registerUrl("dataMainIndex", "../dataMain/dataMainIndex/dataMainIndex.html");
|
||||
doh.registerUrl("dataMainBaseUrl", "../dataMain/baseUrl/dataMainBaseUrl.html");
|
||||
|
||||
doh.registerUrl("moduleExports", "../moduleExports/moduleExports.html");
|
||||
|
||||
if (hasToString) {
|
||||
doh.registerUrl("anonSimple", "../anon/anonSimple.html");
|
||||
doh.registerUrl("cjsSpace", "../cjsSpace/cjsSpace.html");
|
||||
doh.registerUrl("cjsDotRequire", "../cjsSpace/cjsDotRequire.html");
|
||||
doh.registerUrl("packages", "../packages/packages.html");
|
||||
doh.registerUrl("packagesConfig", "../packages/config/config.html");
|
||||
doh.registerUrl("packagesNestedMain", "../packagesNestedMain/packagesNestedMain.html");
|
||||
doh.registerUrl("packagesNode", "../packagesNode/packagesNode.html");
|
||||
doh.registerUrl("packagesNodeAdapter", "../packagesNodeAdapter/packagesNodeAdapter.html");
|
||||
doh.registerUrl("specialDeps", "../specialDeps/specialDeps.html");
|
||||
}
|
||||
|
||||
doh.registerUrl("simple-nohead", "../simple-nohead.html");
|
||||
|
||||
doh.registerUrl("hasOwnPropertyTests", "../hasOwnProperty/hasOwnProperty.html");
|
||||
|
||||
//Only do the base test if the urls work out.
|
||||
if (location.href.indexOf('http://127.0.0.1/requirejs/') === 0) {
|
||||
doh.registerUrl("simple-badbase", "../simple-badbase.html");
|
||||
}
|
||||
|
||||
|
||||
doh.registerUrl("circular", "../circular.html");
|
||||
doh.registerUrl("circularDupe", "../circular/dupe/dupe.html");
|
||||
doh.registerUrl("circularPlugin", "../circular/circularPlugin.html");
|
||||
doh.registerUrl("circularComplexPlugin", "../circular/complexPlugin/complexPlugin.html");
|
||||
doh.registerUrl("circular414", "../circular/414/414.html");
|
||||
doh.registerUrl("circularTranspiler", "../circular/transpiler/transpiler.html");
|
||||
|
||||
doh.registerUrl("nestedRequire", "../nestedRequire/nestedRequire.html");
|
||||
|
||||
doh.registerUrl("depEmpty", "../depEmpty.html");
|
||||
doh.registerUrl("depoverlap", "../depoverlap.html");
|
||||
doh.registerUrl("urlfetch", "../urlfetch/urlfetch.html");
|
||||
doh.registerUrl("uniques", "../uniques/uniques.html");
|
||||
doh.registerUrl("multiversion", "../multiversion.html", 10000);
|
||||
|
||||
doh.registerUrl("isBrowser", "../isBrowser/isBrowser.html");
|
||||
doh.registerUrl("onResourceLoadNestedRequire", "../onResourceLoad/nestedRequire.html", 5000);
|
||||
|
||||
doh.registerUrl("jquery", "../jquery/jquery.html");
|
||||
|
||||
//Next three tests fail in PS3
|
||||
doh.registerUrl("jqueryDynamic", "../jquery/jqueryDynamic.html");
|
||||
doh.registerUrl("jqueryDynamic2", "../jquery/jqueryDynamic2.html");
|
||||
|
||||
doh.registerUrl("i18nlocaleunknown", "../i18n/i18n.html?bundle=i18n!nls/fr-fr/colors");
|
||||
|
||||
doh.registerUrl("i18n", "../i18n/i18n.html");
|
||||
//Fail in PS3
|
||||
doh.registerUrl("i18nlocale", "../i18n/i18n.html?locale=en-us-surfer");
|
||||
//Fail in PS3
|
||||
doh.registerUrl("i18nbundle", "../i18n/i18n.html?bundle=i18n!nls/en-us-surfer/colors");
|
||||
|
||||
//Probably fail in PS3
|
||||
doh.registerUrl("i18ncommon", "../i18n/common.html");
|
||||
doh.registerUrl("i18ncommonlocale", "../i18n/common.html?locale=en-us-surfer");
|
||||
|
||||
|
||||
doh.registerUrl("shimBasic", "../shim/basic.html");
|
||||
doh.registerUrl("shimBasicBuilt", "../shim/built/basic-built.html");
|
||||
|
||||
doh.registerUrl("paths", "../paths/paths.html");
|
||||
doh.registerUrl("pathsRelativeNormalize", "../paths/relativeNormalize/relativeNormalize.html");
|
||||
|
||||
doh.registerUrl("moduleConfig", "../moduleConfig/moduleConfig.html");
|
||||
|
||||
doh.registerUrl("mapConfig", "../mapConfig/mapConfig.html");
|
||||
doh.registerUrl("mapConfigBuilt", "../mapConfig/built/mapConfigBuilt.html");
|
||||
doh.registerUrl("mapConfigStar", "../mapConfig/mapConfigStar.html");
|
||||
doh.registerUrl("mapConfigStarBuilt", "../mapConfig/built/mapConfigStarBuilt.html");
|
||||
doh.registerUrl("mapConfigStarAdapter", "../mapConfig/mapConfigStarAdapter.html");
|
||||
doh.registerUrl("mapConfigStarAdapterBuilt", "../mapConfig/built/mapConfigStarAdapterBuilt.html");
|
||||
doh.registerUrl("mapConfigMulti", "../mapConfig/mapConfigMulti.html");
|
||||
doh.registerUrl("mapConfigDelayed", "../mapConfig/mapConfigDelayed.html");
|
||||
doh.registerUrl("mapConfigRelative", "../mapConfig/mapConfigRelative.html");
|
||||
doh.registerUrl("mapConfigSpecificity", "../mapConfig/mapConfigSpecificity.html");
|
||||
doh.registerUrl("mapConfigPlugin", "../mapConfig/mapConfigPlugin.html");
|
||||
doh.registerUrl("mapConfigPluginBuilt", "../mapConfig/built/mapConfigPluginBuilt.html");
|
||||
|
||||
doh.registerUrl("layers", "../layers/layers.html", 10000);
|
||||
|
||||
doh.registerUrl("bundles", "../bundles/bundles.html");
|
||||
|
||||
doh.registerUrl("afterload", "../afterload.html", 10000);
|
||||
|
||||
doh.registerUrl("universal", "../universal/universal.html");
|
||||
doh.registerUrl("universalBuilt", "../universal/universal-built.html");
|
||||
|
||||
doh.registerUrl("defineDouble", "../defineDouble/defineDouble.html");
|
||||
doh.registerUrl("definedSpecified", "../definedSpecified/definedSpecified.html");
|
||||
doh.registerUrl("delayedDefine", "../delayedDefine/delayedDefine.html");
|
||||
doh.registerUrl("nestedDefine", "../nestedDefine/nestedDefine.html");
|
||||
doh.registerUrl("nestedDefine2", "../nestedDefine/nestedDefine2.html");
|
||||
doh.registerUrl("nestedRelativeRequire", "../nestedRelativeRequire/nestedRelativeRequire.html");
|
||||
doh.registerUrl("nestedRequireConfig", "../nestedRequireConfig/nestedRequireConfig.html");
|
||||
|
||||
doh.registerUrl("pluginBundles", "../plugins/pluginBundles/pluginBundles.html");
|
||||
doh.registerUrl("pluginBundlesSeparateText", "../plugins/pluginBundlesSeparateText/pluginBundlesSeparateText.html");
|
||||
|
||||
doh.registerUrl("pluginsSync", "../plugins/sync.html");
|
||||
doh.registerUrl("pluginsOnError", "../plugins/onerror/onerror.html");
|
||||
doh.registerUrl("doublePluginCall", "../plugins/double.html");
|
||||
doh.registerUrl("pluginsNameOnly", "../plugins/nameOnly.html");
|
||||
doh.registerUrl("pluginsDelegated", "../plugins/delegated/delegated.html");
|
||||
doh.registerUrl("pluginsFromText", "../plugins/fromText/fromText.html");
|
||||
doh.registerUrl("pluginsFromTextEvalError", "../plugins/fromTextEvalError/fromTextEvalError.html");
|
||||
doh.registerUrl("pluginsFromTextConfig", "../plugins/fromText/fromTextConfig.html");
|
||||
doh.registerUrl("pluginsFromTextNoDefine", "../plugins/fromTextNoDefine/fromTextNoDefine.html");
|
||||
doh.registerUrl("pluginsTextDepend", "../plugins/textDepend/textDepend.html");
|
||||
doh.registerUrl("pluginLast", "../plugins/pluginLast/pluginLast.html");
|
||||
doh.registerUrl("pluginShim", "../plugins/pluginShim/pluginShim.html");
|
||||
doh.registerUrl("pluginMap", "../plugins/pluginMap/pluginMap.html");
|
||||
doh.registerUrl("pluginMapSameName", "../plugins/pluginMapSameName/pluginMapSameName.html");
|
||||
doh.registerUrl("pluginMapDynamic", "../plugins/pluginMap/dynamic/pluginMapDynamic.html");
|
||||
|
||||
doh.registerUrl("requirePluginLoad", "../requirePluginLoad/requirePluginLoad.html");
|
||||
|
||||
doh.registerUrl("requireAsync", "../requireAsync/requireAsync.html");
|
||||
|
||||
doh.registerUrl("issue379", "../issue379/issue379.html");
|
||||
|
||||
doh.registerUrl("text", "../text/text.html");
|
||||
doh.registerUrl("textOnly", "../text/textOnly.html");
|
||||
doh.registerUrl("textBuilt", "../text/textBuilt.html");
|
||||
doh.registerUrl("textOnError", "../text/textOnError.html");
|
||||
doh.registerUrl("textOnXhr", "../text/textOnXhr.html");
|
||||
doh.registerUrl("jsonp", "../jsonp/jsonp.html");
|
||||
doh.registerUrl("domReady", "../domReady/domReady.html");
|
||||
doh.registerUrl("domReadyExtraConfig", "../domReady/domReadyExtraConfig.html");
|
||||
|
||||
doh.registerUrl("relative", "../relative/relative.html");
|
||||
doh.registerUrl("relativeBaseUrl", "../relative/relativeBaseUrl.html");
|
||||
doh.registerUrl("relativeOutsideBaseUrl", "../relative/outsideBaseUrl/a/outsideBaseUrl.html");
|
||||
|
||||
doh.registerUrl("remoteUrls", "../remoteUrls/remoteUrls.html");
|
||||
|
||||
// IE does not support data URIs for scripts. This is a crude exclusion test
|
||||
// but is good enough that the test is run in enough browsers to prove it works.
|
||||
if (!document.attachEvent) {
|
||||
doh.registerUrl("datauri", "../datauri/datauri.html");
|
||||
}
|
||||
|
||||
doh.registerUrl("queryPath", "../queryPath.html");
|
||||
|
||||
doh.registerUrl("trailingComma", "../trailingComma/trailingComma.html");
|
||||
|
||||
//Hmm, PS3 does not like exports test? assign2 is undefined?
|
||||
doh.registerUrl("exports", "../exports/exports.html");
|
||||
|
||||
doh.registerUrl("moduleAndExports", "../exports/moduleAndExports.html");
|
||||
|
||||
if (typeof Worker !== "undefined") {
|
||||
doh.registerUrl("workers", "../workers.html");
|
||||
}
|
||||
|
||||
doh.registerUrl("undef", "../undef/undef.html", 8000);
|
||||
doh.registerUrl("undefNoRequire", "../undef/undefNoRequire.html", 3000);
|
||||
doh.registerUrl("undefNoRequire2", "../undef/undefNoRequire2.html", 3000);
|
||||
doh.registerUrl("undefEnforceShim", "../undef/undefEnforceShim.html", 8000);
|
||||
doh.registerUrl("undefLocal", "../undef/undefLocal.html", 8000);
|
||||
doh.registerUrl("errorContinue", "../error/errorContinue.html", 8000);
|
||||
doh.registerUrl("errorContinueLocal", "../error/errorContinueLocal.html", 8000);
|
||||
doh.registerUrl("errorDoubleRequire", "../error/doubleRequire/doubleRequire.html", 8000);
|
||||
doh.registerUrl("errorRequireErrback", "../error/requireErrback.html", 2000);
|
||||
doh.registerUrl("errorGlobalOnError", "../error/globalOnError.html", 2000);
|
||||
doh.registerUrl("pluginErrorContinue", "../error/pluginErrorContinue.html", 8000);
|
||||
doh.registerUrl("pluginErrorContinueLocal", "../error/pluginErrorContinueLocal.html", 8000);
|
||||
doh.registerUrl("defineErrorLocal", "../error/defineErrorLocal.html");
|
||||
|
||||
doh.registerUrl("pathArray", "../pathArray/pathArray.html", 8000);
|
||||
doh.registerUrl("pathArrayFail", "../pathArray/pathArrayFail.html", 10000);
|
||||
7
OfficeWeb/vendor/requirejs/tests/anon/a.js
vendored
Normal file
7
OfficeWeb/vendor/requirejs/tests/anon/a.js
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
define(function (require) {
|
||||
var b = require("sub/b");
|
||||
return {
|
||||
name: "a",
|
||||
bName: b.f()
|
||||
};
|
||||
});
|
||||
52
OfficeWeb/vendor/requirejs/tests/anon/anon-tests.js
vendored
Normal file
52
OfficeWeb/vendor/requirejs/tests/anon/anon-tests.js
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
require({
|
||||
baseUrl: requirejs.isBrowser ? "./" : "anon/",
|
||||
paths: {
|
||||
text: "../../../text/text",
|
||||
i18n: "../../../i18n/i18n"
|
||||
}
|
||||
},
|
||||
["require", "magenta", "red", "blue", "green", "yellow", "a", "c"],
|
||||
function(require, magenta, red, blue, green, yellow, a, c) {
|
||||
|
||||
doh.register(
|
||||
"anonSimple",
|
||||
[
|
||||
function colors(t){
|
||||
t.is("redblue", magenta.name);
|
||||
t.is((requirejs.isBrowser ? "./foo.html" : "anon/foo.html"), magenta.path);
|
||||
t.is("red", red.name);
|
||||
t.is("blue", blue.name);
|
||||
t.is("green", green.name);
|
||||
t.is("yellow", yellow.name);
|
||||
t.is("a", a.name);
|
||||
t.is("sub/b", a.bName);
|
||||
t.is("c", c.name);
|
||||
t.is("a", c.aName);
|
||||
|
||||
//Also try a require call after initial
|
||||
//load that uses already loaded modules,
|
||||
//to be sure the require callback is called.
|
||||
if (requirejs.isBrowser) {
|
||||
setTimeout(function () {
|
||||
require(["blue", "red", "magenta"], function (blue, red) {
|
||||
doh.register(
|
||||
"anonSimpleCached",
|
||||
[
|
||||
function colorsCached(t){
|
||||
t.is("red", red.name);
|
||||
t.is("blue", blue.name);
|
||||
t.is("redblue", magenta.name);
|
||||
t.is("hello world", magenta.message);
|
||||
}
|
||||
]
|
||||
);
|
||||
doh.run();
|
||||
});
|
||||
}, 300);
|
||||
}
|
||||
}
|
||||
]
|
||||
);
|
||||
doh.run();
|
||||
}
|
||||
);
|
||||
14
OfficeWeb/vendor/requirejs/tests/anon/anonSimple.html
vendored
Normal file
14
OfficeWeb/vendor/requirejs/tests/anon/anonSimple.html
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>require.js: Simple Anonymous Module Test</title>
|
||||
<script type="text/javascript" src="../../require.js"></script>
|
||||
<script type="text/javascript" src="../doh/runner.js"></script>
|
||||
<script type="text/javascript" src="../doh/_browserRunner.js"></script>
|
||||
<script type="text/javascript" src="anon-tests.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>require.js: Simple Anonymous Module Test</h1>
|
||||
<p>Check console for messages</p>
|
||||
</body>
|
||||
</html>
|
||||
5
OfficeWeb/vendor/requirejs/tests/anon/blue.js
vendored
Normal file
5
OfficeWeb/vendor/requirejs/tests/anon/blue.js
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
define(function () {
|
||||
return {
|
||||
name: "blue"
|
||||
};
|
||||
});
|
||||
7
OfficeWeb/vendor/requirejs/tests/anon/c.js
vendored
Normal file
7
OfficeWeb/vendor/requirejs/tests/anon/c.js
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
define(function (require) {
|
||||
var a = require('a');
|
||||
return {
|
||||
name: 'c',
|
||||
aName: a.name
|
||||
};
|
||||
});
|
||||
3
OfficeWeb/vendor/requirejs/tests/anon/green.js
vendored
Normal file
3
OfficeWeb/vendor/requirejs/tests/anon/green.js
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
define({
|
||||
name: "green"
|
||||
});
|
||||
16
OfficeWeb/vendor/requirejs/tests/anon/magenta.js
vendored
Normal file
16
OfficeWeb/vendor/requirejs/tests/anon/magenta.js
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
define(function (require, exports, module) {
|
||||
//This is a fakeout require("fake1");
|
||||
|
||||
var red = require("red"),
|
||||
blue = require('./blue'),
|
||||
message = require('text!./message.txt');
|
||||
|
||||
/*
|
||||
And another fakeoute require("fake2");
|
||||
*/
|
||||
|
||||
//Use ugly exports
|
||||
exports.name = red.name + blue.name;
|
||||
exports.path = require.toUrl('./foo.html');
|
||||
exports.message = message;
|
||||
});
|
||||
1
OfficeWeb/vendor/requirejs/tests/anon/message.txt
vendored
Normal file
1
OfficeWeb/vendor/requirejs/tests/anon/message.txt
vendored
Normal file
@@ -0,0 +1 @@
|
||||
hello world
|
||||
5
OfficeWeb/vendor/requirejs/tests/anon/red.js
vendored
Normal file
5
OfficeWeb/vendor/requirejs/tests/anon/red.js
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
define("red", function () {
|
||||
return {
|
||||
name: "red"
|
||||
};
|
||||
});
|
||||
3
OfficeWeb/vendor/requirejs/tests/anon/sub/b.js
vendored
Normal file
3
OfficeWeb/vendor/requirejs/tests/anon/sub/b.js
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
define(function(require, exports, module) {
|
||||
exports.f = function () { return "sub/b" };
|
||||
});
|
||||
3
OfficeWeb/vendor/requirejs/tests/anon/yellow.js
vendored
Normal file
3
OfficeWeb/vendor/requirejs/tests/anon/yellow.js
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
define("yellow", {
|
||||
name: "yellow"
|
||||
});
|
||||
5
OfficeWeb/vendor/requirejs/tests/bar
vendored
Normal file
5
OfficeWeb/vendor/requirejs/tests/bar
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
//A test for loading a file with a protocol-less URL via require()
|
||||
|
||||
var bar = {
|
||||
name: "bar"
|
||||
};
|
||||
13
OfficeWeb/vendor/requirejs/tests/baseUrl.html
vendored
Normal file
13
OfficeWeb/vendor/requirejs/tests/baseUrl.html
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Default baseUrl Test</title>
|
||||
<script type="text/javascript" src="doh/runner.js"></script>
|
||||
<script type="text/javascript" src="doh/_browserRunner.js"></script>
|
||||
<script data-main="../testBaseUrl" src="../require.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>require.js: Default baseUrl Test</h1>
|
||||
<p>Check console for messages</p>
|
||||
</body>
|
||||
</html>
|
||||
5
OfficeWeb/vendor/requirejs/tests/browsertests/appendbeforeload/one.dphpd
vendored
Normal file
5
OfficeWeb/vendor/requirejs/tests/browsertests/appendbeforeload/one.dphpd
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
sleep(1);
|
||||
?>
|
||||
|
||||
console.log("ONE");
|
||||
49
OfficeWeb/vendor/requirejs/tests/browsertests/appendbeforeload/test.html
vendored
Normal file
49
OfficeWeb/vendor/requirejs/tests/browsertests/appendbeforeload/test.html
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Script appendChild Before Page Load Test</title>
|
||||
<script type="text/javascript">
|
||||
var attachScript = function(url, name){
|
||||
url += "?stamp=" + (new Date()).getTime();
|
||||
|
||||
var node = document.createElement("script");
|
||||
node.src = url;
|
||||
node.type = "text/javascript";
|
||||
node.charset = "utf-8";
|
||||
node.setAttribute("data-name", name);
|
||||
|
||||
document.getElementsByTagName("head")[0].appendChild(node);
|
||||
}
|
||||
|
||||
var urls = [
|
||||
"one.php",
|
||||
"two.js"
|
||||
]
|
||||
|
||||
for (var i = 0, url; url = urls[i]; i++) {
|
||||
attachScript(url, url);
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Script Blocking Before Page Load Test</h1>
|
||||
<p><b>This test requires PHP. Rename one.dphpd in this directory to
|
||||
one.php before trying this test.</b></p>
|
||||
|
||||
<p>This test looks at scripts added via appendChild before the page loads.
|
||||
Do the scripts execute in the order added to the DOM or the order in which
|
||||
they are received from the network?</p>
|
||||
|
||||
<p>Normally after page load, IE and WebKit
|
||||
will evaluate scripts in network receive order, not in DOM order. This test
|
||||
is checking the behavior before page load.</p>
|
||||
|
||||
<p>Expected results:<br>
|
||||
<b>ONE</b><br>
|
||||
<b>TWO</b><br>
|
||||
</p>
|
||||
|
||||
<p>>Actual results: see browser console. IE and WebKit will execute scripts
|
||||
in network receive order, not in DOM order.</p>
|
||||
</body>
|
||||
</html>
|
||||
1
OfficeWeb/vendor/requirejs/tests/browsertests/appendbeforeload/two.js
vendored
Normal file
1
OfficeWeb/vendor/requirejs/tests/browsertests/appendbeforeload/two.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
console.log("TWO");
|
||||
94
OfficeWeb/vendor/requirejs/tests/browsertests/async/async.php
vendored
Normal file
94
OfficeWeb/vendor/requirejs/tests/browsertests/async/async.php
vendored
Normal file
@@ -0,0 +1,94 @@
|
||||
<?
|
||||
if($_GET['quirks'] == "")
|
||||
{
|
||||
echo "<!DOCTYPE html>\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "\n";
|
||||
}
|
||||
?>
|
||||
<html>
|
||||
<head>
|
||||
<title>Async Attribute Test</title>
|
||||
<script type="text/javascript" src="../common.js"></script>
|
||||
<script type="text/javascript">
|
||||
var attachScript = function(url, name, approach){
|
||||
url += "?stamp=" + (new Date()).getTime();
|
||||
|
||||
var node = document.createElement("script");
|
||||
node.src = url;
|
||||
node.type = "text/javascript";
|
||||
node.charset = "utf-8";
|
||||
if (approach === 'boolean') {
|
||||
node.async = true;
|
||||
} else if (approach === 'string') {
|
||||
node.async = 'async';
|
||||
} else if (approach === 'attribute') {
|
||||
node.setAttribute('async', 'async');
|
||||
}
|
||||
|
||||
document.getElementsByTagName("head")[0].appendChild(node);
|
||||
}
|
||||
|
||||
var urls = [
|
||||
"one.php",
|
||||
"two.js"
|
||||
];
|
||||
|
||||
var loadUrls = function(approach) {
|
||||
for (var i = 0, url; url = urls[i]; i++) {
|
||||
attachScript(url, url, approach);
|
||||
}
|
||||
}
|
||||
|
||||
function onFormAction () {
|
||||
var select = document.getElementById('approach'),
|
||||
approach = select.value,
|
||||
text = select.options[select.selectedIndex].text;
|
||||
window.log('Using approach: [' + text + '] (' + approach + ')...');
|
||||
loadUrls(approach);
|
||||
};
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Async Attribute Test</h1>
|
||||
<p><b>This test requires PHP to be enabled to run.</b></p>
|
||||
|
||||
<p>This test tests async attribute. It attaches two scripts to the DOM, <b>one.php</b> and <b>two.js</b>.
|
||||
The URLs to the scripts always has a timestamp querystring to make sure the scripts are fetched
|
||||
fresh for each request.</p>
|
||||
|
||||
<p>one.php uses a PHP sleep of 3 seconds before returning its result (a log message), where two.js will return
|
||||
immediately with a log message.</p>
|
||||
|
||||
<p>If the async attribute is being effective (In Gecko 1.9.2+/Firefox 3.6+ browsers, maybe
|
||||
Opera in the future), then the log message for two.js should appear before the one.php log message.
|
||||
If async is <b>not</b> effective, then one.php's log message will appear first.</p>
|
||||
|
||||
<p>You can also <b><a href="async.php?quirks=true">try this page in quirks mode</a></b>.
|
||||
When you are done, come back to <b><a href="async.php">standards mode</a></b>.</p>
|
||||
|
||||
<p>Watch the console for log messages. If no console is available, then it should print
|
||||
the log messages in the DOM.</p>
|
||||
|
||||
<p><b>Expected Results in All Browsers (except Opera)</b>:</p>
|
||||
<ul>
|
||||
<li>two.js script</li>
|
||||
<li>one.php script</li>
|
||||
</ul>
|
||||
|
||||
<form onsubmit="onFormAction(); return false;">
|
||||
<label for="approach">Choose an approach to indicate async:</label>
|
||||
<select id="approach" onchange="onFormAction();">
|
||||
<option value="boolean">script.async = true</option>
|
||||
<option value="string">script.async = 'async'</option>
|
||||
<option value="attribute">script.setAttribute('async', 'async')</option>
|
||||
<option value="">No async (one.php should be first in Firefox 3.6+)</option>
|
||||
</select>
|
||||
<input type="submit" name="Go" value="Go">
|
||||
</form>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
5
OfficeWeb/vendor/requirejs/tests/browsertests/async/one.php
vendored
Normal file
5
OfficeWeb/vendor/requirejs/tests/browsertests/async/one.php
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
sleep(3);
|
||||
?>
|
||||
|
||||
window.log("one.php script");
|
||||
1
OfficeWeb/vendor/requirejs/tests/browsertests/async/two.js
vendored
Normal file
1
OfficeWeb/vendor/requirejs/tests/browsertests/async/two.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
window.log("two.js script");
|
||||
47
OfficeWeb/vendor/requirejs/tests/browsertests/common.js
vendored
Normal file
47
OfficeWeb/vendor/requirejs/tests/browsertests/common.js
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
//Common functions for the test files. *MUST* be included after require.js.
|
||||
|
||||
(function() {
|
||||
var messages = [];
|
||||
var bodyReady = false;
|
||||
|
||||
window.log = function(message) {
|
||||
if (typeof console != "undefined" && console.log) {
|
||||
console.log(message);
|
||||
} else {
|
||||
messages.push(message);
|
||||
if (bodyReady) {
|
||||
dumpLogs();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function dumpLogs() {
|
||||
bodyReady = true;
|
||||
if (messages.length) {
|
||||
var body = document.getElementsByTagName("body")[0];
|
||||
if (body) {
|
||||
for (var i = 0; i < messages.length; i++) {
|
||||
var div = document.createElement("div");
|
||||
div.innerHTML = messages[i];
|
||||
body.appendChild(div);
|
||||
}
|
||||
}
|
||||
messages =[];
|
||||
}
|
||||
}
|
||||
|
||||
//Wait for document ready before dumping results.
|
||||
//Will not work with Firefox 3.5 or earlier, but just
|
||||
//be sure to use Firebug or something that defines console.log
|
||||
var tries = 0;
|
||||
function checkDom() {
|
||||
if (document.readyState === "complete") {
|
||||
dumpLogs();
|
||||
} else if (tries < 5) {
|
||||
tries += 1;
|
||||
setTimeout(checkDom, 1000);
|
||||
}
|
||||
}
|
||||
|
||||
checkDom();
|
||||
})();
|
||||
28
OfficeWeb/vendor/requirejs/tests/browsertests/docwritenested/index.html
vendored
Normal file
28
OfficeWeb/vendor/requirejs/tests/browsertests/docwritenested/index.html
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Nested doc.write Test</title>
|
||||
<script type="text/javascript">
|
||||
function loadScript(url) {
|
||||
url += "?stamp=" + (new Date()).getTime();
|
||||
document.write('<script src="' + url + '"></' + 'script>');
|
||||
}
|
||||
loadScript("one.js");
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Nested doc.write Test</h1>
|
||||
|
||||
<p>This test checks how the browser treats document.write calls that are nested.</p>
|
||||
<ol>
|
||||
<li>a script for one.js is written via document.write()</li>
|
||||
<li>when one.js loads it asks for two.js to be written via document.write()</li>
|
||||
<li>one.js then immediately accesses something defined in two.js</li>
|
||||
</ol>
|
||||
|
||||
<p>The expectation is that the access to the variable defined by two.js in one.js
|
||||
will fail.</p>
|
||||
|
||||
<p>Check the console for output</p>
|
||||
</body>
|
||||
</html>
|
||||
7
OfficeWeb/vendor/requirejs/tests/browsertests/docwritenested/one.js
vendored
Normal file
7
OfficeWeb/vendor/requirejs/tests/browsertests/docwritenested/one.js
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
loadScript("two.js");
|
||||
|
||||
one = {
|
||||
name: "one"
|
||||
};
|
||||
|
||||
console.log("Two's name is: " + two.name);
|
||||
3
OfficeWeb/vendor/requirejs/tests/browsertests/docwritenested/two.js
vendored
Normal file
3
OfficeWeb/vendor/requirejs/tests/browsertests/docwritenested/two.js
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
two = {
|
||||
name: "two"
|
||||
};
|
||||
49
OfficeWeb/vendor/requirejs/tests/browsertests/functionToString.html
vendored
Normal file
49
OfficeWeb/vendor/requirejs/tests/browsertests/functionToString.html
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Function toString() Test</title>
|
||||
<style type="text/css">
|
||||
textarea {
|
||||
width: 100%;
|
||||
height: 20em;
|
||||
}
|
||||
label {
|
||||
display: block;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script type="text/javascript">
|
||||
function def(func) {
|
||||
document.getElementById('output').value = func.toString();
|
||||
}
|
||||
|
||||
function convert() {
|
||||
def(function (require, exports, module) {
|
||||
//This is a comment
|
||||
var bar = require('foo/bar'),
|
||||
baz = require('baz');
|
||||
|
||||
//require('line');
|
||||
var moduleId = module.id;
|
||||
|
||||
/*
|
||||
This is a multi-line comment that contains
|
||||
as require('multiline')
|
||||
*/
|
||||
exports.name = 'bamf';
|
||||
});
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Function toString() Test</h1>
|
||||
<p>This test shows how a function is converted to a string value via the Function.prototype.toString() method.
|
||||
See the source of this file to see the source for of the function that is converted to a string.</p>
|
||||
|
||||
<form action="#" onsubmit="convert();return false;">
|
||||
<input type="submit" name="toString" value="toString">
|
||||
<label for="output">Output:</label>
|
||||
<textarea id="output"></textarea>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
86
OfficeWeb/vendor/requirejs/tests/browsertests/noload/index.html
vendored
Normal file
86
OfficeWeb/vendor/requirejs/tests/browsertests/noload/index.html
vendored
Normal file
@@ -0,0 +1,86 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Script noload Test</title>
|
||||
<script src="../common.js"></script>
|
||||
<script>
|
||||
|
||||
var readyRegExp = /complete|loaded/;
|
||||
|
||||
function onTestScriptLoad(evt) {
|
||||
var node = evt.target || evt.srcElement;
|
||||
if (evt.type === "load" || readyRegExp.test(node.readyState)) {
|
||||
log(node.getAttribute("data-name") + " loaded");
|
||||
|
||||
//Clean up binding.
|
||||
if (node.removeEventListener) {
|
||||
node.removeEventListener("load", onTestScriptLoad, false);
|
||||
} else {
|
||||
//Probably IE.
|
||||
node.detachEvent("onreadystatechange", onTestScriptLoad);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function onTestError(evt) {
|
||||
var node = evt.target || evt.srcElement,
|
||||
name = node.getAttribute("data-name");
|
||||
|
||||
if (typeof console !== "undefined" && console.log) {
|
||||
console.log(name + ' has error event: ', evt);
|
||||
}
|
||||
|
||||
log(name + " onerror triggered");
|
||||
|
||||
//Clean up binding.
|
||||
if (node.removeEventListener) {
|
||||
node.removeEventListener("error", onTestError, false);
|
||||
} else {
|
||||
//Probably IE.
|
||||
node.detachEvent("onerror", onTestError);
|
||||
}
|
||||
}
|
||||
|
||||
function attachScript(url, name) {
|
||||
var node = document.createElement("script");
|
||||
node.src = url;
|
||||
node.type = "text/javascript";
|
||||
node.charset = "utf-8";
|
||||
node.setAttribute("data-name", name);
|
||||
|
||||
//Set up load listener.
|
||||
if (node.addEventListener) {
|
||||
node.addEventListener("load", onTestScriptLoad, false);
|
||||
node.addEventListener("error", onTestError, false);
|
||||
} else {
|
||||
//Probably IE.
|
||||
node.attachEvent("onreadystatechange", onTestScriptLoad);
|
||||
node.attachEvent("onerror", onTestError);
|
||||
}
|
||||
|
||||
document.getElementsByTagName("head")[0].appendChild(node);
|
||||
}
|
||||
|
||||
//Main logic
|
||||
attachScript('404.js', '404');
|
||||
|
||||
var url505 = location.protocol + '//' + location.hostname + ':9320/505.js';
|
||||
attachScript(url505, '505');
|
||||
|
||||
var noServerUrl = location.protocol + '//' + location.hostname + ':9321/noserver.js';
|
||||
attachScript(noServerUrl, 'no server');
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Script noload Test</h1>
|
||||
|
||||
<p>Test if HTTP 404 or 500 calls or down hosts for a script trigger a scripts error handler.</p>
|
||||
|
||||
<p>For this test to receive 500 responses, nodejs needs to run server.js in this directory.</p>
|
||||
|
||||
<p>Output below should be "404 onerror triggered", "500 onerror triggered" and "no server onerror triggered".
|
||||
They may be in a different order, but that is OK.</p>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
26
OfficeWeb/vendor/requirejs/tests/browsertests/noload/server.js
vendored
Normal file
26
OfficeWeb/vendor/requirejs/tests/browsertests/noload/server.js
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
/*jslint strict: false*/
|
||||
/*global require: false, console: false */
|
||||
|
||||
var http = require('http'),
|
||||
host = '0.0.0.0',
|
||||
port = 9320,
|
||||
config;
|
||||
|
||||
http.createServer(function (req, res) {
|
||||
|
||||
req.on('end', function () {
|
||||
|
||||
var contents = '500 server error';
|
||||
|
||||
res.writeHead(500, {
|
||||
'Content-Type': 'text/plain',
|
||||
'Content-Length': contents.length
|
||||
});
|
||||
|
||||
res.write(contents, 'utf8');
|
||||
res.end();
|
||||
});
|
||||
|
||||
}).listen(port, host);
|
||||
|
||||
console.log('Server running at http://' + host + ':' + port + '/');
|
||||
74
OfficeWeb/vendor/requirejs/tests/browsertests/onerror/index.html
vendored
Normal file
74
OfficeWeb/vendor/requirejs/tests/browsertests/onerror/index.html
vendored
Normal file
@@ -0,0 +1,74 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Script onerror Test</title>
|
||||
<script src="../common.js"></script>
|
||||
<script>
|
||||
|
||||
var readyRegExp = /complete|loaded/;
|
||||
|
||||
function onTestScriptLoad(evt) {
|
||||
var node = evt.target || evt.srcElement;
|
||||
if (evt.type === "load" || readyRegExp.test(node.readyState)) {
|
||||
log(node.getAttribute("data-name") + " loaded");
|
||||
|
||||
//Clean up binding.
|
||||
if (node.removeEventListener) {
|
||||
node.removeEventListener("load", onTestScriptLoad, false);
|
||||
} else {
|
||||
//Probably IE.
|
||||
node.detachEvent("onreadystatechange", onTestScriptLoad);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function onTestError(evt) {
|
||||
var node = evt.target || evt.srcElement;
|
||||
log(node.getAttribute("data-name") + " onerror triggered");
|
||||
|
||||
//Clean up binding.
|
||||
if (node.removeEventListener) {
|
||||
node.removeEventListener("error", onTestError, false);
|
||||
} else {
|
||||
//Probably IE.
|
||||
node.detachEvent("onerror", onTestError);
|
||||
}
|
||||
}
|
||||
|
||||
function attachScript(url, name) {
|
||||
var node = document.createElement("script");
|
||||
node.src = url;
|
||||
node.type = "text/javascript";
|
||||
node.charset = "utf-8";
|
||||
node.setAttribute("data-name", name);
|
||||
|
||||
//Set up load listener.
|
||||
if (node.addEventListener) {
|
||||
node.addEventListener("load", onTestScriptLoad, false);
|
||||
node.addEventListener("error", onTestError, false);
|
||||
} else {
|
||||
//Probably IE.
|
||||
node.attachEvent("onreadystatechange", onTestScriptLoad);
|
||||
node.attachEvent("onerror", onTestError);
|
||||
}
|
||||
|
||||
document.getElementsByTagName("head")[0].appendChild(node);
|
||||
}
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Script onerror Test</h1>
|
||||
|
||||
<p>Test different script loading scenarios to see if an error callback is
|
||||
given on the script tag.</p>
|
||||
|
||||
<p>Press the button and check console for output. There should be a log
|
||||
message for each button.</p>
|
||||
|
||||
<button onclick="attachScript('ok.js', 'ok');">OK</button>
|
||||
<button onclick="attachScript('parseError.js', 'parseError');">Parse Error</button>
|
||||
<button onclick="attachScript('scriptError.js', 'scriptError');">Script Error</button>
|
||||
<button onclick="attachScript('404.js', '404');">404 Script</button>
|
||||
</body>
|
||||
</html>
|
||||
1
OfficeWeb/vendor/requirejs/tests/browsertests/onerror/ok.js
vendored
Normal file
1
OfficeWeb/vendor/requirejs/tests/browsertests/onerror/ok.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
log("ok has executed");
|
||||
4
OfficeWeb/vendor/requirejs/tests/browsertests/onerror/parseError.js
vendored
Normal file
4
OfficeWeb/vendor/requirejs/tests/browsertests/onerror/parseError.js
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
|
||||
funktion = foo() {
|
||||
return 'funky';
|
||||
}
|
||||
4
OfficeWeb/vendor/requirejs/tests/browsertests/onerror/scriptError.js
vendored
Normal file
4
OfficeWeb/vendor/requirejs/tests/browsertests/onerror/scriptError.js
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
|
||||
if (true) {
|
||||
throw "scriptError throwing";
|
||||
}
|
||||
1
OfficeWeb/vendor/requirejs/tests/browsertests/scriptload/eight.js
vendored
Normal file
1
OfficeWeb/vendor/requirejs/tests/browsertests/scriptload/eight.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
log("eight.js script");
|
||||
1
OfficeWeb/vendor/requirejs/tests/browsertests/scriptload/five.js
vendored
Normal file
1
OfficeWeb/vendor/requirejs/tests/browsertests/scriptload/five.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
log("five.js script");
|
||||
2520
OfficeWeb/vendor/requirejs/tests/browsertests/scriptload/four.js
vendored
Normal file
2520
OfficeWeb/vendor/requirejs/tests/browsertests/scriptload/four.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
98
OfficeWeb/vendor/requirejs/tests/browsertests/scriptload/index.html
vendored
Normal file
98
OfficeWeb/vendor/requirejs/tests/browsertests/scriptload/index.html
vendored
Normal file
@@ -0,0 +1,98 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Script Load Test</title>
|
||||
<script type="text/javascript" src="../common.js"></script>
|
||||
<script type="text/javascript">
|
||||
//cache bust?
|
||||
var noCache = location.href.indexOf("nocache") != -1;
|
||||
|
||||
log("noCache: " + noCache);
|
||||
|
||||
var readyRegExp = /complete|loaded/;
|
||||
|
||||
var onTestScriptLoad = function(evt) {
|
||||
var node = evt.target || evt.srcElement;
|
||||
if (evt.type == "load" || readyRegExp.test(node.readyState)) {
|
||||
log(node.getAttribute("data-name") + " loaded");
|
||||
|
||||
//Clean up script binding.
|
||||
if (node.removeEventListener) {
|
||||
node.removeEventListener("load", onTestScriptLoad, false);
|
||||
} else {
|
||||
//Probably IE.
|
||||
node.detachEvent("onreadystatechange", onTestScriptLoad);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var attachScript = function(url, name, useDocWrite){
|
||||
if (noCache) {
|
||||
url += "?stamp=" + (new Date()).getTime();
|
||||
}
|
||||
if (useDocWrite) {
|
||||
//TODO doc.write
|
||||
document.write('<script type="text/javascript" charset="utf-8" data-name="'
|
||||
+ name
|
||||
+ '" src="'
|
||||
+ url
|
||||
+ '" onload="onTestScriptLoad(evt)" onreadytate="onTestScriptLoad(evt)">\<\/script>');
|
||||
} else {
|
||||
var node = document.createElement("script");
|
||||
node.src = url;
|
||||
node.type = "text/javascript";
|
||||
node.charset = "utf-8";
|
||||
node.setAttribute("data-name", name);
|
||||
|
||||
//Set up load listener.
|
||||
if (node.addEventListener) {
|
||||
node.addEventListener("load", onTestScriptLoad, false);
|
||||
} else {
|
||||
//Probably IE.
|
||||
node.attachEvent("onreadystatechange", onTestScriptLoad);
|
||||
}
|
||||
|
||||
document.getElementsByTagName("head")[0].appendChild(node);
|
||||
}
|
||||
}
|
||||
|
||||
var urls = [
|
||||
"one.js",
|
||||
"two.js",
|
||||
"three.js",
|
||||
"four.js",
|
||||
"five.js",
|
||||
"six.js",
|
||||
"seven.js",
|
||||
"eight.js",
|
||||
"nine.js"
|
||||
]
|
||||
|
||||
var loadUrls = function(useDocWrite) {
|
||||
for (var i = 0, url; url = urls[i]; i++) {
|
||||
attachScript(url, url, useDocWrite);
|
||||
}
|
||||
}
|
||||
|
||||
//First test document.write calls
|
||||
//xxx
|
||||
|
||||
//Do appendChilds
|
||||
loadUrls(false);
|
||||
|
||||
//Try script appends after page load.
|
||||
log("----------------------");
|
||||
setTimeout(loadUrls, 2000);
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Script Load Test</h1>
|
||||
|
||||
<p>This test checks the order in which script onloads are called. Hopefully
|
||||
only one script onload is fired at a time and it matches the just-evaluated
|
||||
script tag. If this does not work, then it means require.js files *must* specify
|
||||
a module name for a module definition call, instead of letting it be derived
|
||||
from the file path.</p>
|
||||
<p>Check the console for output</p>
|
||||
</body>
|
||||
</html>
|
||||
1
OfficeWeb/vendor/requirejs/tests/browsertests/scriptload/nine.js
vendored
Normal file
1
OfficeWeb/vendor/requirejs/tests/browsertests/scriptload/nine.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
log("nine.js script");
|
||||
1
OfficeWeb/vendor/requirejs/tests/browsertests/scriptload/one.js
vendored
Normal file
1
OfficeWeb/vendor/requirejs/tests/browsertests/scriptload/one.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
log("one.js script");
|
||||
1
OfficeWeb/vendor/requirejs/tests/browsertests/scriptload/seven.js
vendored
Normal file
1
OfficeWeb/vendor/requirejs/tests/browsertests/scriptload/seven.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
log("seven.js script");
|
||||
1
OfficeWeb/vendor/requirejs/tests/browsertests/scriptload/six.js
vendored
Normal file
1
OfficeWeb/vendor/requirejs/tests/browsertests/scriptload/six.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
log("six.js script");
|
||||
1
OfficeWeb/vendor/requirejs/tests/browsertests/scriptload/three.js
vendored
Normal file
1
OfficeWeb/vendor/requirejs/tests/browsertests/scriptload/three.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
log("three.js script");
|
||||
4
OfficeWeb/vendor/requirejs/tests/browsertests/scriptload/two.js
vendored
Normal file
4
OfficeWeb/vendor/requirejs/tests/browsertests/scriptload/two.js
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
log("two.js script");
|
||||
setTimeout(function () {
|
||||
log("two.js timeout -- should occur after two.js load");
|
||||
}, 13);
|
||||
5
OfficeWeb/vendor/requirejs/tests/browsertests/scriptloadinteractive/eight.js
vendored
Normal file
5
OfficeWeb/vendor/requirejs/tests/browsertests/scriptloadinteractive/eight.js
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
def(function () {
|
||||
return {
|
||||
name: 'eight'
|
||||
};
|
||||
});
|
||||
5
OfficeWeb/vendor/requirejs/tests/browsertests/scriptloadinteractive/five.js
vendored
Normal file
5
OfficeWeb/vendor/requirejs/tests/browsertests/scriptloadinteractive/five.js
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
def(function () {
|
||||
return {
|
||||
name: 'five'
|
||||
};
|
||||
});
|
||||
2524
OfficeWeb/vendor/requirejs/tests/browsertests/scriptloadinteractive/four.js
vendored
Normal file
2524
OfficeWeb/vendor/requirejs/tests/browsertests/scriptloadinteractive/four.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
2527
OfficeWeb/vendor/requirejs/tests/browsertests/scriptloadinteractive/four.php
vendored
Normal file
2527
OfficeWeb/vendor/requirejs/tests/browsertests/scriptloadinteractive/four.php
vendored
Normal file
File diff suppressed because it is too large
Load Diff
149
OfficeWeb/vendor/requirejs/tests/browsertests/scriptloadinteractive/index-php.html
vendored
Normal file
149
OfficeWeb/vendor/requirejs/tests/browsertests/scriptloadinteractive/index-php.html
vendored
Normal file
@@ -0,0 +1,149 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Script Load Interactive Test (PHP used to delay two scripts)</title>
|
||||
<script src="../common.js"></script>
|
||||
<script>
|
||||
/*jslint plusplus: false, strict: false */
|
||||
/*global log: false, dumpLogs: false */
|
||||
//cache bust?
|
||||
var noCache = location.href.indexOf("nocache") !== -1;
|
||||
|
||||
log("noCache: " + noCache);
|
||||
|
||||
var readyRegExp = /complete|loaded/,
|
||||
useInteractive = false,
|
||||
loadedScripts = [],
|
||||
callCount = 0,
|
||||
currentlyAddingScript,
|
||||
waitingFunc, loadUrls,
|
||||
urls = [
|
||||
"one.js",
|
||||
"two.js",
|
||||
"three.js",
|
||||
"four.php",
|
||||
"five.js",
|
||||
"six.php",
|
||||
"seven.js",
|
||||
"eight.js",
|
||||
"nine.js"
|
||||
];
|
||||
|
||||
function report() {
|
||||
var i, module;
|
||||
for (i = 0; i < loadedScripts.length; i++) {
|
||||
module = loadedScripts[i];
|
||||
log("module " + module.name + " === " + module.obj.name);
|
||||
}
|
||||
callCount += 1;
|
||||
//dumpLogs();
|
||||
if (callCount === 1) {
|
||||
log("-------Trying cache hits now--------");
|
||||
loadedScripts = [];
|
||||
setTimeout(loadUrls, 500);
|
||||
}
|
||||
}
|
||||
|
||||
function finishScript(script, func) {
|
||||
if (!script) {
|
||||
return;
|
||||
}
|
||||
|
||||
loadedScripts.push({
|
||||
name: script.getAttribute('data-name').replace(/\.js$/, ''),
|
||||
obj: func()
|
||||
});
|
||||
|
||||
if (loadedScripts.length === 9) {
|
||||
report();
|
||||
}
|
||||
}
|
||||
|
||||
function onTestScriptLoad(evt) {
|
||||
var node = evt.target || evt.srcElement;
|
||||
if (evt.type === "load" || readyRegExp.test(node.readyState)) {
|
||||
if (!useInteractive) {
|
||||
finishScript(node, waitingFunc);
|
||||
}
|
||||
|
||||
//Clean up
|
||||
if (node.removeEventListener) {
|
||||
node.removeEventListener("load", onTestScriptLoad, false);
|
||||
} else {
|
||||
//Probably IE.
|
||||
node.detachEvent("onreadystatechange", onTestScriptLoad);
|
||||
}
|
||||
}
|
||||
}
|
||||
function attachScript(url, name, useDocWrite) {
|
||||
if (noCache) {
|
||||
url += "?stamp=" + (new Date()).getTime();
|
||||
}
|
||||
var node = document.createElement("script");
|
||||
node.src = url;
|
||||
node.type = "text/javascript";
|
||||
node.charset = "utf-8";
|
||||
node.setAttribute("data-name", name);
|
||||
|
||||
//Set up load listener.
|
||||
if (node.addEventListener) {
|
||||
node.addEventListener("load", onTestScriptLoad, false);
|
||||
} else {
|
||||
//Probably IE.
|
||||
useInteractive = true;
|
||||
node.attachEvent("onreadystatechange", onTestScriptLoad);
|
||||
}
|
||||
currentlyAddingScript = node;
|
||||
|
||||
document.getElementsByTagName("head")[0].appendChild(node);
|
||||
currentlyAddingScript = null;
|
||||
}
|
||||
|
||||
loadUrls = function () {
|
||||
for (var i = 0, url; (url = urls[i]); i++) {
|
||||
attachScript(url, url);
|
||||
}
|
||||
};
|
||||
|
||||
function def(func) {
|
||||
var scripts, i, script = currentlyAddingScript;
|
||||
if (useInteractive) {
|
||||
scripts = document.getElementsByTagName('script');
|
||||
var states = [];
|
||||
for (i = scripts.length - 1; i > -1; i--) {
|
||||
states.push(i + scripts[i].readyState + scripts[i].src);
|
||||
//log('script with name ' + scripts[i].getAttribute('data-name') + ' has readyState = ' + scripts[i].readyState + ' for func: ' + func);
|
||||
if (scripts[i].readyState === 'interactive') {
|
||||
script = scripts[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!script) {
|
||||
log("ERROR: No matching script interactive for " + func);
|
||||
log("script readyStates are: " + states);
|
||||
}
|
||||
//log('calling finishScript for interactive dat-name: ' + script.getAttribute('data-name'));
|
||||
finishScript(script, func);
|
||||
} else {
|
||||
waitingFunc = func;
|
||||
}
|
||||
}
|
||||
|
||||
//Do appendChilds
|
||||
loadUrls();
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Script Load Interactive Test (PHP used to delay two scripts)</h1>
|
||||
|
||||
<p>This test checks to see if a function call can be associated with a specific script tag.</p>
|
||||
<p>For non-IE 6-8 browsers, the script onload event may not fire right after the the script
|
||||
is evaluated. Kris Zyp found for IE though that in a function call that is called while the
|
||||
script is executed, it could query the script nodes and the one that is in "interactive" mode
|
||||
indicates the current script.</p>
|
||||
<p>So this test tries to see to use interactive state if possible, and if that does not work,
|
||||
falls back to using script onload to associate the scripts.</p>
|
||||
<p>Check the console for output. Expected result, all scripts are matched up with their calls.</p>
|
||||
</body>
|
||||
</html>
|
||||
149
OfficeWeb/vendor/requirejs/tests/browsertests/scriptloadinteractive/index.html
vendored
Normal file
149
OfficeWeb/vendor/requirejs/tests/browsertests/scriptloadinteractive/index.html
vendored
Normal file
@@ -0,0 +1,149 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Script Load Interactive Test</title>
|
||||
<script src="../common.js"></script>
|
||||
<script>
|
||||
/*jslint plusplus: false, strict: false */
|
||||
/*global log: false, dumpLogs: false */
|
||||
//cache bust?
|
||||
var noCache = location.href.indexOf("nocache") !== -1;
|
||||
|
||||
log("noCache: " + noCache);
|
||||
|
||||
var readyRegExp = /complete|loaded/,
|
||||
useInteractive = false,
|
||||
loadedScripts = [],
|
||||
callCount = 0,
|
||||
currentlyAddingScript,
|
||||
waitingFunc, loadUrls,
|
||||
urls = [
|
||||
"one.js",
|
||||
"two.js",
|
||||
"three.js",
|
||||
"four.js",
|
||||
"five.js",
|
||||
"six.js",
|
||||
"seven.js",
|
||||
"eight.js",
|
||||
"nine.js"
|
||||
];
|
||||
|
||||
function report() {
|
||||
var i, module;
|
||||
for (i = 0; i < loadedScripts.length; i++) {
|
||||
module = loadedScripts[i];
|
||||
log("module " + module.name + " === " + module.obj.name);
|
||||
}
|
||||
callCount += 1;
|
||||
//dumpLogs();
|
||||
if (callCount === 1) {
|
||||
log("-------Trying cache hits now--------");
|
||||
loadedScripts = [];
|
||||
setTimeout(loadUrls, 500);
|
||||
}
|
||||
}
|
||||
|
||||
function finishScript(script, func) {
|
||||
if (!script) {
|
||||
return;
|
||||
}
|
||||
|
||||
loadedScripts.push({
|
||||
name: script.getAttribute('data-name').replace(/\.js$/, ''),
|
||||
obj: func()
|
||||
});
|
||||
|
||||
if (loadedScripts.length === 9) {
|
||||
report();
|
||||
}
|
||||
}
|
||||
|
||||
function onTestScriptLoad(evt) {
|
||||
var node = evt.target || evt.srcElement;
|
||||
if (evt.type === "load" || readyRegExp.test(node.readyState)) {
|
||||
if (!useInteractive) {
|
||||
finishScript(node, waitingFunc);
|
||||
}
|
||||
|
||||
//Clean up
|
||||
if (node.removeEventListener) {
|
||||
node.removeEventListener("load", onTestScriptLoad, false);
|
||||
} else {
|
||||
//Probably IE.
|
||||
node.detachEvent("onreadystatechange", onTestScriptLoad);
|
||||
}
|
||||
}
|
||||
}
|
||||
function attachScript(url, name, useDocWrite) {
|
||||
if (noCache) {
|
||||
url += "?stamp=" + (new Date()).getTime();
|
||||
}
|
||||
var node = document.createElement("script");
|
||||
node.src = url;
|
||||
node.type = "text/javascript";
|
||||
node.charset = "utf-8";
|
||||
node.setAttribute("data-name", name);
|
||||
|
||||
//Set up load listener.
|
||||
if (node.addEventListener) {
|
||||
node.addEventListener("load", onTestScriptLoad, false);
|
||||
} else {
|
||||
//Probably IE.
|
||||
useInteractive = true;
|
||||
node.attachEvent("onreadystatechange", onTestScriptLoad);
|
||||
}
|
||||
currentlyAddingScript = node;
|
||||
|
||||
document.getElementsByTagName("head")[0].appendChild(node);
|
||||
currentlyAddingScript = null;
|
||||
}
|
||||
|
||||
loadUrls = function () {
|
||||
for (var i = 0, url; (url = urls[i]); i++) {
|
||||
attachScript(url, url);
|
||||
}
|
||||
};
|
||||
|
||||
function def(func) {
|
||||
var scripts, i, script = currentlyAddingScript;
|
||||
if (useInteractive) {
|
||||
scripts = document.getElementsByTagName('script');
|
||||
var states = [];
|
||||
for (i = scripts.length - 1; i > -1; i--) {
|
||||
states.push(i + scripts[i].readyState + scripts[i].src);
|
||||
//log('script with name ' + scripts[i].getAttribute('data-name') + ' has readyState = ' + scripts[i].readyState + ' for func: ' + func);
|
||||
if (scripts[i].readyState === 'interactive') {
|
||||
script = scripts[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!script) {
|
||||
log("ERROR: No matching script interactive for " + func);
|
||||
log("script readyStates are: " + states);
|
||||
}
|
||||
//log('calling finishScript for interactive dat-name: ' + script.getAttribute('data-name'));
|
||||
finishScript(script, func);
|
||||
} else {
|
||||
waitingFunc = func;
|
||||
}
|
||||
}
|
||||
|
||||
//Do appendChilds
|
||||
loadUrls();
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Script Load Interactive Test</h1>
|
||||
|
||||
<p>This test checks to see if a function call can be associated with a specific script tag.</p>
|
||||
<p>For non-IE 6-8 browsers, the script onload event may not fire right after the the script
|
||||
is evaluated. Kris Zyp found for IE though that in a function call that is called while the
|
||||
script is executed, it could query the script nodes and the one that is in "interactive" mode
|
||||
indicates the current script.</p>
|
||||
<p>So this test tries to see to use interactive state if possible, and if that does not work,
|
||||
falls back to using script onload to associate the scripts.</p>
|
||||
<p>Check the console for output. Expected result, all scripts are matched up with their calls.</p>
|
||||
</body>
|
||||
</html>
|
||||
5
OfficeWeb/vendor/requirejs/tests/browsertests/scriptloadinteractive/nine.js
vendored
Normal file
5
OfficeWeb/vendor/requirejs/tests/browsertests/scriptloadinteractive/nine.js
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
def(function () {
|
||||
return {
|
||||
name: 'nine'
|
||||
};
|
||||
});
|
||||
5
OfficeWeb/vendor/requirejs/tests/browsertests/scriptloadinteractive/one.js
vendored
Normal file
5
OfficeWeb/vendor/requirejs/tests/browsertests/scriptloadinteractive/one.js
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
def(function () {
|
||||
return {
|
||||
name: 'one'
|
||||
};
|
||||
});
|
||||
5
OfficeWeb/vendor/requirejs/tests/browsertests/scriptloadinteractive/seven.js
vendored
Normal file
5
OfficeWeb/vendor/requirejs/tests/browsertests/scriptloadinteractive/seven.js
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
def(function () {
|
||||
return {
|
||||
name: 'seven'
|
||||
};
|
||||
});
|
||||
5
OfficeWeb/vendor/requirejs/tests/browsertests/scriptloadinteractive/six.js
vendored
Normal file
5
OfficeWeb/vendor/requirejs/tests/browsertests/scriptloadinteractive/six.js
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
def(function () {
|
||||
return {
|
||||
name: 'six'
|
||||
};
|
||||
});
|
||||
9
OfficeWeb/vendor/requirejs/tests/browsertests/scriptloadinteractive/six.php
vendored
Normal file
9
OfficeWeb/vendor/requirejs/tests/browsertests/scriptloadinteractive/six.php
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
sleep(2)
|
||||
?>
|
||||
|
||||
def(function () {
|
||||
return {
|
||||
name: 'six'
|
||||
};
|
||||
});
|
||||
5
OfficeWeb/vendor/requirejs/tests/browsertests/scriptloadinteractive/three.js
vendored
Normal file
5
OfficeWeb/vendor/requirejs/tests/browsertests/scriptloadinteractive/three.js
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
def(function () {
|
||||
return {
|
||||
name: 'three'
|
||||
};
|
||||
});
|
||||
5
OfficeWeb/vendor/requirejs/tests/browsertests/scriptloadinteractive/two.js
vendored
Normal file
5
OfficeWeb/vendor/requirejs/tests/browsertests/scriptloadinteractive/two.js
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
def(function () {
|
||||
return {
|
||||
name: 'two'
|
||||
};
|
||||
});
|
||||
5
OfficeWeb/vendor/requirejs/tests/browsertests/scriptloadinteractiveattach/eight.js
vendored
Normal file
5
OfficeWeb/vendor/requirejs/tests/browsertests/scriptloadinteractiveattach/eight.js
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
def(function () {
|
||||
return {
|
||||
name: 'eight'
|
||||
};
|
||||
});
|
||||
5
OfficeWeb/vendor/requirejs/tests/browsertests/scriptloadinteractiveattach/five.js
vendored
Normal file
5
OfficeWeb/vendor/requirejs/tests/browsertests/scriptloadinteractiveattach/five.js
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
def(function () {
|
||||
return {
|
||||
name: 'five'
|
||||
};
|
||||
});
|
||||
2524
OfficeWeb/vendor/requirejs/tests/browsertests/scriptloadinteractiveattach/four.js
vendored
Normal file
2524
OfficeWeb/vendor/requirejs/tests/browsertests/scriptloadinteractiveattach/four.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
2527
OfficeWeb/vendor/requirejs/tests/browsertests/scriptloadinteractiveattach/four.php
vendored
Normal file
2527
OfficeWeb/vendor/requirejs/tests/browsertests/scriptloadinteractiveattach/four.php
vendored
Normal file
File diff suppressed because it is too large
Load Diff
149
OfficeWeb/vendor/requirejs/tests/browsertests/scriptloadinteractiveattach/index-php.html
vendored
Normal file
149
OfficeWeb/vendor/requirejs/tests/browsertests/scriptloadinteractiveattach/index-php.html
vendored
Normal file
@@ -0,0 +1,149 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Script Load Interactive Test (PHP used to delay two scripts)</title>
|
||||
<script src="../common.js"></script>
|
||||
<script>
|
||||
/*jslint plusplus: false, strict: false */
|
||||
/*global log: false, dumpLogs: false */
|
||||
//cache bust?
|
||||
var noCache = location.href.indexOf("nocache") !== -1;
|
||||
|
||||
log("noCache: " + noCache);
|
||||
|
||||
var readyRegExp = /complete|loaded/,
|
||||
useInteractive = false,
|
||||
loadedScripts = [],
|
||||
callCount = 0,
|
||||
currentlyAddingScript,
|
||||
waitingFunc, loadUrls,
|
||||
urls = [
|
||||
"one.js",
|
||||
"two.js",
|
||||
"three.js",
|
||||
"four.php",
|
||||
"five.js",
|
||||
"six.php",
|
||||
"seven.js",
|
||||
"eight.js",
|
||||
"nine.js"
|
||||
];
|
||||
|
||||
function report() {
|
||||
var i, module;
|
||||
for (i = 0; i < loadedScripts.length; i++) {
|
||||
module = loadedScripts[i];
|
||||
log("module " + module.name + " === " + module.obj.name);
|
||||
}
|
||||
callCount += 1;
|
||||
//dumpLogs();
|
||||
if (callCount === 1) {
|
||||
log("-------Trying cache hits now--------");
|
||||
loadedScripts = [];
|
||||
setTimeout(loadUrls, 500);
|
||||
}
|
||||
}
|
||||
|
||||
function finishScript(script, func) {
|
||||
if (!script) {
|
||||
return;
|
||||
}
|
||||
|
||||
loadedScripts.push({
|
||||
name: script.getAttribute('data-name').replace(/\.js$/, ''),
|
||||
obj: func()
|
||||
});
|
||||
|
||||
if (loadedScripts.length === 9) {
|
||||
report();
|
||||
}
|
||||
}
|
||||
|
||||
function onTestScriptLoad(evt) {
|
||||
var node = evt.target || evt.srcElement;
|
||||
if (evt.type === "load" || readyRegExp.test(node.readyState)) {
|
||||
if (!useInteractive) {
|
||||
finishScript(node, waitingFunc);
|
||||
}
|
||||
|
||||
//Clean up
|
||||
if (node.removeEventListener) {
|
||||
node.removeEventListener("load", onTestScriptLoad, false);
|
||||
} else {
|
||||
//Probably IE.
|
||||
node.detachEvent("onreadystatechange", onTestScriptLoad);
|
||||
}
|
||||
}
|
||||
}
|
||||
function attachScript(url, name, useDocWrite) {
|
||||
if (noCache) {
|
||||
url += "?stamp=" + (new Date()).getTime();
|
||||
}
|
||||
var node = document.createElement("script");
|
||||
node.src = url;
|
||||
node.type = "text/javascript";
|
||||
node.charset = "utf-8";
|
||||
node.setAttribute("data-name", name);
|
||||
|
||||
//Set up load listener.
|
||||
if (node.addEventListener) {
|
||||
node.addEventListener("load", onTestScriptLoad, false);
|
||||
} else {
|
||||
//Probably IE.
|
||||
useInteractive = true;
|
||||
node.attachEvent("onreadystatechange", onTestScriptLoad);
|
||||
}
|
||||
currentlyAddingScript = node;
|
||||
|
||||
document.getElementsByTagName("head")[0].appendChild(node);
|
||||
currentlyAddingScript = null;
|
||||
}
|
||||
|
||||
loadUrls = function () {
|
||||
for (var i = 0, url; (url = urls[i]); i++) {
|
||||
attachScript(url, url);
|
||||
}
|
||||
};
|
||||
|
||||
function def(func) {
|
||||
var scripts, i, script = currentlyAddingScript;
|
||||
if (useInteractive) {
|
||||
scripts = document.getElementsByTagName('script');
|
||||
var states = [];
|
||||
for (i = scripts.length - 1; i > -1; i--) {
|
||||
states.push(i + scripts[i].readyState + scripts[i].src);
|
||||
//log('script with name ' + scripts[i].getAttribute('data-name') + ' has readyState = ' + scripts[i].readyState + ' for func: ' + func);
|
||||
if (scripts[i].readyState === 'interactive') {
|
||||
script = scripts[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!script) {
|
||||
log("ERROR: No matching script interactive for " + func);
|
||||
log("script readyStates are: " + states);
|
||||
}
|
||||
//log('calling finishScript for interactive dat-name: ' + script.getAttribute('data-name'));
|
||||
finishScript(script, func);
|
||||
} else {
|
||||
waitingFunc = func;
|
||||
}
|
||||
}
|
||||
|
||||
//Do appendChilds
|
||||
loadUrls();
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Script Load Interactive Test (PHP used to delay two scripts)</h1>
|
||||
|
||||
<p>This test checks to see if a function call can be associated with a specific script tag.</p>
|
||||
<p>For non-IE 6-8 browsers, the script onload event may not fire right after the the script
|
||||
is evaluated. Kris Zyp found for IE though that in a function call that is called while the
|
||||
script is executed, it could query the script nodes and the one that is in "interactive" mode
|
||||
indicates the current script.</p>
|
||||
<p>So this test tries to see to use interactive state if possible, and if that does not work,
|
||||
falls back to using script onload to associate the scripts.</p>
|
||||
<p>Check the console for output. Expected result, all scripts are matched up with their calls.</p>
|
||||
</body>
|
||||
</html>
|
||||
153
OfficeWeb/vendor/requirejs/tests/browsertests/scriptloadinteractiveattach/index.html
vendored
Normal file
153
OfficeWeb/vendor/requirejs/tests/browsertests/scriptloadinteractiveattach/index.html
vendored
Normal file
@@ -0,0 +1,153 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Script Load Interactive Test: attachEvent</title>
|
||||
<script src="../common.js"></script>
|
||||
<script>
|
||||
/*jslint plusplus: false, strict: false */
|
||||
/*global log: false, dumpLogs: false */
|
||||
//cache bust?
|
||||
var noCache = location.href.indexOf("nocache") !== -1;
|
||||
|
||||
log("noCache: " + noCache);
|
||||
|
||||
var readyRegExp = /complete|loaded/,
|
||||
useInteractive = false,
|
||||
loadedScripts = [],
|
||||
callCount = 0,
|
||||
currentlyAddingScript,
|
||||
waitingFunc, loadUrls,
|
||||
urls = [
|
||||
"one.js",
|
||||
"two.js",
|
||||
"three.js",
|
||||
"four.js",
|
||||
"five.js",
|
||||
"six.js",
|
||||
"seven.js",
|
||||
"eight.js",
|
||||
"nine.js"
|
||||
];
|
||||
|
||||
function report() {
|
||||
var i, module;
|
||||
for (i = 0; i < loadedScripts.length; i++) {
|
||||
module = loadedScripts[i];
|
||||
log("module " + module.name + " === " + module.obj.name);
|
||||
}
|
||||
callCount += 1;
|
||||
//dumpLogs();
|
||||
if (callCount === 1) {
|
||||
log("-------Trying cache hits now--------");
|
||||
loadedScripts = [];
|
||||
setTimeout(loadUrls, 500);
|
||||
}
|
||||
}
|
||||
|
||||
function finishScript(script, func) {
|
||||
if (!script) {
|
||||
return;
|
||||
}
|
||||
|
||||
loadedScripts.push({
|
||||
name: script.getAttribute('data-name').replace(/\.js$/, ''),
|
||||
obj: func()
|
||||
});
|
||||
|
||||
if (loadedScripts.length === 9) {
|
||||
report();
|
||||
}
|
||||
}
|
||||
|
||||
function onTestScriptLoad(evt) {
|
||||
var node = evt.target || evt.srcElement;
|
||||
if (evt.type === "load" || readyRegExp.test(node.readyState)) {
|
||||
if (!useInteractive) {
|
||||
finishScript(node, waitingFunc);
|
||||
}
|
||||
|
||||
//Clean up
|
||||
if (node.detachEvent) {
|
||||
//Probably IE.
|
||||
node.detachEvent("onreadystatechange", onTestScriptLoad);
|
||||
} else if (node.removeEventListener) {
|
||||
node.removeEventListener("load", onTestScriptLoad, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
function attachScript(url, name, useDocWrite) {
|
||||
if (noCache) {
|
||||
url += "?stamp=" + (new Date()).getTime();
|
||||
}
|
||||
var node = document.createElement("script");
|
||||
node.src = url;
|
||||
node.type = "text/javascript";
|
||||
node.charset = "utf-8";
|
||||
node.setAttribute("data-name", name);
|
||||
|
||||
//Set up load listener.
|
||||
if (node.attachEvent) {
|
||||
//Probably IE.
|
||||
useInteractive = true;
|
||||
node.attachEvent("onreadystatechange", onTestScriptLoad);
|
||||
} else if (node.addEventListener) {
|
||||
node.addEventListener("load", onTestScriptLoad, false);
|
||||
}
|
||||
currentlyAddingScript = node;
|
||||
|
||||
document.getElementsByTagName("head")[0].appendChild(node);
|
||||
currentlyAddingScript = null;
|
||||
}
|
||||
|
||||
loadUrls = function () {
|
||||
for (var i = 0, url; (url = urls[i]); i++) {
|
||||
attachScript(url, url);
|
||||
}
|
||||
};
|
||||
|
||||
function def(func) {
|
||||
var scripts, i, script = currentlyAddingScript;
|
||||
if (useInteractive) {
|
||||
scripts = document.getElementsByTagName('script');
|
||||
var states = [];
|
||||
for (i = scripts.length - 1; i > -1; i--) {
|
||||
states.push(i + scripts[i].readyState + scripts[i].src);
|
||||
//log('script with name ' + scripts[i].getAttribute('data-name') + ' has readyState = ' + scripts[i].readyState + ' for func: ' + func);
|
||||
if (scripts[i].readyState === 'interactive') {
|
||||
script = scripts[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!script) {
|
||||
log("ERROR: No matching script interactive for " + func);
|
||||
log("script readyStates are: " + states);
|
||||
}
|
||||
//log('calling finishScript for interactive dat-name: ' + script.getAttribute('data-name'));
|
||||
finishScript(script, func);
|
||||
} else {
|
||||
waitingFunc = func;
|
||||
}
|
||||
}
|
||||
|
||||
//Do appendChilds
|
||||
loadUrls();
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Script Load Interactive Test: attachEvent</h1>
|
||||
|
||||
<p><b>This test difffers from scriptloadinteractive in that attachEvent is preferred over
|
||||
addEventListener to work around an IE9 issue where its addEventListener behavior does not match
|
||||
all other addEventListener browsers that fire the script onload event right after executing a
|
||||
script (at least before executing any other script).</b></p>
|
||||
<p>This test checks to see if a function call can be associated with a specific script tag.</p>
|
||||
<p>For non-IE 6-8 browsers, the script onload event may not fire right after the the script
|
||||
is evaluated. Kris Zyp found for IE though that in a function call that is called while the
|
||||
script is executed, it could query the script nodes and the one that is in "interactive" mode
|
||||
indicates the current script.</p>
|
||||
<p>So this test tries to see to use interactive state if possible, and if that does not work,
|
||||
falls back to using script onload to associate the scripts.</p>
|
||||
<p>Check the console for output. Expected result, all scripts are matched up with their calls.</p>
|
||||
</body>
|
||||
</html>
|
||||
5
OfficeWeb/vendor/requirejs/tests/browsertests/scriptloadinteractiveattach/nine.js
vendored
Normal file
5
OfficeWeb/vendor/requirejs/tests/browsertests/scriptloadinteractiveattach/nine.js
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
def(function () {
|
||||
return {
|
||||
name: 'nine'
|
||||
};
|
||||
});
|
||||
5
OfficeWeb/vendor/requirejs/tests/browsertests/scriptloadinteractiveattach/one.js
vendored
Normal file
5
OfficeWeb/vendor/requirejs/tests/browsertests/scriptloadinteractiveattach/one.js
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
def(function () {
|
||||
return {
|
||||
name: 'one'
|
||||
};
|
||||
});
|
||||
5
OfficeWeb/vendor/requirejs/tests/browsertests/scriptloadinteractiveattach/seven.js
vendored
Normal file
5
OfficeWeb/vendor/requirejs/tests/browsertests/scriptloadinteractiveattach/seven.js
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
def(function () {
|
||||
return {
|
||||
name: 'seven'
|
||||
};
|
||||
});
|
||||
5
OfficeWeb/vendor/requirejs/tests/browsertests/scriptloadinteractiveattach/six.js
vendored
Normal file
5
OfficeWeb/vendor/requirejs/tests/browsertests/scriptloadinteractiveattach/six.js
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
def(function () {
|
||||
return {
|
||||
name: 'six'
|
||||
};
|
||||
});
|
||||
9
OfficeWeb/vendor/requirejs/tests/browsertests/scriptloadinteractiveattach/six.php
vendored
Normal file
9
OfficeWeb/vendor/requirejs/tests/browsertests/scriptloadinteractiveattach/six.php
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
sleep(2)
|
||||
?>
|
||||
|
||||
def(function () {
|
||||
return {
|
||||
name: 'six'
|
||||
};
|
||||
});
|
||||
5
OfficeWeb/vendor/requirejs/tests/browsertests/scriptloadinteractiveattach/three.js
vendored
Normal file
5
OfficeWeb/vendor/requirejs/tests/browsertests/scriptloadinteractiveattach/three.js
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
def(function () {
|
||||
return {
|
||||
name: 'three'
|
||||
};
|
||||
});
|
||||
5
OfficeWeb/vendor/requirejs/tests/browsertests/scriptloadinteractiveattach/two.js
vendored
Normal file
5
OfficeWeb/vendor/requirejs/tests/browsertests/scriptloadinteractiveattach/two.js
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
def(function () {
|
||||
return {
|
||||
name: 'two'
|
||||
};
|
||||
});
|
||||
9
OfficeWeb/vendor/requirejs/tests/browsertests/vardefine/define.js
vendored
Normal file
9
OfficeWeb/vendor/requirejs/tests/browsertests/vardefine/define.js
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
|
||||
function define(message) {
|
||||
log(message);
|
||||
}
|
||||
|
||||
|
||||
function badDefine(message) {
|
||||
log("BAD DEFINE! " + message);
|
||||
}
|
||||
13
OfficeWeb/vendor/requirejs/tests/browsertests/vardefine/four.js
vendored
Normal file
13
OfficeWeb/vendor/requirejs/tests/browsertests/vardefine/four.js
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
(function () {
|
||||
|
||||
function define(msg) {
|
||||
log('STILL GOOD, inner define: ' + msg);
|
||||
}
|
||||
|
||||
if (typeof define !== 'function') { var define = window.badDefine; }
|
||||
|
||||
define("four.js script");
|
||||
|
||||
|
||||
}());
|
||||
|
||||
47
OfficeWeb/vendor/requirejs/tests/browsertests/vardefine/index.html
vendored
Normal file
47
OfficeWeb/vendor/requirejs/tests/browsertests/vardefine/index.html
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>var define Test</title>
|
||||
<script type="text/javascript" src="../common.js"></script>
|
||||
<script type="text/javascript" src="define.js"></script>
|
||||
<script type="text/javascript">
|
||||
|
||||
var attachScript = function(url, name){
|
||||
var node = document.createElement("script");
|
||||
node.src = url;
|
||||
node.type = "text/javascript";
|
||||
node.charset = "utf-8";
|
||||
node.setAttribute("data-name", name);
|
||||
|
||||
document.getElementsByTagName("head")[0].appendChild(node);
|
||||
}
|
||||
|
||||
var urls = [
|
||||
"one.js",
|
||||
"two.js",
|
||||
"three.js",
|
||||
"four.js"
|
||||
]
|
||||
|
||||
var loadUrls = function() {
|
||||
for (var i = 0, url; url = urls[i]; i++) {
|
||||
attachScript(url, url);
|
||||
}
|
||||
}
|
||||
|
||||
//Do appendChilds
|
||||
loadUrls();
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>var define Test</h1>
|
||||
|
||||
<p>This test checks if doing a var define in a module file is hoisted
|
||||
and if it causes any problems in a way that would shadow the real define.</p>
|
||||
|
||||
<p>Check the console for output</p>
|
||||
|
||||
<p>If you see "BAD DEFINE" in the output, then it means there is a problem,
|
||||
and the real define was shadowed by something else.</p>
|
||||
</body>
|
||||
</html>
|
||||
4
OfficeWeb/vendor/requirejs/tests/browsertests/vardefine/one.js
vendored
Normal file
4
OfficeWeb/vendor/requirejs/tests/browsertests/vardefine/one.js
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
|
||||
if (typeof define !== 'function') { var define = window.badDefine; }
|
||||
|
||||
define("one.js script");
|
||||
3
OfficeWeb/vendor/requirejs/tests/browsertests/vardefine/three.js
vendored
Normal file
3
OfficeWeb/vendor/requirejs/tests/browsertests/vardefine/three.js
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
if (typeof define !== 'function') { var define = window.badDefine; }
|
||||
|
||||
define("three.js script");
|
||||
7
OfficeWeb/vendor/requirejs/tests/browsertests/vardefine/two.js
vendored
Normal file
7
OfficeWeb/vendor/requirejs/tests/browsertests/vardefine/two.js
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
|
||||
if (typeof define !== 'function') { var define = window.badDefine; }
|
||||
|
||||
define("two.js script");
|
||||
setTimeout(function () {
|
||||
define("two.js timeout, expected");
|
||||
}, 13);
|
||||
23
OfficeWeb/vendor/requirejs/tests/bundles/bundles-tests.js
vendored
Normal file
23
OfficeWeb/vendor/requirejs/tests/bundles/bundles-tests.js
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
require({
|
||||
bundles: {
|
||||
'main': ['util', 'main'],
|
||||
'second': ['other'],
|
||||
'third': ['third']
|
||||
}
|
||||
}, ['util', 'other', 'third'], function (util, other, third) {
|
||||
|
||||
require(['main'], function (main) {
|
||||
doh.register(
|
||||
'bundles',
|
||||
[
|
||||
function bundles(t){
|
||||
t.is('util', util.name);
|
||||
t.is('other', other.name);
|
||||
t.is('third', third.name);
|
||||
t.is('main', main.name);
|
||||
}
|
||||
]
|
||||
);
|
||||
doh.run();
|
||||
});
|
||||
});
|
||||
16
OfficeWeb/vendor/requirejs/tests/bundles/bundles.html
vendored
Normal file
16
OfficeWeb/vendor/requirejs/tests/bundles/bundles.html
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>require.js: Bundles Config Test</title>
|
||||
<script type="text/javascript" src="../../require.js"></script>
|
||||
<script type="text/javascript" src="../doh/runner.js"></script>
|
||||
<script type="text/javascript" src="../doh/_browserRunner.js"></script>
|
||||
<script type="text/javascript" src="bundles-tests.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>require.js: Bundles Config Test</h1>
|
||||
<p>Test using the bundles config. More info:
|
||||
<a href="https://github.com/jrburke/requirejs/issues/497">497</a></p>
|
||||
<p>Check console for messages</p>
|
||||
</body>
|
||||
</html>
|
||||
8
OfficeWeb/vendor/requirejs/tests/bundles/main.js
vendored
Normal file
8
OfficeWeb/vendor/requirejs/tests/bundles/main.js
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
define('util', {
|
||||
name: 'util'
|
||||
});
|
||||
|
||||
define('main', {
|
||||
name: 'main'
|
||||
});
|
||||
|
||||
3
OfficeWeb/vendor/requirejs/tests/bundles/second.js
vendored
Normal file
3
OfficeWeb/vendor/requirejs/tests/bundles/second.js
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
define('other', {
|
||||
name: 'other'
|
||||
});
|
||||
3
OfficeWeb/vendor/requirejs/tests/bundles/third.js
vendored
Normal file
3
OfficeWeb/vendor/requirejs/tests/bundles/third.js
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
define('third', {
|
||||
name: 'third'
|
||||
});
|
||||
31
OfficeWeb/vendor/requirejs/tests/circular-tests.js
vendored
Normal file
31
OfficeWeb/vendor/requirejs/tests/circular-tests.js
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
require({
|
||||
baseUrl: "./"
|
||||
},
|
||||
["require", "two", "funcTwo", "funcThree"],
|
||||
function(require, two, funcTwo, funcThree) {
|
||||
var args = two.doSomething();
|
||||
var twoInst = new funcTwo("TWO");
|
||||
doh.register(
|
||||
"circular",
|
||||
[
|
||||
function circular(t) {
|
||||
t.is("small", args.size);
|
||||
t.is("redtwo", args.color);
|
||||
}
|
||||
]
|
||||
);
|
||||
doh.run();
|
||||
|
||||
doh.register(
|
||||
"circularFunc",
|
||||
[
|
||||
function circularFunc(t) {
|
||||
t.is("TWO", twoInst.name);
|
||||
t.is("ONE-NESTED", twoInst.oneName());
|
||||
t.is("THREE-THREE_SUFFIX", funcThree("THREE"));
|
||||
}
|
||||
]
|
||||
);
|
||||
doh.run();
|
||||
}
|
||||
);
|
||||
14
OfficeWeb/vendor/requirejs/tests/circular.html
vendored
Normal file
14
OfficeWeb/vendor/requirejs/tests/circular.html
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>require.js: Circular Test</title>
|
||||
<script type="text/javascript" src="../require.js"></script>
|
||||
<script type="text/javascript" src="doh/runner.js"></script>
|
||||
<script type="text/javascript" src="doh/_browserRunner.js"></script>
|
||||
<script type="text/javascript" src="circular-tests.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>require.js: Circular Test</h1>
|
||||
<p>Check console for messages</p>
|
||||
</body>
|
||||
</html>
|
||||
16
OfficeWeb/vendor/requirejs/tests/circular/414/414-tests.js
vendored
Normal file
16
OfficeWeb/vendor/requirejs/tests/circular/414/414-tests.js
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
require({
|
||||
baseUrl: requirejs.isBrowser ? './' : './circular/414'
|
||||
},
|
||||
["MyClass"],
|
||||
function(MyClass) {
|
||||
doh.register(
|
||||
"circular414",
|
||||
[
|
||||
function circularComplexPlugin(t) {
|
||||
t.is("MyClass,A,B,C:MyClass,A,B,C:MyClass,A,B,C:MyClass,A,B,C", MyClass.sayAll());
|
||||
}
|
||||
]
|
||||
);
|
||||
doh.run();
|
||||
}
|
||||
);
|
||||
20
OfficeWeb/vendor/requirejs/tests/circular/414/414.html
vendored
Normal file
20
OfficeWeb/vendor/requirejs/tests/circular/414/414.html
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>require.js: #414: Multi-cycle Bundle Test</title>
|
||||
<script type="text/javascript" src="../../../require.js"></script>
|
||||
<script type="text/javascript" src="../../doh/runner.js"></script>
|
||||
<script type="text/javascript" src="../../doh/_browserRunner.js"></script>
|
||||
<script type="text/javascript" src="414-tests.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>#414: Multi-cycle Bundle Test</h1>
|
||||
|
||||
<p>A set of modules have multiple cycles in them, but the require() that
|
||||
uses the top module in that bundle should get a fully constructed
|
||||
module set.<a href="https://github.com/jrburke/requirejs/issues/414">More info</a>.</p>
|
||||
|
||||
<p>Check console for messages</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
19
OfficeWeb/vendor/requirejs/tests/circular/414/A.js
vendored
Normal file
19
OfficeWeb/vendor/requirejs/tests/circular/414/A.js
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
define(
|
||||
[
|
||||
"exports",
|
||||
"./MyClass",
|
||||
"./B",
|
||||
"./C"
|
||||
],
|
||||
|
||||
function (exports, MyClass, B, C) {
|
||||
|
||||
exports.name = "A";
|
||||
|
||||
exports.say = function(){
|
||||
return [MyClass.name, exports.name, B.name, C.name].join(',');
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
);
|
||||
19
OfficeWeb/vendor/requirejs/tests/circular/414/B.js
vendored
Normal file
19
OfficeWeb/vendor/requirejs/tests/circular/414/B.js
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
define(
|
||||
[
|
||||
"exports",
|
||||
"./MyClass",
|
||||
"./A",
|
||||
"./C"
|
||||
],
|
||||
|
||||
function (exports, MyClass, A, C) {
|
||||
|
||||
exports.name = "B";
|
||||
|
||||
exports.say = function(){
|
||||
return [MyClass.name, A.name, exports.name, C.name].join(',');
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
);
|
||||
20
OfficeWeb/vendor/requirejs/tests/circular/414/C.js
vendored
Normal file
20
OfficeWeb/vendor/requirejs/tests/circular/414/C.js
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
define(
|
||||
[
|
||||
"exports",
|
||||
"./MyClass",
|
||||
"./A",
|
||||
"./B"
|
||||
],
|
||||
|
||||
function (exports, MyClass, A, B) {
|
||||
|
||||
exports.name = "C";
|
||||
|
||||
exports.say = function(){
|
||||
return [MyClass.name, A.name, B.name, exports.name].join(',');
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
);
|
||||
|
||||
30
OfficeWeb/vendor/requirejs/tests/circular/414/MyClass.js
vendored
Normal file
30
OfficeWeb/vendor/requirejs/tests/circular/414/MyClass.js
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
define(
|
||||
[
|
||||
"exports",
|
||||
"./A",
|
||||
"./B",
|
||||
"./C"
|
||||
],
|
||||
|
||||
function (exports, A, B, C) {
|
||||
|
||||
exports.name = "MyClass";
|
||||
|
||||
exports.sayAll = function(){
|
||||
return [
|
||||
exports.say(),
|
||||
A.say(),
|
||||
B.say(),
|
||||
C.say()
|
||||
].join(':');
|
||||
};
|
||||
|
||||
exports.say = function(){
|
||||
return [exports.name, A.name, B.name, C.name].join(',');
|
||||
};
|
||||
|
||||
return exports;
|
||||
|
||||
}
|
||||
|
||||
);
|
||||
4
OfficeWeb/vendor/requirejs/tests/circular/a.js
vendored
Normal file
4
OfficeWeb/vendor/requirejs/tests/circular/a.js
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
define(['b', 'exports'], function (b, exports) {
|
||||
exports.name = 'a';
|
||||
exports.b = b;
|
||||
});
|
||||
4
OfficeWeb/vendor/requirejs/tests/circular/b.js
vendored
Normal file
4
OfficeWeb/vendor/requirejs/tests/circular/b.js
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
define(['c', 'exports'], function (c, exports) {
|
||||
exports.name = 'b';
|
||||
exports.c = c;
|
||||
});
|
||||
4
OfficeWeb/vendor/requirejs/tests/circular/c.js
vendored
Normal file
4
OfficeWeb/vendor/requirejs/tests/circular/c.js
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
define(['a', 'exports'], function (a, exports) {
|
||||
exports.name = 'c';
|
||||
exports.a = a;
|
||||
});
|
||||
18
OfficeWeb/vendor/requirejs/tests/circular/circularPlugin-tests.js
vendored
Normal file
18
OfficeWeb/vendor/requirejs/tests/circular/circularPlugin-tests.js
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
require({
|
||||
baseUrl: requirejs.isBrowser ? './' : './circular'
|
||||
},
|
||||
["require", "plugin!a"],
|
||||
function(require, a) {
|
||||
doh.register(
|
||||
"circularPlugin",
|
||||
[
|
||||
function circularPlugin(t) {
|
||||
t.is("a", a.name);
|
||||
t.is("b", a.b.name);
|
||||
t.is("c", a.b.c.name);
|
||||
}
|
||||
]
|
||||
);
|
||||
doh.run();
|
||||
}
|
||||
);
|
||||
19
OfficeWeb/vendor/requirejs/tests/circular/circularPlugin.html
vendored
Normal file
19
OfficeWeb/vendor/requirejs/tests/circular/circularPlugin.html
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>require.js: Circular Dependency under Plugin Test</title>
|
||||
<script type="text/javascript" src="../../require.js"></script>
|
||||
<script type="text/javascript" src="../doh/runner.js"></script>
|
||||
<script type="text/javascript" src="../doh/_browserRunner.js"></script>
|
||||
<script type="text/javascript" src="circularPlugin-tests.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>require.js: Circular Dependency under Plugin Test</h1>
|
||||
|
||||
<p>Tests if a plugin that depends on a module with a circular dependency,
|
||||
does the plugin get stuck as unresolved? In particular, can cycles be
|
||||
broken when a plugin resource depedency is not loaded = true.</p>
|
||||
|
||||
<p>Check console for messages</p>
|
||||
</body>
|
||||
</html>
|
||||
21
OfficeWeb/vendor/requirejs/tests/circular/complexPlugin/complexPlugin-tests.js
vendored
Normal file
21
OfficeWeb/vendor/requirejs/tests/circular/complexPlugin/complexPlugin-tests.js
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
require({
|
||||
baseUrl: requirejs.isBrowser ? './' : './circular/complexPlugin'
|
||||
},
|
||||
["require", "main"],
|
||||
function(require, main) {
|
||||
doh.register(
|
||||
"circularComplexPlugin",
|
||||
[
|
||||
function circularComplexPlugin(t) {
|
||||
t.is("main", main.name);
|
||||
t.is('viewport', main.viewport.name);
|
||||
t.is('viewportTemplate', main.viewport.template);
|
||||
t.is('toolbar', main.viewport.toolbar.name);
|
||||
t.is('toolbarTemplate', main.viewport.toolbar.template);
|
||||
t.is('helper', main.helper.name);
|
||||
}
|
||||
]
|
||||
);
|
||||
doh.run();
|
||||
}
|
||||
);
|
||||
20
OfficeWeb/vendor/requirejs/tests/circular/complexPlugin/complexPlugin.html
vendored
Normal file
20
OfficeWeb/vendor/requirejs/tests/circular/complexPlugin/complexPlugin.html
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>require.js: Complex Circular Dependency under Plugin Test</title>
|
||||
<script type="text/javascript" src="../../../require.js"></script>
|
||||
<script type="text/javascript" src="../../doh/runner.js"></script>
|
||||
<script type="text/javascript" src="../../doh/_browserRunner.js"></script>
|
||||
<script type="text/javascript" src="complexPlugin-tests.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>require.js: Complex Circular Dependency under Plugin Test</h1>
|
||||
|
||||
<p>Complex test of plugins where some modules have a circular dependency.</p>
|
||||
|
||||
<p>Check console for messages</p>
|
||||
|
||||
<div class="content"></div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
6
OfficeWeb/vendor/requirejs/tests/circular/complexPlugin/helper.js
vendored
Normal file
6
OfficeWeb/vendor/requirejs/tests/circular/complexPlugin/helper.js
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
define(function (require, exports) {
|
||||
//Create circular dependency here
|
||||
var main = require('main');
|
||||
|
||||
exports.name = 'helper';
|
||||
});
|
||||
6
OfficeWeb/vendor/requirejs/tests/circular/complexPlugin/main.js
vendored
Normal file
6
OfficeWeb/vendor/requirejs/tests/circular/complexPlugin/main.js
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
define(['exports', 'viewport', 'helper'], function (exports, viewport, helper) {
|
||||
|
||||
exports.name = 'main';
|
||||
exports.viewport = viewport;
|
||||
exports.helper = helper;
|
||||
});
|
||||
289
OfficeWeb/vendor/requirejs/tests/circular/complexPlugin/slowText.js
vendored
Normal file
289
OfficeWeb/vendor/requirejs/tests/circular/complexPlugin/slowText.js
vendored
Normal file
@@ -0,0 +1,289 @@
|
||||
//Like text.js but does a setTimeout before returning a value, to simulate
|
||||
//slow template fetching.
|
||||
|
||||
/**
|
||||
* @license RequireJS text 1.0.2 Copyright (c) 2010-2011, The Dojo Foundation All Rights Reserved.
|
||||
* Available via the MIT or new BSD license.
|
||||
* see: http://github.com/jrburke/requirejs for details
|
||||
*/
|
||||
/*jslint regexp: false, nomen: false, plusplus: false, strict: false */
|
||||
/*global require: false, XMLHttpRequest: false, ActiveXObject: false,
|
||||
define: false, window: false, process: false, Packages: false,
|
||||
java: false, location: false, setTimeout */
|
||||
|
||||
(function () {
|
||||
var 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 = [];
|
||||
|
||||
define(function () {
|
||||
var text, get, fs;
|
||||
|
||||
if (typeof window !== "undefined" && window.navigator && window.document) {
|
||||
get = function (url, callback) {
|
||||
var xhr = text.createXhr();
|
||||
xhr.open('GET', url, true);
|
||||
xhr.onreadystatechange = function (evt) {
|
||||
//Do not explicitly handle errors, those should be
|
||||
//visible via console output in the browser.
|
||||
if (xhr.readyState === 4) {
|
||||
callback(xhr.responseText);
|
||||
}
|
||||
};
|
||||
xhr.send(null);
|
||||
};
|
||||
} else if (typeof process !== "undefined" &&
|
||||
process.versions &&
|
||||
!!process.versions.node) {
|
||||
//Using special require.nodeRequire, something added by r.js.
|
||||
fs = require.nodeRequire('fs');
|
||||
|
||||
get = function (url, callback) {
|
||||
callback(fs.readFileSync(url, 'utf8'));
|
||||
};
|
||||
} else if (typeof Packages !== 'undefined') {
|
||||
//Why Java, why is this so awkward?
|
||||
get = function (url, callback) {
|
||||
var 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)),
|
||||
stringBuffer, line,
|
||||
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);
|
||||
}
|
||||
|
||||
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);
|
||||
};
|
||||
}
|
||||
|
||||
text = {
|
||||
version: '1.0.2',
|
||||
|
||||
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");
|
||||
},
|
||||
|
||||
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 {
|
||||
for (i = 0; i < 3; i++) {
|
||||
progId = progIds[i];
|
||||
try {
|
||||
xhr = new ActiveXObject(progId);
|
||||
} catch (e) {}
|
||||
|
||||
if (xhr) {
|
||||
progIds = [progId]; // so faster next time
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!xhr) {
|
||||
throw new Error("createXhr(): XMLHttpRequest not available");
|
||||
}
|
||||
|
||||
return xhr;
|
||||
},
|
||||
|
||||
get: get,
|
||||
|
||||
/**
|
||||
* 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 strip = false, index = name.indexOf("."),
|
||||
modName = name.substring(0, index),
|
||||
ext = name.substring(index + 1, name.length);
|
||||
|
||||
index = ext.indexOf("!");
|
||||
if (index !== -1) {
|
||||
//Pull off the strip arg.
|
||||
strip = ext.substring(index + 1, ext.length);
|
||||
strip = strip === "strip";
|
||||
ext = ext.substring(0, index);
|
||||
}
|
||||
|
||||
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 match = text.xdRegExp.exec(url),
|
||||
uProtocol, uHostName, uPort;
|
||||
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 === hostname) &&
|
||||
((!uPort && !uHostName) || uPort === port);
|
||||
},
|
||||
|
||||
finishLoad: function (name, strip, content, onLoad, config) {
|
||||
content = strip ? text.strip(content) : content;
|
||||
if (config.isBuild) {
|
||||
buildMap[name] = content;
|
||||
}
|
||||
|
||||
setTimeout(function () {
|
||||
onLoad(content);
|
||||
}, 500);
|
||||
},
|
||||
|
||||
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.isBuild && !config.inlineText) {
|
||||
onLoad();
|
||||
return;
|
||||
}
|
||||
|
||||
var parsed = text.parseName(name),
|
||||
nonStripName = parsed.moduleName + '.' + parsed.ext,
|
||||
url = req.toUrl(nonStripName),
|
||||
useXhr = (config && config.text && config.text.useXhr) ||
|
||||
text.useXhr;
|
||||
|
||||
//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, config);
|
||||
});
|
||||
} 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, config);
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
write: function (pluginName, moduleName, write, config) {
|
||||
if (moduleName in buildMap) {
|
||||
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),
|
||||
nonStripName = parsed.moduleName + '.' + parsed.ext,
|
||||
//Use a '.js' file name so that it indicates it is a
|
||||
//script that can be loaded across domains.
|
||||
fileName = req.toUrl(parsed.moduleName + '.' +
|
||||
parsed.ext) + '.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);
|
||||
}
|
||||
};
|
||||
|
||||
return text;
|
||||
});
|
||||
}());
|
||||
1
OfficeWeb/vendor/requirejs/tests/circular/complexPlugin/toolbar.html
vendored
Normal file
1
OfficeWeb/vendor/requirejs/tests/circular/complexPlugin/toolbar.html
vendored
Normal file
@@ -0,0 +1 @@
|
||||
toolbarTemplate
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user