Get rid of document.write option since it can break in some edge cases and isn't
actually necessary. I believe that I originally thought it was needed because I
was appending to the body rather than the head and therefore seeing some cases
where this broke. However, I believe that this is safe because the nocache.js
will be requested from either:
A - the document body - In this case, the head tag should be completely loaded
B - the document head - In this case, the script tag should always be a direct
descendant of the head tag, and it should be allowed to modify it's immediate
parent, even if the parent is not full loaded
git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@9696 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/dev/core/src/com/google/gwt/core/ext/linker/impl/installScriptEarlyDownload.js b/dev/core/src/com/google/gwt/core/ext/linker/impl/installScriptEarlyDownload.js
index b9beb44..fcf0277 100644
--- a/dev/core/src/com/google/gwt/core/ext/linker/impl/installScriptEarlyDownload.js
+++ b/dev/core/src/com/google/gwt/core/ext/linker/impl/installScriptEarlyDownload.js
@@ -29,17 +29,7 @@
});
};
sendStats('moduleStartup', 'moduleRequested');
- if (isBodyLoaded()) {
- // if the body is loaded, then the tag to download the script can be added
- // in a non-destructive manner
- var script = $doc.createElement('script');
- script.src = filename;
- $doc.getElementsByTagName('head')[0].appendChild(script);
- } else {
- // if the doc has not yet loaded, go ahead and do a destructive
- // document.write since we want to immediately start the download.
- // Note that we cannot append an element to the doc if it is still loading
- // since this would cause problems in IE.
- $doc.write("<script src='" + filename + "'></scr" + "ipt>");
- }
+ var script = $doc.createElement('script');
+ script.src = filename;
+ $doc.getElementsByTagName('head')[0].appendChild(script);
}
diff --git a/dev/core/src/com/google/gwt/core/ext/linker/impl/loadExternalStylesheets.js b/dev/core/src/com/google/gwt/core/ext/linker/impl/loadExternalStylesheets.js
index 8935924..7778f3c 100644
--- a/dev/core/src/com/google/gwt/core/ext/linker/impl/loadExternalStylesheets.js
+++ b/dev/core/src/com/google/gwt/core/ext/linker/impl/loadExternalStylesheets.js
@@ -6,14 +6,10 @@
function installOneStylesheet(stylesheetUrl, hrefExpr) {
if (!__gwt_stylesLoaded[stylesheetUrl]) {
- if (isBodyLoaded()) {
- var l = $doc.createElement('link');
- l.setAttribute('rel', 'stylesheet');
- l.setAttribute('href', hrefExpr);
- $doc.getElementsByTagName('head')[0].appendChild(l);
- } else {
- $doc.write("<link id='' rel='stylesheet' href='" + hrefExpr + "'></li" + "nk>");
- }
+ var l = $doc.createElement('link');
+ l.setAttribute('rel', 'stylesheet');
+ l.setAttribute('href', hrefExpr);
+ $doc.getElementsByTagName('head')[0].appendChild(l);
__gwt_stylesLoaded[stylesheetUrl] = true;
}
}