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="nodeinsertbeforedocfragment">
  15. <metadata>
  16. <title>nodeInsertBeforeDocFragment</title>
  17. <creator>NIST</creator>
  18. <description>
  19.    If the "newChild" is a DocumentFragment object then all
  20.    its children are inserted in the same order before the
  21.    the "refChild".
  22.    
  23.    Create a DocumentFragment object and populate it with
  24.    two Element nodes.   Retrieve the second employee and
  25.    insert the newly created DocumentFragment before its
  26.    fourth child.   The second employee should now have two
  27.    extra children("newChild1" and "newChild2") at
  28.    positions fourth and fifth respectively.
  29. </description>
  30. <contributor>Mary Brady</contributor>
  31. <date qualifier="created">2001-08-17</date>
  32. <subject resource="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-952280727"/>
  33. </metadata>
  34. <var name="doc" type="Document"/>
  35. <var name="elementList" type="NodeList"/>
  36. <var name="employeeNode" type="Node"/>
  37. <var name="childList" type="NodeList"/>
  38. <var name="refChild" type="Node"/>
  39. <var name="newdocFragment" type="DocumentFragment"/>
  40. <var name="newChild1" type="Node"/>
  41. <var name="newChild2" type="Node"/>
  42. <var name="child" type="Node"/>
  43. <var name="childName" type="DOMString"/>
  44. <var name="appendedChild" type="Node"/>
  45. <var name="insertedNode" type="Node"/>
  46. <load var="doc" href="staff" willBeModified="true"/>
  47. <getElementsByTagName interface="Document" obj="doc" tagname="&quot;employee&quot;" var="elementList"/>
  48. <item interface="NodeList" obj="elementList" index="1" var="employeeNode"/>
  49. <childNodes obj="employeeNode" var="childList"/>
  50. <item interface="NodeList" obj="childList" index="3" var="refChild"/>
  51. <createDocumentFragment obj="doc" var="newdocFragment"/>
  52. <createElement obj="doc" tagName="&quot;newChild1&quot;" var="newChild1"/>
  53. <createElement obj="doc" tagName="&quot;newChild2&quot;" var="newChild2"/>
  54. <appendChild var="appendedChild" obj="newdocFragment" newChild="newChild1"/>
  55. <appendChild var="appendedChild" obj="newdocFragment" newChild="newChild2"/>
  56. <insertBefore var="insertedNode" obj="employeeNode" newChild="newdocFragment" refChild="refChild"/>
  57. <item interface="NodeList" obj="childList" index="3" var="child"/>
  58. <nodeName obj="child" var="childName"/>
  59. <assertEquals actual="childName" expected='"newChild1"' ignoreCase="false" id="childName3"/>
  60. <item interface="NodeList" obj="childList" index="4" var="child"/>
  61. <nodeName obj="child" var="childName"/>
  62. <assertEquals actual="childName" expected='"newChild2"' ignoreCase="false" id="childName4"/>
  63. </test>
  64.