Permalink
Browse files

added CDATA javascript escaping for XHTML validation

  • Loading branch information...
1 parent 396006a commit b6cd26971e62055c57d26f2a4dcd3dd576caa452 @ryanfelton committed Aug 18, 2009
Showing with 6 additions and 1 deletion.
  1. +4 −1 lib/textile_editor_helper.rb
  2. +2 −0 test/textile_editor_helper_test.rb
@@ -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
@@ -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

0 comments on commit b6cd269

Please sign in to comment.