Menu

#1610 HTMLParser generates broken DOM for malformed forms in tables

Latest SVN
closed
RBRi
None
1
2014-06-30
2014-06-04
Carsten
No

We had some more problems with the DOM generated by the HTMLParser.
For example multiple forms inside a table with both forms containing all elements in the table instead of only their own.

While trying to fix these problems I broke some more of our tests and at the end decided to emulate the behaviour of Firefox. The result I now have closely emulates it but is neither complete ("col" and "colgroup" not tested) nor 100% correct (DOM, but the one from Firefox is also incorrect).

I added seven tests for which HU and FF generate the same alerts with the exception being MalformedHtmlTest.formInTable4() which has a small difference.

The code I added is not the best as it has a lot of hardcoded Strings and no comments.
But I wanted to make you aware of the problem and the tests can be used regardless of any changes to HTMLParser. If you want to use this fix, I can add a cleaner version of the changes in HTMLParser in the next days.

Patch with changes to HTMLParser and the tests is attached.

1 Attachments

Discussion

  • RBRi

    RBRi - 2014-06-08

    Hi Carsten,

    will have a look at this during the next days. But as general answer:

    • the building of the right dom is one of the most important things for HtmlUnit and the part witch introduces the most problems at the moment

    • have planned to switch to the nu html parser; but implementing this requires some time so this will happen later this year

    • any patches that improving the current situation are welcome; so yes we want the cleaner version

    Thanks a lot
    RBRi

     
  • Carsten

    Carsten - 2014-06-10

    Here is a cleaner version which includes some improvements and another two tests.

     
  • RBRi

    RBRi - 2014-06-27

    Patch applied with commit 9452. Can we close this?

     
  • RBRi

    RBRi - 2014-06-27
    • status: open --> pending
    • assigned_to: RBRi
     
  • Carsten

    Carsten - 2014-06-30

    Yes you can close this.

     
  • RBRi

    RBRi - 2014-06-30
    • status: pending --> closed
     

Log in to post a comment.

MongoDB Logo MongoDB