In case of incomplete/unbalanced HTML source code, browsers like Firefox and Chrome might create different DOM trees depending on the document type. For example,
"<p><table></table>"
is balanced to
"<p><table></table></p>"
in Quirks mode and to
"<p></p><table></table>"
in Standard mode. HtmlUnit seems to apply the Quirks balancing strategy in Standard mode as well. This is not a big deal except that XPaths copied from one of these browsers might or might not work in HtmlUnit without modification.
test case
updated test case
There are more examples, especially if the HTML code is not valid (with respect to the specs). For example, the following snippet (btw. generated by a GUI framework):
was rebalanced to:
FF leaves this as is. So when clicking somewhere inside the table:
I extended the test case to cover this issue as well.
Last edit: RBRi 2012-11-03
Diff:
I am seeing this bug as well. It may be a duplicate of https://sourceforge.net/p/htmlunit/bugs/1423/
Ok, this seems to be fixed at least with our own neko fork.
Tescase added.