Tuesday, March 6, 2012

Re: Fix or workaround for GWT's incompatibility with XHTML?


On Monday, March 5, 2012 7:15:34 PM UTC+1, Philip Fearon wrote:
This issue is with the GWT-generated bootstrap JavaScript file which uses document.write() to inject the GWT-compiled JavaScript into the host HTML page. This method renders XHTML invalid and therefore prevents further processing of the page.
 
It seems that there is a reliable manual method for rewriting this file to use either insertBefore() or insertAfter() - but I'm not yet sure how easy this would be to automate in our build process. Are there any known fixes or workarounds for this issue yet?

AFAIK, GWT uses document.write() because it ensures the written <script>s execute in order. insertBefore/insertAfter, just like an appendChild or innerHTML give no such guarantee. I believe the xsiframe linker solves this issue (by failing when there are <script> in your *.gwt.xml) and does not use document.write() (it uses one to write within the iframe where the GWT code is "installed", but that's all); not sure it could be used in XHTML though.

That being said, XHTML is great from a production-pipeline perspective, but on the web you should strictly stick to serving text/html (and more particularly *not* conditionally serving the same file as text/html or application/xhtml+XML; see http://hixie.ch/advocacy/xhtml ); and that'd solve your problem at the same time.

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

No comments:

Post a Comment