Skip to content

Commit 3bcadc9

Browse files
packagethiefjeremy
authored andcommitted
Fix incorrect closing CDATA delimiter. Add tests for CDATA nodes.
Signed-off-by: Jeremy Kemper <[email protected]>
1 parent 1a18227 commit 3bcadc9

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

actionpack/lib/action_controller/vendor/html-scanner/html/node.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ def ==(node)
272272
# itself.
273273
class CDATA < Text #:nodoc:
274274
def to_s
275-
"<![CDATA[#{super}]>"
275+
"<![CDATA[#{super}]]>"
276276
end
277277
end
278278

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
require 'abstract_unit'
2+
3+
class CDATANodeTest < Test::Unit::TestCase
4+
def setup
5+
@node = HTML::CDATA.new(nil, 0, 0, "<p>howdy</p>")
6+
end
7+
8+
def test_to_s
9+
assert_equal "<![CDATA[<p>howdy</p>]]>", @node.to_s
10+
end
11+
12+
def test_content
13+
assert_equal "<p>howdy</p>", @node.content
14+
end
15+
end

0 commit comments

Comments
 (0)