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"?><?xml-stylesheet href="test-to-html.xsl" type="text/xml"?>
  2.  
  3. <!--
  4.  
  5. Copyright (c) 2001-2004 World Wide Web Consortium,
  6. (Massachusetts Institute of Technology, Institut National de
  7. Recherche en Informatique et en Automatique, Keio University).  All
  8. Rights Reserved.  This program is distributed under the W3C's Software
  9. Intellectual Property License.  This program is distributed in the
  10. hope that it will be useful, but WITHOUT ANY WARRANTY; without even
  11. the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  12. PURPOSE.  
  13.  
  14. See W3C License http://www.w3.org/Consortium/Legal/ for more details.
  15.  
  16. -->
  17.  
  18. <!DOCTYPE test SYSTEM "dom3.dtd">
  19. <test xmlns="http://www.w3.org/2001/DOM-Test-Suite/Level-3" name="nodecomparedocumentposition33">
  20. <metadata>
  21. <title>nodecomparedocumentposition33</title>
  22. <creator>IBM</creator>
  23. <description>
  24.         Create a new Element node, add a new atttribute node to it.  Compare the position
  25.         of the Element and the Document.  This should return disconnected, implementation specific, and that
  26.         the order of these two nodes is preserved.
  27.         Also compare the position of the Element node with respect to the Attr node and this should
  28.         be PRECEDING and contains, and the Attr node follows and is contained by the Element node
  29. </description>
  30. <contributor>Jenny Hsu</contributor>
  31. <date qualifier="created">2003-02-21</date>
  32. <subject resource="http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-compareDocumentPosition"/>
  33. </metadata>
  34. <var name="doc" type="Document"/>
  35. <var name="elem" type="Element"/>
  36. <var name="attr" type="Attr"/>
  37. <var name="position1" type="int"/>
  38. <var name="position2" type="int"/>
  39. <var name="position3" type="int"/>
  40. <var name="position4" type="int"/>
  41. <var name="position5" type="int"/>
  42. <var name="replacedAttr" type="Attr"/>
  43. <load var="doc" href="hc_staff" willBeModified="false"/>
  44. <createElementNS var="elem" obj="doc" namespaceURI='"http://www.w3.org/1999/xhtml"' qualifiedName='"br"'/>
  45. <createAttributeNS var="attr" obj="doc" namespaceURI='"http://www.w3.org/XML/1998/namespace"' qualifiedName='"xml:lang"'/>
  46. <setAttributeNodeNS obj="elem" var="replacedAttr" newAttr="attr"/>
  47.  
  48. <compareDocumentPosition var="position4" obj="elem" other="attr"/>
  49. <assertEquals  actual="position4" expected="20" id="nodecomparedocumentposition3FollowingisContained33" ignoreCase="false"/>
  50. <compareDocumentPosition var="position5" obj="attr" other="elem"/>
  51. <assertEquals  actual="position5" expected="10" id="nodecomparedocumentposition4ContainsPRECEDING33" ignoreCase="false"/>
  52.  
  53. <compareDocumentPosition var="position1" obj="doc" other="elem"/>
  54. <!--  bitmask blocks out preceding and following bits   -->
  55. <assertEquals bitmask="57" actual="position1" expected="33" id="isImplSpecificDisconnected1" ignoreCase="false"/>
  56. <compareDocumentPosition var="position2" obj="elem" other="doc"/>
  57. <assertNotEquals bitmask="2" actual="position2" expected="position1" id="notBothPreceding" ignoreCase="false"/>
  58. <assertNotEquals bitmask="4" actual="position2" expected="position1" id="notBothFollowing" ignoreCase="false"/>
  59. <assertEquals bitmask="57" actual="position2" expected="33" id="isImplSpecificDisconnected2" ignoreCase="false"/>
  60. <!--  returned value should be consistent between invocations   -->
  61. <compareDocumentPosition var="position3" obj="doc" other="elem"/>
  62. <assertEquals  actual="position3" expected="position1" id="isConsistent" ignoreCase="false"/>
  63. </test>
  64.