OLD | NEW |
1 /* | 1 /* |
2 Copyright © 2001-2004 World Wide Web Consortium, | 2 Copyright © 2001-2004 World Wide Web Consortium, |
3 (Massachusetts Institute of Technology, European Research Consortium | 3 (Massachusetts Institute of Technology, European Research Consortium |
4 for Informatics and Mathematics, Keio University). All | 4 for Informatics and Mathematics, Keio University). All |
5 Rights Reserved. This work is distributed under the W3C® Software License [1] i
n the | 5 Rights Reserved. This work is distributed under the W3C® Software License [1] i
n the |
6 hope that it will be useful, but WITHOUT ANY WARRANTY; without even | 6 hope that it will be useful, but WITHOUT ANY WARRANTY; without even |
7 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 7 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
8 | 8 |
9 [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231 | 9 [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231 |
10 */ | 10 */ |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 var doc; | 82 var doc; |
83 var attrOwnerElem; | 83 var attrOwnerElem; |
84 var element; | 84 var element; |
85 var attr; | 85 var attr; |
86 var childList; | 86 var childList; |
87 var adoptedclass; | 87 var adoptedclass; |
88 var attrsParent; | 88 var attrsParent; |
89 var nodeName; | 89 var nodeName; |
90 var nodeType; | 90 var nodeType; |
91 var nodeValue; | 91 var nodeValue; |
92 var firstChild; | |
93 var firstChildValue; | |
94 var secondChild; | |
95 var secondChildType; | |
96 var secondChildName; | |
97 | 92 |
98 var docRef = null; | 93 var docRef = null; |
99 if (typeof(this.doc) != 'undefined') { | 94 if (typeof(this.doc) != 'undefined') { |
100 docRef = this.doc; | 95 docRef = this.doc; |
101 } | 96 } |
102 doc = load(docRef, "doc", "hc_staff"); | 97 doc = load(docRef, "doc", "hc_staff"); |
103 childList = doc.getElementsByTagName("acronym"); | 98 childList = doc.getElementsByTagName("acronym"); |
104 element = childList.item(3); | 99 element = childList.item(3); |
105 attr = element.getAttributeNode("class"); | 100 attr = element.getAttributeNode("class"); |
106 adoptedclass = doc.adoptNode(attr); | 101 adoptedclass = doc.adoptNode(attr); |
107 | 102 |
108 if( | |
109 | |
110 (adoptedclass != null) | |
111 | |
112 ) { | |
113 nodeName = adoptedclass.nodeName; | 103 nodeName = adoptedclass.nodeName; |
114 | 104 |
115 nodeValue = adoptedclass.nodeValue; | 105 nodeValue = adoptedclass.nodeValue; |
116 | 106 |
117 nodeType = adoptedclass.nodeType; | 107 nodeType = adoptedclass.nodeType; |
118 | 108 |
119 attrOwnerElem = adoptedclass.ownerElement; | 109 attrOwnerElem = adoptedclass.ownerElement; |
120 | 110 |
121 assertEquals("documentadoptode01_nodeName","class",nodeName); | 111 assertEquals("documentadoptode01_nodeName","class",nodeName); |
122 assertEquals("documentadoptNode01_nodeType",2,nodeType); | 112 assertEquals("documentadoptNode01_nodeType",2,nodeType); |
123 assertNull("documentadoptnode01_ownerDoc",attrOwnerElem); | 113 assertNull("documentadoptnode01_ownerDoc",attrOwnerElem); |
124 firstChild = adoptedclass.firstChild; | |
125 | |
126 assertNotNull("firstChildNotNull",firstChild); | |
127 firstChildValue = firstChild.nodeValue; | |
128 | |
129 if( | |
130 ("Y" == firstChildValue) | |
131 ) { | |
132 secondChild = firstChild.nextSibling; | |
133 | |
134 assertNotNull("secondChildNotNull",secondChild); | |
135 secondChildType = secondChild.nodeType; | |
136 | |
137 assertEquals("secondChildIsEntityReference",5,secondChildType); | |
138 secondChildName = secondChild.nodeName; | |
139 | |
140 assertEquals("secondChildIsEnt1Reference","alpha",secondChildName); | |
141 | |
142 } | |
143 | |
144 else { | |
145 assertEquals("documentadoptnode01_nodeValue","Yα",nodeValue); | |
146 | |
147 } | |
148 | |
149 } | |
150 | |
151 } | 114 } |
152 | 115 |
153 function runTest() { | 116 function runTest() { |
154 documentadoptnode01(); | 117 documentadoptnode01(); |
155 } | 118 } |
OLD | NEW |