Ticket #58 (closed defect: fixed)

Opened 22 months ago

Last modified 20 months ago

unclosed comment in a form does not behave like firefox

Reported by: neomindryan Owned by: why
Priority: major Milestone:
Component: lib/hpricot Version:
Keywords: Cc:

Description

I've found that if an html comment is begun inside of a form and never closed, Firefox ignores the comment entirely, where hpricot seems to stop parsing html elements. In the attached patch, there is a file called test/files/pace_application.html. If the form on this page is submitted using firefox, you will see the fields below the unclosed comment (i.e. hdnRecIDwr) in the querystring of the URL you are brought to, while doing this in IRB:
require 'rubygems'
require 'hpricot'
doc = Hpricot(open('test/files/pace_application.html'))
doc.at('input[@name=hdnRecIDwr]')

doesn't yield any elements.

The new test in my patch fails because (i think) in test_preserved.rb:assert_roundtrip(), doc.to_original_html appears to omit the unclosed comment. Thanks!
P.S.
This is the same patch I attached with the hpricot_scan bug I submitted today, and so it contains a very small change to hpricot_common.rl that is necessary for the test to fail the "right way" using the html test file I found "in the wild".

Attachments

my_first_hpricot.patch (46.0 kB) - added by neomindryan 22 months ago.
small fix to ext/hpricot_scan/hpricot_common.rl, new test in test/test_preserved.rb, and a new sample html file in test/files/pace_application.html

Change History

Changed 22 months ago by neomindryan

small fix to ext/hpricot_scan/hpricot_common.rl, new test in test/test_preserved.rb, and a new sample html file in test/files/pace_application.html

Changed 20 months ago by why

  • status changed from new to closed
  • resolution set to fixed

This was applied awhile ago. Don't recall when, but you can see the tests are there in trunk and everything.

Note: See TracTickets for help on using tickets.