提交 bab54e4e 编写于 作者: T Timm

Changed back to =~ or == comparison in HTMLSelector filter.

上级 62171784
...@@ -333,7 +333,7 @@ def filter(matches) ...@@ -333,7 +333,7 @@ def filter(matches)
content_mismatch = nil content_mismatch = nil
text_matches = equality_tests.has_key?(:text) text_matches = equality_tests.has_key?(:text)
match_with = Regexp.new(match_with.to_s) unless match_with.is_a?(Regexp) regex_matching = match_with.is_a?(Regexp)
remaining = matches.reject do |match| remaining = matches.reject do |match|
# Preserve markup with to_s for html elements # Preserve markup with to_s for html elements
...@@ -342,7 +342,7 @@ def filter(matches) ...@@ -342,7 +342,7 @@ def filter(matches)
content.strip! unless NO_STRIP.include?(match.name) content.strip! unless NO_STRIP.include?(match.name)
content.sub!(/\A\n/, '') if text_matches && match.name == "textarea" content.sub!(/\A\n/, '') if text_matches && match.name == "textarea"
next if content =~ match_with next if regex_matching ? (content =~ match_with) : (content == match_with)
content_mismatch ||= sprintf("<%s> expected but was\n<%s>.", match_with, content) content_mismatch ||= sprintf("<%s> expected but was\n<%s>.", match_with, content)
true true
end end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册