aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_controller/vendor/html-scanner/html/node.rb
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/lib/action_controller/vendor/html-scanner/html/node.rb')
-rw-r--r--actionpack/lib/action_controller/vendor/html-scanner/html/node.rb6
1 files changed, 5 insertions, 1 deletions
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 6bc62fdf33..f3e8eb1a22 100644
--- a/actionpack/lib/action_controller/vendor/html-scanner/html/node.rb
+++ b/actionpack/lib/action_controller/vendor/html-scanner/html/node.rb
@@ -435,7 +435,11 @@ module HTML #:nodoc:
# count children
if opts = conditions[:children]
- matches = children.select { |c| c.match(/./) }
+ matches = children.select do |c|
+ c.match(/./) or
+ (c.kind_of?(HTML::Tag) and (c.closing == :self or ! c.childless?))
+ end
+
matches = matches.select { |c| c.match(opts[:only]) } if opts[:only]
opts.each do |key, value|
next if key == :only