Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

added CDATA javascript escaping for XHTML validation

  • Loading branch information...
commit b6cd26971e62055c57d26f2a4dcd3dd576caa452 1 parent 396006a
Ryan Felton authored
5 lib/textile_editor_helper.rb
View
@@ -120,7 +120,8 @@ def textile_editor_initialize(*dom_ids)
output = []
output << textile_editor_support unless request.xhr?
output << '<script type="text/javascript">'
-
+ output << '/* <![CDATA[ */'
+
if !request.xhr?
case options[:framework]
when :prototype
@@ -136,6 +137,8 @@ def textile_editor_initialize(*dom_ids)
output << %q{TextileEditor.initialize('%s', '%s');} % [editor_id, mode || 'extended']
end
output << '});' unless request.xhr?
+
+ output << '/* ]]> */'
output << '</script>'
output.join("\n")
end
2  test/textile_editor_helper_test.rb
View
@@ -53,12 +53,14 @@ def pre_initialize_output(framework)
%{<link href="/stylesheets/textile-editor.css" media="screen" rel="stylesheet" type="text/css" />
<script src="/javascripts/textile-editor.js" type="text/javascript"></script>
<script type="text/javascript">
+ /* <![CDATA[ */
} +
framework_initialize_output(framework)
end
def post_initialize_output
%{\});
+ /* ]]> */
</script>
}
end
Please sign in to comment.
Something went wrong with that request. Please try again.