You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What steps will reproduce the problem?
1. Include Javascript with CDATA in HTML Document (Style 2, see coming text)
2. Compress HTML Document with Html Compressor
3. Javascript is not compressed
What version of the product are you using? 0.9
Hi there,
according to the W3C xHTML Specification (http://www.w3.org/TR/xhtml1/ ,
section 4.8) Javascript should be put into cdata to validate successfully:
<script type="text/javascript">
<![CDATA[
... unescaped script content ...
]]>
</script>
To avoid confusing older browsers the cdata tags are often put into
comments like:
Style 1:
<script type="text/javascript">
/* <![CDATA[ */
... unescaped script content ...
/* ]]> */
</script>
or
Style2:
<script type="text/javascript">
//<![CDATA[
... unescaped script content ...
//]]>
</script>
It would be very nice for htmlcompressor to adhere script put into cdata.
Original issue reported on code.google.com by werner.g...@gmail.com on 6 Feb 2010 at 11:32
The text was updated successfully, but these errors were encountered:
Fixed in 0.9.1, but partially.
What's fixed is if JS block is wrapped with CDATA then it will be compressed
correctly. But if CDATA is put inside comments (for older browsers) those
comments
will be treated as regular comments and removed by YUI. I can't solve this
properly
without writing JS parser, so if you want to keep browser compatibility and
CDATA,
then a workaround would be either disabling inline JS compression all together
or
putting inline JS into external files.
Style tags wrapped in CDATA blocks were handled by YUI correctly already, but
again
if you put CDATA inside comment they will be removed. Maybe this feature should
be
handled on YUI compressor side better.
Thanks.
Original comment by serg472@gmail.com on 6 Feb 2010 at 6:47
Original issue reported on code.google.com by
werner.g...@gmail.com
on 6 Feb 2010 at 11:32The text was updated successfully, but these errors were encountered: