diff --git a/actionpack/CHANGELOG b/actionpack/CHANGELOG index c683552548..db41b582cc 100644 --- a/actionpack/CHANGELOG +++ b/actionpack/CHANGELOG @@ -1,5 +1,7 @@ *SVN* +* Allow assert_tag(:conditions) to match the empty string when a tag has no children. Closes #2959. [Jamis Buck] + * Update html-scanner to handle CDATA sections better. Closes #2970. [Jamis Buck] * Don't put flash in session if sessions are disabled. [Jeremy Kemper] diff --git a/actionpack/lib/action_controller/vendor/html-scanner/html/node.rb b/actionpack/lib/action_controller/vendor/html-scanner/html/node.rb index fb961570c4..218db80823 100644 --- a/actionpack/lib/action_controller/vendor/html-scanner/html/node.rb +++ b/actionpack/lib/action_controller/vendor/html-scanner/html/node.rb @@ -412,7 +412,13 @@ def match(conditions) conditions = validate_conditions(conditions) # check content of child nodes - return false unless children.find { |child| child.match(conditions[:content]) } if conditions[:content] + if conditions[:content] + if children.empty? + return false unless match_condition("", conditions[:content]) + else + return false unless children.find { |child| child.match(conditions[:content]) } + end + end # test the name return false unless match_condition(@name, conditions[:tag]) if conditions[:tag] diff --git a/actionpack/lib/action_controller/vendor/html-scanner/html/version.rb b/actionpack/lib/action_controller/vendor/html-scanner/html/version.rb index 99a8d5766c..6d645c3e14 100644 --- a/actionpack/lib/action_controller/vendor/html-scanner/html/version.rb +++ b/actionpack/lib/action_controller/vendor/html-scanner/html/version.rb @@ -3,7 +3,7 @@ module Version #:nodoc: MAJOR = 0 MINOR = 5 - TINY = 2 + TINY = 3 STRING = [ MAJOR, MINOR, TINY ].join(".")