aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_view
diff options
context:
space:
mode:
authorDan Weinand <dweinand@gmail.com>2008-10-30 12:52:12 -0500
committerPratik Naik <pratiknaik@gmail.com>2009-01-28 19:53:59 +0000
commit91eeb0ff119d34d0fcdb44d3d7fcbb7924208e05 (patch)
treedf8b8ee4fa6c601160d42aad35076540bf01899e /actionpack/lib/action_view
parenta0d8202bb9fa55c328a3170836b0cddb40631e83 (diff)
downloadrails-91eeb0ff119d34d0fcdb44d3d7fcbb7924208e05.tar.gz
rails-91eeb0ff119d34d0fcdb44d3d7fcbb7924208e05.tar.bz2
rails-91eeb0ff119d34d0fcdb44d3d7fcbb7924208e05.zip
Using the highlight helper on text with html shouldn't highlight text inside html attributes. [#1302 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
Diffstat (limited to 'actionpack/lib/action_view')
-rw-r--r--actionpack/lib/action_view/helpers/text_helper.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/actionpack/lib/action_view/helpers/text_helper.rb b/actionpack/lib/action_view/helpers/text_helper.rb
index 1d9e4fe9b8..b1eb6891fa 100644
--- a/actionpack/lib/action_view/helpers/text_helper.rb
+++ b/actionpack/lib/action_view/helpers/text_helper.rb
@@ -107,7 +107,7 @@ module ActionView
text
else
match = Array(phrases).map { |p| Regexp.escape(p) }.join('|')
- text.gsub(/(#{match})/i, options[:highlighter])
+ text.gsub(/(#{match})(?!(?:[^<]*?)?(?:["'])[^<>]*>)/i, options[:highlighter])
end
end