Ticket #129 (new defect)

Opened 11 months ago

Extra </tr> and </td> tags cause elements not to be found

Reported by: aaronp Owned by: why
Priority: major Milestone:
Component: ext/hpricot_scan Version:
Keywords: Cc:

Description

Extra close tr and td tags cause hpricot to not find elements.

The script below should find two input tags, but only finds one.

doc = Hpricot.parse(DATA.read)
doc.search('//form').each do |form|
  form.search('//input').each do |input|
    p input
  end 
end   
__END__ 
<html>
<body>
<table>
  <tr>
    <td>
    <form>
      <input type="text" name="outside_table" value="foo">
      <table>
      <tr>
        <td><input type="text" name="inside_table" /></td>
      </tr>
      </td></tr><!-- Broken HTML! -->
      </table>
    </form>
    </td>
    </tr>
  </table>
  </body>
</html>
Note: See TracTickets for help on using tickets.