diff options
Diffstat (limited to 'node_modules/montage/ui/loader.reel/loader.js')
-rwxr-xr-x | node_modules/montage/ui/loader.reel/loader.js | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/node_modules/montage/ui/loader.reel/loader.js b/node_modules/montage/ui/loader.reel/loader.js index 921c3781..2ff0e42c 100755 --- a/node_modules/montage/ui/loader.reel/loader.js +++ b/node_modules/montage/ui/loader.reel/loader.js | |||
@@ -222,7 +222,9 @@ exports.Loader = Montage.create(Component, /** @lends module:montage/ui/loader.L | |||
222 | logger.debug(this, "templateDidLoad"); | 222 | logger.debug(this, "templateDidLoad"); |
223 | } | 223 | } |
224 | 224 | ||
225 | this.element = document.documentElement; | 225 | if (!this.element) { |
226 | this.element = document.documentElement; | ||
227 | } | ||
226 | this.readyToShowLoader = true; | 228 | this.readyToShowLoader = true; |
227 | 229 | ||
228 | var timing = document._montageTiming, | 230 | var timing = document._montageTiming, |
@@ -348,7 +350,8 @@ exports.Loader = Montage.create(Component, /** @lends module:montage/ui/loader.L | |||
348 | 350 | ||
349 | childComponentWillPrepareForDraw: { | 351 | childComponentWillPrepareForDraw: { |
350 | value: function(child) { | 352 | value: function(child) { |
351 | var self = this; | 353 | var self = this, |
354 | insertionElement; | ||
352 | 355 | ||
353 | // if the mainComponent is ready to draw... | 356 | // if the mainComponent is ready to draw... |
354 | if (child === this._mainComponent) { | 357 | if (child === this._mainComponent) { |
@@ -360,11 +363,15 @@ exports.Loader = Montage.create(Component, /** @lends module:montage/ui/loader.L | |||
360 | 363 | ||
361 | // Determine old content | 364 | // Determine old content |
362 | this._contentToRemove = document.createRange(); | 365 | this._contentToRemove = document.createRange(); |
363 | this._contentToRemove.selectNodeContents(document.body); | 366 | |
367 | // If installing classnames on the documentElement (to affect as high a level as possible) | ||
368 | // make sure content only ends up inside the body | ||
369 | insertionElement = this.element === document.documentElement ? document.body : this.element; | ||
370 | this._contentToRemove.selectNodeContents(insertionElement); | ||
364 | 371 | ||
365 | // Add new content so mainComponent can actually draw | 372 | // Add new content so mainComponent can actually draw |
366 | this.childComponents = [this._mainComponent]; | 373 | this.childComponents = [this._mainComponent]; |
367 | document.body.appendChild(this._mainComponent.element); | 374 | insertionElement.appendChild(this._mainComponent.element); |
368 | 375 | ||
369 | var startBootstrappingTimeout = document[bootstrappingTimeoutPropertyName], | 376 | var startBootstrappingTimeout = document[bootstrappingTimeoutPropertyName], |
370 | timing = document._montageTiming, | 377 | timing = document._montageTiming, |