SgmlPage.getElementsByTagName("*") should return the same logic collection as SgmlPage.getDomElementDescendants() but it returns an empty collection instead.
Well, doing this fails DomNodeListTest.getElementsByTagName(), HtmlForm2Test.base(), HtmlElementTest.getElementsByTagName2() and HtmlPageTest.getElementsByTagName().
Please provide a test case that shows the current logic is incorrect.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
/** * @throws Exception if the test fails */@TestpublicvoidgetAllElementsBySpecialTagNameValue()throwsException{finalStringfirstContent="<html><head><title>First</title></head>\n"+"<body>\n"+"<form><input type='button' name='button1' value='pushme'></form>\n"+"<div>a</div> <div>b</div> <div>c</div>\n"+"</body></html>";finalHtmlPagepage=loadPage(firstContent);finalDomNodeList<DomElement>elements=page.getElementsByTagName("*");assertEquals(9,elements.getLength());validateDomNodeList(elements);finalHtmlDivisionnewDiv=newHtmlDivision(HtmlDivision.TAG_NAME,page,null);page.getBody().appendChild(newDiv);assertEquals(10,elements.getLength());validateDomNodeList(elements);}
And here is what I inserted at the beginning of SgmlPage.getElementsByTagName(String) to get the test to pass:
Well, doing this fails DomNodeListTest.getElementsByTagName(), HtmlForm2Test.base(), HtmlElementTest.getElementsByTagName2() and HtmlPageTest.getElementsByTagName().
Please provide a test case that shows the current logic is incorrect.
Here is a test case for
DomNodeLIstTest:And here is what I inserted at the beginning of
SgmlPage.getElementsByTagName(String)to get the test to pass:Thanks for reporting and the test case. Now I understand the '*'.
Fixed in SVN.
Oh, I just realized that the same should be applied to
getElementsByTagNameNS...Also Element.getElementsByTagNameNS needs to be modified.
Thanks for the feedback, fixed in SVN.