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.
Is it possible to force the generation of the closing tag? Or get E4X
to print it's output in compatible HTML instead of XML?
Chris.
--
http://www.bluishcoder.co.nz
> 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/
mypage = <html>
<head>
<title>HTML using E4X</title>
<script type="text/javascript" src="somefile.js">/* */</script>
</head>
<body>HTML using E4X with a script tag
</body>
</html>
or till https://bugzilla.mozilla.org/show_bug.cgi?id=337018
fixed you can use, (a space between script tag)
mypage = <html>
<head>
<title>HTML using E4X</title>
<script type="text/javascript" src="somefile.js"> </script>
</head>
<body>HTML using E4X with a script tag
</body>
</html>