<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://www.w3.org/Bugs/Public/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>261</bug_id>
          
          <creation_ts>2003-06-30 09:22:02 +0000</creation_ts>
          <short_desc>hc_nodeinsertbefore relies on parser specifics (whitespace handling).</short_desc>
          <delta_ts>2003-09-23 05:04:33 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>DOM TS</product>
          <component>DOM Level 1</component>
          <version>unspecified</version>
          <rep_platform>PC</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="David Faure">faure</reporter>
          <assigned_to name="Philippe Le Hegaret">plh</assigned_to>
          
          
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>620</commentid>
    <comment_count>0</comment_count>
    <who name="David Faure">faure</who>
    <bug_when>2003-06-30 09:22:02 +0000</bug_when>
    <thetext>The DOM1 hc_nodeinsertbefore test relies on a specificity of the Mozilla parser: when a &lt;p&gt; 
tag has a newline before the first child tag, Mozilla creates a text node to hold that 
(whitespace-only) text. Internet Explorer doesn&apos;t do that, and Konqueror neither. 
 
hc_nodeinsertbefore relies on the &lt;sup&gt; tag being at position 7 (the 8th child) among the 
children of the &lt;p&gt; tag. In IE and Konq, it is at position 6, since there&apos;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?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>621</commentid>
    <comment_count>1</comment_count>
      <attachid>40</attachid>
    <who name="David Faure">faure</who>
    <bug_when>2003-06-30 09:26:13 +0000</bug_when>
    <thetext>Created attachment 40
standalone testcase</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>773</commentid>
    <comment_count>2</comment_count>
    <who name="Curt Arnold">carnold</who>
    <bug_when>2003-09-23 01:04:33 +0000</bug_when>
    <thetext>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 &quot;insertBefore(newChild,refChild)&quot; method inserts the
     node &quot;newChild&quot; before the node &quot;refChild&quot;. 
     
-    Insert a newly created Element node before the eigth
-    child of the second employee and check the &quot;newChild&quot;
+    Insert a newly created Element node before the second
+    sup element in the document and check the &quot;newChild&quot;
     and &quot;refChild&quot; after insertion for correct placement.
 &lt;/description&gt;
 
@@ -28,6 +28,7 @@
 &lt;subject
resource=&quot;http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-952280727&quot;/&gt;
 &lt;subject resource=&quot;http://www.w3.org/Bugs/Public/show_bug.cgi?id=246&quot;/&gt;
 &lt;subject resource=&quot;http://www.w3.org/Bugs/Public/show_bug.cgi?id=247&quot;/&gt;
+&lt;subject resource=&quot;http://www.w3.org/Bugs/Public/show_bug.cgi?id=261&quot;/&gt;
 &lt;/metadata&gt;
 &lt;var name=&quot;doc&quot; type=&quot;Document&quot;/&gt;
 &lt;var name=&quot;elementList&quot; type=&quot;NodeList&quot;/&gt;
@@ -50,10 +51,10 @@
 &lt;/var&gt;
 &lt;var name=&quot;nodeType&quot; type=&quot;int&quot;/&gt;
 &lt;load var=&quot;doc&quot; href=&quot;hc_staff&quot; willBeModified=&quot;true&quot;/&gt;
