diff options
author | Jamis Buck <jamis@37signals.com> | 2005-10-18 00:50:52 +0000 |
---|---|---|
committer | Jamis Buck <jamis@37signals.com> | 2005-10-18 00:50:52 +0000 |
commit | e515ba9ecd43101d31ae9afea8de766e886192dd (patch) | |
tree | 6a90ee7a214c86676dd1ad71f4038f233ba00c4f /actionpack/lib/action_controller | |
parent | 9601f96a70445e45428bb14ca069ccbca7a9c113 (diff) | |
download | rails-e515ba9ecd43101d31ae9afea8de766e886192dd.tar.gz rails-e515ba9ecd43101d31ae9afea8de766e886192dd.tar.bz2 rails-e515ba9ecd43101d31ae9afea8de766e886192dd.zip |
Fix the html-scanner to count children correctly, playing nicely with :only, fixes #2181 [patrick@lenz.sh]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2670 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/lib/action_controller')
-rw-r--r-- | actionpack/lib/action_controller/vendor/html-scanner/html/node.rb | 6 |
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 |