aboutsummaryrefslogtreecommitdiff
path: root/node_modules/montage/montage.js
diff options
context:
space:
mode:
authorJose Antonio Marquez2012-06-13 14:03:00 -0700
committerJose Antonio Marquez2012-06-13 14:03:00 -0700
commitefbe5f83157a8dcbcc209c88877d9cd0113d4d20 (patch)
tree50565e097fe4a9db59e554af179f66938fa59f1c /node_modules/montage/montage.js
parentae90152ae2889a10d44c22e1eeb5bff16cc44a19 (diff)
parent682f4917d6badd105998c3dd84d031c38b51f017 (diff)
downloadninja-efbe5f83157a8dcbcc209c88877d9cd0113d4d20.tar.gz
Merge branch 'refs/heads/Ninja-Internal' into Color
Diffstat (limited to 'node_modules/montage/montage.js')
-rwxr-xr-xnode_modules/montage/montage.js20
1 files changed, 15 insertions, 5 deletions
diff --git a/node_modules/montage/montage.js b/node_modules/montage/montage.js
index a174f50b..c669f3f1 100755
--- a/node_modules/montage/montage.js
+++ b/node_modules/montage/montage.js
@@ -108,8 +108,8 @@ if (typeof window !== "undefined") {
108 108
109 if ('autoPackage' in params) { 109 if ('autoPackage' in params) {
110 montageRequire.injectPackageDescription(location, { 110 montageRequire.injectPackageDescription(location, {
111 mappings: { 111 dependencies: {
112 montage: "@" 112 montage: "*"
113 } 113 }
114 }); 114 });
115 } 115 }
@@ -237,11 +237,18 @@ if (typeof window !== "undefined") {
237 }; 237 };
238 238
239 var urlModuleFactory = function (require, exports) { 239 var urlModuleFactory = function (require, exports) {
240 var baseElement = document.createElement("base"); 240 var baseElement = document.querySelector("base");
241 baseElement.href = ""; 241 var existingBaseElement = baseElement;
242 document.querySelector("head").appendChild(baseElement); 242 if (!existingBaseElement) {
243 baseElement = document.createElement("base");
244 baseElement.href = "";
245 }
246 var head = document.querySelector("head");
243 var relativeElement = document.createElement("a"); 247 var relativeElement = document.createElement("a");
244 exports.resolve = function (base, relative) { 248 exports.resolve = function (base, relative) {
249 if (!existingBaseElement) {
250 head.appendChild(baseElement);
251 }
245 base = String(base); 252 base = String(base);
246 if (!/^[\w\-]+:/.test(base)) { // isAbsolute(base) 253 if (!/^[\w\-]+:/.test(base)) { // isAbsolute(base)
247 throw new Error("Can't resolve from a relative location: " + JSON.stringify(base) + " " + JSON.stringify(relative)); 254 throw new Error("Can't resolve from a relative location: " + JSON.stringify(base) + " " + JSON.stringify(relative));
@@ -251,6 +258,9 @@ if (typeof window !== "undefined") {
251 relativeElement.href = relative; 258 relativeElement.href = relative;
252 var resolved = relativeElement.href; 259 var resolved = relativeElement.href;
253 baseElement.href = restore; 260 baseElement.href = restore;
261 if (!existingBaseElement) {
262 head.removeChild(baseElement);
263 }
254 return resolved; 264 return resolved;
255 }; 265 };
256 }; 266 };