This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.
The DOM1 hc_nodeinsertbefore test relies on a specificity of the Mozilla parser: when a <p> tag has a newline before the first child tag, Mozilla creates a text node to hold that (whitespace-only) text. Internet Explorer doesn't do that, and Konqueror neither. hc_nodeinsertbefore relies on the <sup> tag being at position 7 (the 8th child) among the children of the <p> tag. In IE and Konq, it is at position 6, since there's no leading text node. Can the test be changed to use something safer than getting a child by its index, for instance getElementsByTagName or namedItem?
Created attachment 40 [details] standalone testcase
The test was an transliteration of a NIST XML test. So it is not only Mozilla, but any XML parser, that would pass the test as written. That said, asserting the preservation of a leading whitespace in a p element was not the objective of the test. The following patch changes the test so it obtains the refChild child parameter using getElementsByTagname and is not affected by the elimination of the leading whitespace node. Index: hc_nodeinsertbefore.xml =================================================================== RCS file: /sources/public/2001/DOM-Test-Suite/tests/level1/core/hc_nodeinsertbefore.xml,v retrieving revision 1.4 diff -u -r1.4 hc_nodeinsertbefore.xml --- hc_nodeinsertbefore.xml 28 Jun 2003 19:11:05 -0000 1.4 +++ hc_nodeinsertbefore.xml 23 Sep 2003 04:42:16 -0000 @@ -19,8 +19,8 @@ The "insertBefore(newChild,refChild)" method inserts the node "newChild" before the node "refChild". - Insert a newly created Element node before the eigth - child of the second employee and check the "newChild" + Insert a newly created Element node before the second + sup element in the document and check the "newChild" and "refChild" after insertion for correct placement. </description> @@ -28,6 +28,7 @@ <subject resource="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-952280727"/> <subject resource="http://www.w3.org/Bugs/Public/show_bug.cgi?id=246"/> <subject resource="http://www.w3.org/Bugs/Public/show_bug.cgi?id=247"/> +<subject resource="http://www.w3.org/Bugs/Public/show_bug.cgi?id=261"/> </metadata> <var name="doc" type="Document"/> <var name="elementList" type="NodeList"/> @@ -50,10 +51,10 @@ </var> <var name="nodeType" type="int"/> <load var="doc" href="hc_staff" willBeModified="true"/> -<getElementsByTagName interface="Document" obj="doc" tagname='"p"' var="elementList"/> -<item interface="NodeList" obj="elementList" index="1" var="employeeNode"/> -<childNodes obj="employeeNode" var="childList"/> -<item interface="NodeList" obj="childList" index="7" var="refChild"/> +<getElementsByTagName interface="Document" obj="doc" tagname='"sup"' var="elementList"/> +<item interface="NodeList" obj="elementList" index="2" var="refChild"/> +<parentNode interface="Node" var="employeeNode" obj="refChild"/> +<childNodes var="childList" obj="employeeNode"/> <createElement obj="doc" tagName='"br"' var="newChild"/> <insertBefore var="insertedNode" obj="employeeNode" newChild="newChild" refChild="refChild"/> <for-each collection="childList" member="child">