Ticket #58 (closed defect: fixed)
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".
