Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Fixed #24112 -- Fixed counting of html elements if needle has no root element #4041
This means that if the html passed to
We can then check this when counting to see if the needle HTML has multiple top level elements. If it does, then counting becomes much more fiddly, so my current patch just raises a ValueError.
There aren't any tests as I couldn't find any existing ones for this module. Should things within the
The PR currently contains two commits. (I know I'll want to squash these before a merge) The first (1a56cea) adds a failing test that demonstrates what I believe is incorrect behaviour.
which seems wrong to be saying "not found in".
The second commit (430531c) rectifies this by throwing a ValueError if the needle HTML has no root element, unless if the two elements are equal, which preserves existing functionality.
I believe that the net effect of my change is that if where before you got