The Haml 2.2.1 :javascript filter is broken with options[:escape_html]
turned on. If you use a #{} interpolation in the content, the whole
thing is HTML-escaped. This is unnecessary because the script is in
CDATA anyway. Well, actually, in 2.2.1 it's escaping the CDATA escape!

Here's a failing unit test for test_escape_html (engine_test.rb). The
filter test doesn't seem to care about escape_html so this is the
easiest place to add it...

    js_html = <<HTML
<script type='text/javascript'>
  //<![CDATA[
    & < > &
  //]]>
</script>
HTML

    assert_equal(js_html, render(<<HAML, :escape_html => true))
:javascript
  & < > \#{"&"}
HAML
  end

Result in 2.2.1:
  1) Failure:
test_escape_html(EngineTest) [haml/engine_test.rb:430]:
<"<script type='text/javascript'>\n  //<![CDATA[\n    & < > &\n  //]]>
\n</script>\n"> expected but was
<"&lt;script type='text/javascript'&gt;\n  //&lt;![CDATA[\n    &amp;
&lt; &gt; &amp;\n  //]]&gt;\n&lt;/script&gt;\n">.

- Walter

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Haml" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [email protected]
For more options, visit this group at http://groups.google.com/group/haml?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to