diff options
author | hwc487 | 2012-06-13 14:04:09 -0700 |
---|---|---|
committer | hwc487 | 2012-06-13 14:04:09 -0700 |
commit | 3e481dd581e0305dd8b572ed0d17e86622223464 (patch) | |
tree | aca2b28aa72857a52e047fb94090c34ab8dd1c2c /node_modules/montage/montage.js | |
parent | a7aa51e6b91623772eef54b827616432838b560e (diff) | |
parent | 682f4917d6badd105998c3dd84d031c38b51f017 (diff) | |
download | ninja-3e481dd581e0305dd8b572ed0d17e86622223464.tar.gz |
Merge branch 'master' of github.com:Motorola-Mobility/ninja-internal into Textures
Diffstat (limited to 'node_modules/montage/montage.js')
-rwxr-xr-x | node_modules/montage/montage.js | 20 |
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 | }; |