Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Blame | Last modification | View Log | Download | RSS feed

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3. Copyright (c) 2001 World Wide Web Consortium,
  4. (Massachusetts Institute of Technology, Institut National de
  5. Recherche en Informatique et en Automatique, Keio University). All
  6. Rights Reserved. This program is distributed under the W3C's Software
  7. Intellectual Property License. This program is distributed in the
  8. hope that it will be useful, but WITHOUT ANY WARRANTY; without even
  9. the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  10. PURPOSE.
  11. See W3C License http://www.w3.org/Consortium/Legal/ for more details.
  12. --><!DOCTYPE test SYSTEM "dom1.dtd">
  13.  
  14. <test xmlns="http://www.w3.org/2001/DOM-Test-Suite/Level-1" name="hc_elementgetelementsbytagnameaccessnodelist">
  15. <metadata>
  16. <title>hc_elementGetElementsByTagName</title>
  17. <creator>Curt Arnold</creator>
  18. <description>
  19. The "getElementsByTagName(name)" method returns a list
  20. of all descendant Elements in the order the children
  21. were encountered in a pre order traversal of the element
  22. tree.
  23.  
  24. Create a NodeList of all the descendant elements
  25. using the string "p" as the tagName.
  26. The method should return a NodeList whose length is
  27. "5" in the order the children were encountered.
  28. Access the FOURTH element in the NodeList.  The FOURTH
  29. element, the first or second should be an "em" node with
  30. the content "EMP0004".
  31. </description>
  32.  
  33. <date qualifier="created">2002-06-09</date>
  34. <!--getElementsByTagName-->
  35. <subject resource="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1938918D"/>
  36. <subject resource="http://www.w3.org/Bugs/Public/show_bug.cgi?id=246"/>
  37. </metadata>
  38. <var name="doc" type="Document"/>
  39. <var name="elementList" type="NodeList"/>
  40. <var name="testEmployee" type="Element"/>
  41. <var name="firstC" type="Node"/>
  42. <var name="childName" type="DOMString"/>
  43. <var name="nodeType" type="int"/>
  44. <var name="employeeIDNode" type="CharacterData"/>
  45. <var name="employeeID" type="DOMString"/>
  46. <load var="doc" href="hc_staff" willBeModified="false"/>
  47. <getElementsByTagName interface="Document" obj="doc" tagname='"p"' var="elementList"/>
  48. <item interface="NodeList" obj="elementList" index="3" var="testEmployee"/>
  49. <firstChild interface="Node" obj="testEmployee" var="firstC"/>
  50. <nodeType var="nodeType" obj="firstC"/>
  51. <!--   if a text node, get the next sibling  -->
  52. <while><equals actual="nodeType" expected="3"/>
  53. <nextSibling interface="Node" var="firstC" obj="firstC"/>
  54. <nodeType var="nodeType" obj="firstC"/>
  55. </while>
  56. <nodeName obj="firstC" var="childName"/>
  57. <assertEquals actual="childName" expected='"em"' id="childName" ignoreCase="auto"/>
  58. <firstChild interface="Node" var="employeeIDNode" obj="firstC"/>
  59. <nodeValue var="employeeID" obj="employeeIDNode"/>
  60. <assertEquals actual="employeeID" expected='"EMP0004"' ignoreCase="false" id="employeeID"/>
  61. </test>
  62.