Changeset 4916
- Timestamp:
- 09/03/06 16:47:05 (2 years ago)
- Files:
-
- trunk/actionpack/CHANGELOG (modified) (1 diff)
- trunk/actionpack/lib/action_view/helpers/text_helper.rb (modified) (1 diff)
- trunk/actionpack/test/template/text_helper_test.rb (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/actionpack/CHANGELOG
r4915 r4916 1 1 *SVN* 2 3 * strip_tags returns nil for a blank arg such as nil or "". #2229 [duncan@whomwah.com] 2 4 3 5 * Cleanup assert_tag :children counting. #2181 [jamie@bravenet.com] trunk/actionpack/lib/action_view/helpers/text_helper.rb
r4911 r4916 214 214 # 215 215 # Returns the tag free text. 216 def strip_tags(html) 216 def strip_tags(html) 217 return nil if html.blank? 217 218 if html.index("<") 218 219 text = "" trunk/actionpack/test/template/text_helper_test.rb
r4911 r4916 315 315 %{This is a test.\n\n\nIt no longer contains any HTML.\n}, strip_tags( 316 316 %{<title>This is <b>a <a href="" target="_blank">test</a></b>.</title>\n\n<!-- it has a comment -->\n\n<p>It no <b>longer <strong>contains <em>any <strike>HTML</strike></em>.</strong></b></p>\n})) 317 assert_equal ("This has a here.", strip_tags("This has a <!-- comment --> here."))318 end319 317 assert_equal "This has a here.", strip_tags("This has a <!-- comment --> here.") 318 [nil, '', ' '].each { |blank| assert_nil strip_tags(blank) } 319 end 320 320 end