Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(378)

Side by Side Diff: LayoutTests/dom/svg/level3/xpath/Text_Nodes.js

Issue 756123002: Remove tabs and trailing whitspace in LayoutTests/dom/.../*.js (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebase Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1
2 /* 1 /*
3 Copyright © 2001-2004 World Wide Web Consortium, 2 Copyright © 2001-2004 World Wide Web Consortium,
4 (Massachusetts Institute of Technology, European Research Consortium 3 (Massachusetts Institute of Technology, European Research Consortium
5 for Informatics and Mathematics, Keio University). All 4 for Informatics and Mathematics, Keio University). All
6 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
7 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
8 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 7 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
9 8
10 [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231 9 [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
11 */ 10 */
12 11
13
14 // expose test function names 12 // expose test function names
15 function exposeTestFunctionNames() 13 function exposeTestFunctionNames()
16 { 14 {
17 return ['Text_Nodes']; 15 return ['Text_Nodes'];
18 } 16 }
19 17
20 var docsLoaded = -1000000; 18 var docsLoaded = -1000000;
21 var builder = null; 19 var builder = null;
22 20
23 // 21 //
24 // This function is called by the testing framework before 22 // This function is called by the testing framework before
25 // running the test suite. 23 // running the test suite.
26 // 24 //
27 // If there are no configuration exceptions, asynchronous 25 // If there are no configuration exceptions, asynchronous
28 // document loading is started. Otherwise, the status 26 // document loading is started. Otherwise, the status
29 // is set to complete and the exception is immediately 27 // is set to complete and the exception is immediately
30 // raised when entering the body of the test. 28 // raised when entering the body of the test.
31 // 29 //
32 function setUpPage() { 30 function setUpPage() {
33 setUpPageStatus = 'running'; 31 setUpPageStatus = 'running';
34 try { 32 try {
35 // 33 //
36 // creates test document builder, may throw exception 34 // creates test document builder, may throw exception
37 // 35 //
38 builder = createConfiguredBuilder(); 36 builder = createConfiguredBuilder();
39 37
40 docsLoaded = 0; 38 docsLoaded = 0;
41 39
42 var docRef = null; 40 var docRef = null;
43 if (typeof(this.doc) != 'undefined') { 41 if (typeof(this.doc) != 'undefined') {
44 docRef = this.doc; 42 docRef = this.doc;
45 } 43 }
46 docsLoaded += preload(docRef, "doc", "staff"); 44 docsLoaded += preload(docRef, "doc", "staff");
47 45
48 if (docsLoaded == 1) { 46 if (docsLoaded == 1) {
49 setUpPageStatus = 'complete'; 47 setUpPageStatus = 'complete';
50 } 48 }
51 } catch(ex) { 49 } catch(ex) {
52 catchInitializationError(builder, ex); 50 catchInitializationError(builder, ex);
53 setUpPageStatus = 'complete'; 51 setUpPageStatus = 'complete';
54 } 52 }
55 } 53 }
56 54
57
58
59 // 55 //
60 // This method is called on the completion of 56 // This method is called on the completion of
61 // each asychronous load started in setUpTests. 57 // each asychronous load started in setUpTests.
62 // 58 //
63 // When every synchronous loaded document has completed, 59 // When every synchronous loaded document has completed,
64 // the page status is changed which allows the 60 // the page status is changed which allows the
65 // body of the test to be executed. 61 // body of the test to be executed.
66 function loadComplete() { 62 function loadComplete() {
67 if (++docsLoaded == 1) { 63 if (++docsLoaded == 1) {
68 setUpPageStatus = 'complete'; 64 setUpPageStatus = 'complete';
69 } 65 }
70 } 66 }
71 67
72
73 /** 68 /**
74 * 69 *
75 1.2.4 Text Nodes - 70 1.2.4 Text Nodes -
76 Create ANY_TYPE XPathResult matching //text(), 71 Create ANY_TYPE XPathResult matching //text(),
77 check that each matching Node is a Text Node, and 72 check that each matching Node is a Text Node, and
78 that no pair of nodes in the result are siblings. 73 that no pair of nodes in the result are siblings.
79 74
80 * @author Bob Clary 75 * @author Bob Clary
81 * @see http://www.w3.org/TR/2003/CR-DOM-Level-3-XPath-20030331/xpath#Mapping 76 * @see http://www.w3.org/TR/2003/CR-DOM-Level-3-XPath-20030331/xpath#Mapping
82 * @see http://www.w3.org/TR/2003/CR-DOM-Level-3-XPath-20030331/xpath#XPathEvalua tor 77 * @see http://www.w3.org/TR/2003/CR-DOM-Level-3-XPath-20030331/xpath#XPathEvalua tor
83 * @see http://www.w3.org/TR/2003/CR-DOM-Level-3-XPath-20030331/xpath#XPathEvalua tor-createNSResolver 78 * @see http://www.w3.org/TR/2003/CR-DOM-Level-3-XPath-20030331/xpath#XPathEvalua tor-createNSResolver
84 * @see http://www.w3.org/TR/2003/CR-DOM-Level-3-XPath-20030331/xpath#XPathEvalua tor-evaluate 79 * @see http://www.w3.org/TR/2003/CR-DOM-Level-3-XPath-20030331/xpath#XPathEvalua tor-evaluate
85 * @see http://www.w3.org/TR/2003/CR-DOM-Level-3-XPath-20030331/xpath#XPathNSReso lver 80 * @see http://www.w3.org/TR/2003/CR-DOM-Level-3-XPath-20030331/xpath#XPathNSReso lver
86 * @see http://www.w3.org/TR/2003/CR-DOM-Level-3-XPath-20030331/xpath#XPathResult 81 * @see http://www.w3.org/TR/2003/CR-DOM-Level-3-XPath-20030331/xpath#XPathResult
87 * @see http://www.w3.org/TR/2003/CR-DOM-Level-3-XPath-20030331/xpath#XPathResult -iterateNext 82 * @see http://www.w3.org/TR/2003/CR-DOM-Level-3-XPath-20030331/xpath#XPathResult -iterateNext
88 */ 83 */
89 function Text_Nodes() { 84 function Text_Nodes() {
(...skipping 18 matching lines...) Expand all
108 var outresult = null; 103 var outresult = null;
109 104
110 var expression = "//text()"; 105 var expression = "//text()";
111 var xpathType = ANY_TYPE; 106 var xpathType = ANY_TYPE;
112 var currNode; 107 var currNode;
113 var nextNode; 108 var nextNode;
114 var currNodeNextSibling; 109 var currNodeNextSibling;
115 var nextNodePrevSibling; 110 var nextNodePrevSibling;
116 var nodeType; 111 var nodeType;
117 var isTextNode; 112 var isTextNode;
118 113
119 var docRef = null; 114 var docRef = null;
120 if (typeof(this.doc) != 'undefined') { 115 if (typeof(this.doc) != 'undefined') {
121 docRef = this.doc; 116 docRef = this.doc;
122 } 117 }
123 doc = load(docRef, "doc", "staff"); 118 doc = load(docRef, "doc", "staff");
124 evaluator = createXPathEvaluator(doc); 119 evaluator = createXPathEvaluator(doc);
125 resolver = evaluator.createNSResolver(doc); 120 resolver = evaluator.createNSResolver(doc);
126 contextNode = doc; 121 contextNode = doc;
127 outresult = evaluator.evaluate(expression,contextNode,resolver,xpathType,inresul t); 122 outresult = evaluator.evaluate(expression,contextNode,resolver,xpathType,inresul t);
128 currNode = outresult.iterateNext(); 123 currNode = outresult.iterateNext();
129 124
130 while( 125 while(
131 126
132 (currNode != null) 127 (currNode != null)
133 128
134 ) { 129 ) {
135 nodeType = currNode.nodeType; 130 nodeType = currNode.nodeType;
136 131
137 isTextNode = "true"; 132 isTextNode = "true";
138 133
139 if( 134 if(
140 135
141 (!(3 == nodeType) && !(4 == nodeType)) 136 (!(3 == nodeType) && !(4 == nodeType))
142 137
143 ) { 138 ) {
144 isTextNode = "false"; 139 isTextNode = "false";
145 140
146 } 141 }
147 assertEquals("S1.2.4-Text-Nodes-nodeType","true".toLowerCase(),isTextNode.to LowerCase()); 142 assertEquals("S1.2.4-Text-Nodes-nodeType","true".toLowerCase(),isTextNode.to LowerCase());
148 nextNode = outresult.iterateNext(); 143 nextNode = outresult.iterateNext();
149 144
150 if( 145 if(
151 146
152 (nextNode != null) 147 (nextNode != null)
153 148
154 ) { 149 ) {
155 currNodeNextSibling = currNode.nextSibling; 150 currNodeNextSibling = currNode.nextSibling;
156 151
157
158 // WebKit fix: inverted the condition: <http://bugs.webkit.org/show_bug.cgi? id=12560>. 152 // WebKit fix: inverted the condition: <http://bugs.webkit.org/show_bug.cgi? id=12560>.
159 if( 153 if(
160 154
161 same(nextNode,currNodeNextSibling) 155 same(nextNode,currNodeNextSibling)
162 156
163 ) { 157 ) {
164 assertTrue("S1.2.4-Text-Nodes-Adjacent-Next",false); 158 assertTrue("S1.2.4-Text-Nodes-Adjacent-Next",false);
165 159
166 } 160 }
167 nextNodePrevSibling = nextNode.previousSibling; 161 nextNodePrevSibling = nextNode.previousSibling;
168 162
169
170 // WebKit fix: inverted the condition: <http://bugs.webkit.org/show_bug.cgi? id=12560>. 163 // WebKit fix: inverted the condition: <http://bugs.webkit.org/show_bug.cgi? id=12560>.
171 if( 164 if(
172 165
173 same(nextNodePrevSibling,currNode) 166 same(nextNodePrevSibling,currNode)
174 167
175 ) { 168 ) {
176 assertTrue("S1.2.4-Text-Nodes-Adjacent-Prev",false); 169 assertTrue("S1.2.4-Text-Nodes-Adjacent-Prev",false);
177 170
178 } 171 }
179 172
180 } 173 }
181 currNode = nextNode; 174 currNode = nextNode;
182 175
183 } 176 }
184 177
185 } 178 }
186 179
187
188
189
190 function runTest() { 180 function runTest() {
191 Text_Nodes(); 181 Text_Nodes();
192 } 182 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698