    # File lib/action_view/helpers/text_helper.rb, line 180
          def sanitize(html)
            # only do this if absolutely necessary
            if html.index("<")
              tokenizer = HTML::Tokenizer.new(html)
              new_text = ""

              while token = tokenizer.next
                node = HTML::Node.parse(nil, 0, 0, token, false)
                new_text << case node
                  when HTML::Tag
                    if VERBOTEN_TAGS.include?(node.name)
                      node.to_s.gsub(/</, "&lt;")
                    else
                      if node.closing != :close
                        node.attributes.delete_if { |attr,v| attr =~ VERBOTEN_ATTRS }
                        if node.attributes["href"] =~ /^javascript:/i
                          node.attributes.delete "href"
                        end
                      end
                      node.to_s
                    end
                  else
                    node.to_s.gsub(/</, "&lt;")
                end
              end

              html = new_text
            end

            html
          end