diff options
author | Timm <kaspth@gmail.com> | 2013-07-20 13:06:23 +0200 |
---|---|---|
committer | Timm <kaspth@gmail.com> | 2014-06-15 23:40:57 +0200 |
commit | 3b942d36bcaac364096ebb3248c1fc66dd269677 (patch) | |
tree | 9044d13db8cf844b297fd3b6757cbd48e22e6f2f | |
parent | 6fa3af8876a12b21871bf6e5fa45ca041d8ae235 (diff) | |
download | rails-3b942d36bcaac364096ebb3248c1fc66dd269677.tar.gz rails-3b942d36bcaac364096ebb3248c1fc66dd269677.tar.bz2 rails-3b942d36bcaac364096ebb3248c1fc66dd269677.zip |
Removed more redundant lines. Removed fix_content block that circumvented a bug in html-scanner.
-rw-r--r-- | actionpack/lib/action_dispatch/testing/assertions/selector.rb | 8 |
1 files changed, 1 insertions, 7 deletions
diff --git a/actionpack/lib/action_dispatch/testing/assertions/selector.rb b/actionpack/lib/action_dispatch/testing/assertions/selector.rb index 6aa4fea4f2..fe48de11d1 100644 --- a/actionpack/lib/action_dispatch/testing/assertions/selector.rb +++ b/actionpack/lib/action_dispatch/testing/assertions/selector.rb @@ -295,14 +295,8 @@ module ActionDispatch raise ArgumentError, "Argument is optional, and may be node or array of nodes" end - fix_content = lambda do |node| - # Gets around a bug in the Rails 1.1 HTML parser. - node.content.gsub(/<!\[CDATA\[(.*)(\]\]>)?/m) { Rack::Utils.escapeHTML($1) } - end - selected = elements.map do |elem| - text = elem.children.select{ |c| not c.tag? }.map{ |c| fix_content[c] }.join - root = HTML::Document.new(CGI.unescapeHTML("<encoded>#{text}</encoded>")).root + root = Loofah.fragment(CGI.unescapeHTML("<encoded>#{elem.text}</encoded>")).root css_select(root, "encoded:root", &block)[0] end |