chris.dou
...@gmail.com wrote:
> I thought E4X might be useful to generate HTML or XHTML pages but I've
> struck a small problem involving the <SCRIPT> tag and was wondering if
> anyone could offer suggestions or a workaround.
> Most browsers seem to want the SCRIPT tag to have an explicit closing
> tag:
> <script type="text/javascript" src="somefile.js"></script>
> E4X will generate this as <script type="text/javascript"
> src="somefile.js"/> which gets ignored by some browsers.
Don't generate XHTML and send it to browsers that do not understand
XHTML. If you send XHTML written according to XML rules to browsers like
IE which only understand HTML parsed as text/html then you are in
trouble. That is why the XHTML 1.0 specification does not only specify
the XHTML rules but also has an appendix on how to author XHTML in a way
to be backwards compatibe with text/html user agents. I don't think E4X
has any mode to support that appendix so it is not suitable to generate
HTML.
--
Martin Honnen
http://JavaScript.FAQTs.com/