|
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 |
|
19 <test xmlns="http://www.w3.org/2001/DOM-Test-Suite/Level-3" name="nodecomparedocumentposition34"> |
|
20 <metadata> |
|
21 <title>nodecomparedocumentposition34</title> |
|
22 <creator>IBM</creator> |
|
23 <description> |
|
24 Create a new Element node, add new Text, Element and Processing Instruction nodes to it. |
|
25 Using compareDocumentPosition, compare the position of the Element with respect to the Text |
|
26 and the Text with respect to the Processing Instruction. |
|
27 </description> |
|
28 <contributor>Jenny Hsu</contributor> |
|
29 <date qualifier="created">2003-02-21</date> |
|
30 <subject resource="http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-compareDocumentPosition"/> |
|
31 </metadata> |
|
32 <var name="doc" type="Document"/> |
|
33 <var name="elemMain" type="Element"/> |
|
34 <var name="elem" type="Element"/> |
|
35 <var name="txt" type="Text"/> |
|
36 <var name="pi" type="ProcessingInstruction"/> |
|
37 <var name="elementToTxtPosition" type="int"/> |
|
38 <var name="txtToPiPosition" type="int"/> |
|
39 <var name="appendedChild" type="Node"/> |
|
40 <load var="doc" href="hc_staff" willBeModified="false"/> |
|
41 <createElementNS var="elemMain" obj="doc" namespaceURI='"http://www.w3.org/1999/xhtml"' qualifiedName='"p"'/> |
|
42 <createElementNS var="elem" obj="doc" namespaceURI='"http://www.w3.org/1999/xhtml"' qualifiedName='"br"'/> |
|
43 <createTextNode var="txt" obj="doc" data='"TEXT"'/> |
|
44 <createProcessingInstruction var="pi" obj="doc" data='"PID"' target='"PIT"'/> |
|
45 <appendChild obj="elemMain" var="appendedChild" newChild="txt"/> |
|
46 <appendChild obj="elemMain" var="appendedChild" newChild="elem"/> |
|
47 <appendChild obj="elemMain" var="appendedChild" newChild="pi"/> |
|
48 <compareDocumentPosition var="elementToTxtPosition" obj="txt" other="elem"/> |
|
49 <assertEquals actual="elementToTxtPosition" expected="4" id="nodecomparedocumentpositionFollowing34" ignoreCase="false"/> |
|
50 <compareDocumentPosition var="txtToPiPosition" obj="pi" other="txt"/> |
|
51 <assertEquals actual="txtToPiPosition" expected="2" id="nodecomparedocumentpositionPRECEDING34" ignoreCase="false"/> |
|
52 </test> |