(moving to dev list)
On 16.03.2007 14:58, Jason Johnston wrote:
Another option might be to wrap the contents of <script> elements
within a CDATA section so the JS could remain unencoded but it would
still result in well-formed XML. I'm not sure how some browsers
would handle the CDATA delimiters so they might have to be commented
out so they're not mistaken for script code:
<script type="text/javascript">/*<![CDATA[*/
while(0 < 1 && true) alert("oops");
/*]]>*/</script>
Actually I don't like it. From an XML POV the above and the current
solution are
absolutely equal. What we are going to do with such a fix is to fix
awkward
browser behaviour or even wrong document contents.
I understand what you're saying; it definitely creates uglier content.
But in terms of fixing browser behavior, we actually already have logic
in place that does just that by preventing collapsing of <script />
tags. From an XML point of view <script/> and <script></script> are
also equal, but we force the latter simply because browsers handle it
better. I don't see this situation as any different.
To be honest I'm quite intolerant in this regard: I would even remove
this code. It's an all or nothing decision - where you probably can't
reach all.
What's actually happening? People want to use XHTML because it's cool,
in or state of the art, but they have to support browsers that don't
handle XHTML correctly or they break it themselves by not providing the
XHTML correctly and forcing the browsers into the quirks mode.
Then we get 20 bug reports for 10 issues in special cases because not
all quirks have been addressed yet. And we complicate our code base more
and more. Just have a look at XHTMLSerializer commits [1]: special tags
handling, omit-xml-declaration and now the not-to-be-escaped characters.
And what for at the end? That something formerly known as XHTML can be
understood by the browsers in quirks mode and gets parsed as tag soup again.
But why not staying with HTML then??? Why is the XHTMLSerializer be used
in those cases? IMO we should NOT implement any special case handling in
XHTMLSerializer but tell the people to use the HTMLSerializer.
Jörg
[1]
http://svn.apache.org/viewvc/cocoon/branches/BRANCH_2_1_X/src/blocks/serializers/java/org/apache/cocoon/components/serializers/XHTMLSerializer.java