-&lt;getElementsByTagName interface=&quot;Document&quot; obj=&quot;doc&quot; tagname=&apos;&quot;p&quot;&apos;
var=&quot;elementList&quot;/&gt;
-&lt;item interface=&quot;NodeList&quot; obj=&quot;elementList&quot; index=&quot;1&quot; var=&quot;employeeNode&quot;/&gt;
-&lt;childNodes obj=&quot;employeeNode&quot; var=&quot;childList&quot;/&gt;
-&lt;item interface=&quot;NodeList&quot; obj=&quot;childList&quot; index=&quot;7&quot; var=&quot;refChild&quot;/&gt;
+&lt;getElementsByTagName interface=&quot;Document&quot; obj=&quot;doc&quot; tagname=&apos;&quot;sup&quot;&apos;
var=&quot;elementList&quot;/&gt;
+&lt;item interface=&quot;NodeList&quot; obj=&quot;elementList&quot; index=&quot;2&quot; var=&quot;refChild&quot;/&gt;
+&lt;parentNode interface=&quot;Node&quot; var=&quot;employeeNode&quot; obj=&quot;refChild&quot;/&gt;
+&lt;childNodes var=&quot;childList&quot; obj=&quot;employeeNode&quot;/&gt; 
 &lt;createElement obj=&quot;doc&quot; tagName=&apos;&quot;br&quot;&apos; var=&quot;newChild&quot;/&gt;
 &lt;insertBefore var=&quot;insertedNode&quot; obj=&quot;employeeNode&quot; newChild=&quot;newChild&quot;
refChild=&quot;refChild&quot;/&gt;
 &lt;for-each collection=&quot;childList&quot; member=&quot;child&quot;&gt;
</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>40</attachid>
            <date>2003-06-30 09:26:13 +0000</date>
            <delta_ts>2003-06-30 09:26:13 +0000</delta_ts>
            <desc>standalone testcase</desc>
            <filename>parsing.html</filename>
            <type>text/html</type>
            <size>765</size>
            <attacher name="David Faure">faure</attacher>
            
              <data encoding="base64">PGh0bWw+Cjxib2R5PgoKIDxwPgogIDxlbT5FTVAwMDAyPC9lbT4KICA8c3Ryb25nPk1hcnRoYSBS
YXlub2xkczwvc3Ryb25nPgogIDxjb2RlPlNlY3JldGFyeTwvY29kZT4KICA8c3VwPjM1LDAwMDwv
c3VwPgogIDx2YXI+RmVtYWxlPC92YXI+CiAgPGFjcm9ueW0gdGl0bGU9IlllcyIgY2xhc3M9Illl
cyI+JmJldGE7IERhbGxhcywgJmdhbW1hOwogOTg1NTQ8L2Fjcm9ueW0+CiA8L3A+CgogICAgICA8
c2NyaXB0PgogICAgICB2YXIgZW1wbG95ZWVOb2RlID0gZG9jdW1lbnQuZ2V0RWxlbWVudHNCeVRh
Z05hbWUoInAiKS5pdGVtKDApOwogICAgICB2YXIgY2hpbGRMaXN0ID0gZW1wbG95ZWVOb2RlLmNo
aWxkTm9kZXM7CiAgICAgIHZhciBhY3R1YWwgPSBuZXcgQXJyYXkoKTsKCiAgICAgIGZvcih2YXIg
X2luZGV4ID0gMDsgX2luZGV4IDwgY2hpbGRMaXN0Lmxlbmd0aDsgX2luZGV4KyspIHsKICAgICAg
ICAgIGNoaWxkID0gY2hpbGRMaXN0Lml0ZW0oX2luZGV4KTsKICAgICAgICAgIG5vZGVUeXBlID0g
Y2hpbGQubm9kZVR5cGU7CiAgICAgICAgICBpZiggKDEgPT0gbm9kZVR5cGUpKSB7CiAgICAgICAg
ICAgICAgY2hpbGROYW1lID0gY2hpbGQubm9kZU5hbWU7CiAgICAgICAgICAgICAgYWN0dWFsW2Fj
dHVhbC5sZW5ndGhdID0gY2hpbGROYW1lOwogICAgICAgICAgfSBlbHNlIGFjdHVhbFthY3R1YWwu
bGVuZ3RoXSA9ICIoVEVYVCkiOwogICAgICB9CiAgICAgIGFsZXJ0KGFjdHVhbCk7CiAgICAgIDwv
c2NyaXB0Pgo8L2JvZHk+CjwvaHRtbD4K
</data>

          </attachment>
      

    </bug>

</bugzilla>