[gwt-contrib] Remove document.write() from GWT where possible

2023-06-28 Thread Michael Borcherds
Hi everyone!

It would be great if someone could check this out:
https://github.com/gwtproject/gwt/pull/9836

... and hopefully it could be useful for someone else too :)

cheers,

Mike

--
Michael Borcherds
CTO | GeoGebra
mich...@geogebra.org

-- 
You received this message because you are subscribed to the Google Groups "GWT 
Contributors" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit-contributors+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-web-toolkit-contributors/CAGTnbEfwJU-J7oOzi5EuXg5Zsn4%2BFHcFt0fz8sDepprWZH79ig%40mail.gmail.com.


[gwt-contrib] [google-web-toolkit] r9696 committed - Get rid of document.write option since it can break in some edge cases...

2011-02-08 Thread codesite-noreply

Revision: 9696
Author: unn...@google.com
Date: Tue Feb  8 09:31:49 2011
Log: 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

http://code.google.com/p/google-web-toolkit/source/detail?r=9696

Modified:
  
/trunk/dev/core/src/com/google/gwt/core/ext/linker/impl/installScriptEarlyDownload.js
  
/trunk/dev/core/src/com/google/gwt/core/ext/linker/impl/loadExternalStylesheets.js


===
---  
/trunk/dev/core/src/com/google/gwt/core/ext/linker/impl/installScriptEarlyDownload.js	 
Tue Nov 16 10:12:20 2010
+++  
/trunk/dev/core/src/com/google/gwt/core/ext/linker/impl/installScriptEarlyDownload.js	 
Tue Feb  8 09:31:49 2011

@@ -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);
+}
===
---  
/trunk/dev/core/src/com/google/gwt/core/ext/linker/impl/loadExternalStylesheets.js	 
Wed Oct 27 13:37:45 2010
+++  
/trunk/dev/core/src/com/google/gwt/core/ext/linker/impl/loadExternalStylesheets.js	 
Tue Feb  8 09:31:49 2011

@@ -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;
 }
   }

--
http://groups.google.com/group/Google-Web-Toolkit-Contributors


document.write in safari

2009-11-30 Thread lflobo
Hi!

Don't know if this is the right place to ask, but either way I'll
ask :)

I've managed to embed a gwt page in a jsf+facelets page, it all works
fine with firefox/opera/ie but the gwt part of the page simply doesn't
load with chrome/safari (webkit related I suppose).
I tried to catch the error by surrounding the call to the entry point
with try/catch and the error is:

TypeError: Object #a Document has no method 'write'

I think the code that triggers the error is a $doc.write(...) call
(where $doc = document;).

Strangest thing is, if I save the page as plain HTML and load it into
a browser, it works out of the box, but when it's rendered in the
server it fails with the referred error.

I'm posting with the hope someone else had this problem.

Regards,
LL

--

You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To post to this group, send email to google-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.




cross-site bootstrap using document.write to inject application

2009-10-23 Thread John O'Conner

I noticed that the xs bootstrap for GWT apps uses document.write to
insert the application's deferred binding js files.

Our application is designed to load AFTER our customer's page has
loaded...we put our app's js script tag at the very bottom of the
customer's body element on their page. I was told that at this point
after the document has loaded that it is bad practice to then use
document.write to inject new scripts because the document reloads. Is
that true, and if so, how do I get GWT to inject the deferred binding
JS with a script tag instead of using document.write to write the
script into the document?

Regards,
John O.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To post to this group, send email to google-web-toolkit@googlegroups.com
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en
-~--~~~~--~~--~--~---



Re: document.write

2009-07-07 Thread Fred Sauer
giovaneoceano,
By default GWT is loaded in an IFRAME so that 'document' refers to the
IFRAME,

You may want to use '$doc' instead of document, although document.write() is
unlikely to be what you want.

Fred


On Mon, Jul 6, 2009 at 6:29 AM, giovaneoce...@hotmail.com 
giovaneoce...@hotmail.com wrote:


 why if i invoke the following javascript function it doesn't work?

 private static native void display()
/*-{
document.write('!--#echo var=REMOTE_ADDR--');

}-*/;

 



-- 
Fred Sauer
f...@allen-sauer.com

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To post to this group, send email to Google-Web-Toolkit@googlegroups.com
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~--~~~~--~~--~--~---



document.write

2009-07-06 Thread giovaneoce...@hotmail.com

why if i invoke the following javascript function it doesn't work?

private static native void display()
/*-{
document.write('!--#echo var=REMOTE_ADDR--');

}-*/;

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To post to this group, send email to Google-Web-Toolkit@googlegroups.com
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~--~~~~--~~--~--~---