level 1 core - hc_nodecloneattributescopied fails

Hi,

I have a question concerning DOM level 1 core test named 
"hc_nodecloneattributescopied". Here, some attributes are examined of 
existence:
<var name="expected" type="Collection">
<member>"class"</member>
<member>"title"</member>
<member>"dir"</member>
</var>

The used element (hc_staff.xml):
<acronym title="Yes" class="Yes">

This test fails the assertion of equality on my side, since the first 
attribute name is "title" and the first collection item has a value of 
"class". I guess that cloning of an element does not imply any change of 
the position of the attributes - so this might be a bug in the test file.

I include the code for the test, since I just started to change the 
test-to-java stylesheet to produce Delphi code - so maby there's 
something wrong on my side.

---
procedure Torg_w3_domts_level1_core.hc_nodecloneattributescopied;
var
   i: integer;
   doc: IDOMDocument;
   elementList: IDOMNodeList;
   addressNode: IDOMNode;
   clonedNode: IDOMNode;
   attributes: IDOMNamedNodeMap;
   attributeNode: IDOMNode;
   attributeName: DOMString;
   result: ITestCollection;
   htmlExpected: ITestCollection;
   expected: ITestCollection;
begin
   result := TTestCollection.Create as ITestCollection;
   htmlExpected := TTestCollection.Create as ITestCollection;
   htmlExpected.add(normalizeString('class'));
   htmlExpected.add(normalizeString('title'));
   expected := TTestCollection.Create as ITestCollection;
   expected.add(normalizeString('class'));
   expected.add(normalizeString('title'));
   expected.add(normalizeString('dir'));

   fParser.domConfig.setParameter(DOM_CONFIG_READ_ONLY, false);
   doc := fParser.parseURI(self.expandFilenameToBeParsed('hc_staff'));
   elementList := doc.getElementsByTagName('acronym');
   addressNode := elementList.item[1];
   clonedNode := addressNode.cloneNode(false);
   attributes := clonedNode.attributes;
   for i := 0 to attributes.length  -1 do begin
     attributeNode := (attributes.item[i] as IDOMNode);
     attributeName := attributeNode.nodeName;
     result.add(attributeName);
   end;
   if (('text/html' = self.getContentType())) then begin
     checkEqualsIgnoreCase(htmlExpected, result, 'nodeNames_html');
   end else begin
     checkEquals(expected, result, 'nodeNames');
   end;
end;
---


Greetings,

Kasimier

Received on Tuesday, 6 April 2004 06:11:15 UTC