Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Ticket #1937: html_document.patch

File html_document.patch, 1.1 kB (added by peter_marklund, 3 years ago)

Make HTML::Document#initialize default xml argument to true if text has <?xml instruction

  • test/controller/assert_select_test.rb

    old new  
    310310    assert found 
    311311  end 
    312312 
     313  def test_assert_select_xml 
     314    render_html %Q{<?xml version="1.0" encoding="utf-8"?><form><link>foobar</link></form>} 
     315    assert_select "form link", "foobar" 
     316  end 
     317 
    313318  # Test that we fail if there is nothing to pick. 
    314319  def test_assert_select_rjs_fails_if_nothing_to_pick 
    315320    render_rjs { } 
  • lib/action_controller/vendor/html-scanner/html/document.rb

    old new  
    1111    attr_reader :root 
    1212 
    1313    # Create a new Document from the given text. 
    14     def initialize(text, strict=false, xml=false
     14    def initialize(text, strict=false, xml=(text =~ /<\?xml /)
    1515      tokenizer = Tokenizer.new(text) 
    1616      @root = Node.new(nil) 
    1717      node_stack = [ @root ]