OLD | NEW |
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 | |
15 /** | 12 /** |
16 * Gets URI that identifies the test. | 13 * Gets URI that identifies the test. |
17 * @return uri identifier of test | 14 * @return uri identifier of test |
18 */ | 15 */ |
19 function getTargetURI() { | 16 function getTargetURI() { |
20 return "http://www.w3.org/2001/DOM-Test-Suite/level3/core/documentnormaliz
edocument12"; | 17 return "http://www.w3.org/2001/DOM-Test-Suite/level3/core/documentnormaliz
edocument12"; |
21 } | 18 } |
22 | 19 |
23 var docsLoaded = -1000000; | 20 var docsLoaded = -1000000; |
24 var builder = null; | 21 var builder = null; |
(...skipping 12 matching lines...) Expand all Loading... |
37 try { | 34 try { |
38 // | 35 // |
39 // creates test document builder, may throw exception | 36 // creates test document builder, may throw exception |
40 // | 37 // |
41 builder = createConfiguredBuilder(); | 38 builder = createConfiguredBuilder(); |
42 setImplementationAttribute("validating", true); | 39 setImplementationAttribute("validating", true); |
43 setImplementationAttribute("schemaValidating", true); | 40 setImplementationAttribute("schemaValidating", true); |
44 setImplementationAttribute("namespaceAware", true); | 41 setImplementationAttribute("namespaceAware", true); |
45 | 42 |
46 docsLoaded = 0; | 43 docsLoaded = 0; |
47 | 44 |
48 var docRef = null; | 45 var docRef = null; |
49 if (typeof(this.doc) != 'undefined') { | 46 if (typeof(this.doc) != 'undefined') { |
50 docRef = this.doc; | 47 docRef = this.doc; |
51 } | 48 } |
52 docsLoaded += preload(docRef, "doc", "hc_staff"); | 49 docsLoaded += preload(docRef, "doc", "hc_staff"); |
53 | 50 |
54 if (docsLoaded == 1) { | 51 if (docsLoaded == 1) { |
55 setUpPageStatus = 'complete'; | 52 setUpPageStatus = 'complete'; |
56 } | 53 } |
57 } catch(ex) { | 54 } catch(ex) { |
58 » catchInitializationError(builder, ex); | 55 catchInitializationError(builder, ex); |
59 setUpPageStatus = 'complete'; | 56 setUpPageStatus = 'complete'; |
60 } | 57 } |
61 } | 58 } |
62 | 59 |
63 | |
64 | |
65 // | 60 // |
66 // This method is called on the completion of | 61 // This method is called on the completion of |
67 // each asychronous load started in setUpTests. | 62 // each asychronous load started in setUpTests. |
68 // | 63 // |
69 // When every synchronous loaded document has completed, | 64 // When every synchronous loaded document has completed, |
70 // the page status is changed which allows the | 65 // the page status is changed which allows the |
71 // body of the test to be executed. | 66 // body of the test to be executed. |
72 function loadComplete() { | 67 function loadComplete() { |
73 if (++docsLoaded == 1) { | 68 if (++docsLoaded == 1) { |
74 setUpPageStatus = 'complete'; | 69 setUpPageStatus = 'complete'; |
75 } | 70 } |
76 } | 71 } |
77 | 72 |
78 | |
79 /** | 73 /** |
80 * Inner class implementation for variable errHandler | 74 * Inner class implementation for variable errHandler |
81 */ | 75 */ |
82 var errHandler; | 76 var errHandler; |
83 | 77 |
84 /** | 78 /** |
85 * Constructor | 79 * Constructor |
86 | 80 |
87 */ | 81 */ |
88 » | 82 |
89 function DOMErrorHandlerN10048() { | 83 function DOMErrorHandlerN10048() { |
90 } | 84 } |
91 | 85 |
92 /** | 86 /** |
93 * | 87 * |
94 This method is called on the error handler when an error occurs. | 88 This method is called on the error handler when an error occurs. |
95 If an exception is thrown from this method, it is considered to be equivalent of
returningtrue. | 89 If an exception is thrown from this method, it is considered to be equivalent of
returningtrue. |
96 | 90 |
97 * @param error | 91 * @param error |
98 The error object that describes the error. This object may be reused by the DOM
implementation across multiple calls to thehandleErrormethod. | 92 The error object that describes the error. This object may be reused by the DOM
implementation across multiple calls to thehandleErrormethod. |
99 | 93 |
100 */ | 94 */ |
101 DOMErrorHandlerN10048.prototype.handleError = function(error) { | 95 DOMErrorHandlerN10048.prototype.handleError = function(error) { |
102 // | 96 // |
103 // bring class variables into function scope | 97 // bring class variables into function scope |
104 // | 98 // |
105 assertFalse("documentnormalizedocument08_Err",true); | 99 assertFalse("documentnormalizedocument08_Err",true); |
106 return true; | 100 return true; |
107 } | 101 } |
108 | 102 |
109 /** | 103 /** |
110 * | 104 * |
111 » The normalizeDocument method method acts as if the document was going th
rough a save | 105 The normalizeDocument method method acts as if the document was going throug
h a save |
112 » and load cycle, putting the document in a "normal" form. | 106 and load cycle, putting the document in a "normal" form. |
113 | 107 |
114 » Set the validate feature to true. Invoke the normalizeDocument method o
n this | 108 Set the validate feature to true. Invoke the normalizeDocument method on th
is |
115 » document. Retreive the documentElement node and check the nodeName of t
his node | 109 document. Retreive the documentElement node and check the nodeName of this
node |
116 » to make sure it has not changed. Now set validate to false and verify t
he same. | 110 to make sure it has not changed. Now set validate to false and verify the s
ame. |
117 » Register an error handler on this Document and in each case make sure th
at it does | 111 Register an error handler on this Document and in each case make sure that i
t does |
118 » not get called. | 112 not get called. |
119 | 113 |
120 * @author IBM | 114 * @author IBM |
121 * @author Neil Delima | 115 * @author Neil Delima |
122 * @see http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-no
rmalizeDocument | 116 * @see http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-no
rmalizeDocument |
123 * @see http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#parameter-va
lidate | 117 * @see http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#parameter-va
lidate |
124 */ | 118 */ |
125 function documentnormalizedocument12() { | 119 function documentnormalizedocument12() { |
126 var success; | 120 var success; |
127 if(checkInitialization(builder, "documentnormalizedocument12") != null) retu
rn; | 121 if(checkInitialization(builder, "documentnormalizedocument12") != null) retu
rn; |
128 var doc; | 122 var doc; |
129 var docElem; | 123 var docElem; |
130 var docElemNodeName; | 124 var docElemNodeName; |
131 var canSet; | 125 var canSet; |
132 var domConfig; | 126 var domConfig; |
133 var errorHandler; | 127 var errorHandler; |
134 errHandler = new DOMErrorHandlerN10048(); | 128 errHandler = new DOMErrorHandlerN10048(); |
135 » | 129 |
136 | |
137 var docRef = null; | 130 var docRef = null; |
138 if (typeof(this.doc) != 'undefined') { | 131 if (typeof(this.doc) != 'undefined') { |
139 docRef = this.doc; | 132 docRef = this.doc; |
140 } | 133 } |
141 doc = load(docRef, "doc", "hc_staff"); | 134 doc = load(docRef, "doc", "hc_staff"); |
142 domConfig = doc.domConfig; | 135 domConfig = doc.domConfig; |
143 | 136 |
144 domConfig.setParameter("error-handler", errHandler.handleError); | 137 domConfig.setParameter("error-handler", errHandler.handleError); |
145 » canSet = domConfig.canSetParameter("validate",true); | 138 canSet = domConfig.canSetParameter("validate",true); |
146 | 139 |
147 » if( | 140 if( |
148 » canSet | 141 canSet |
149 » ) { | 142 ) { |
150 » domConfig.setParameter("validate", true); | 143 domConfig.setParameter("validate", true); |
151 » doc.normalizeDocument(); | 144 doc.normalizeDocument(); |
152 docElem = doc.documentElement; | 145 docElem = doc.documentElement; |
153 | 146 |
154 docElemNodeName = docElem.nodeName; | 147 docElemNodeName = docElem.nodeName; |
155 | 148 |
156 assertEquals("documentnormalizedocument08_True","html",docElemNodeName); | 149 assertEquals("documentnormalizedocument08_True","html",docElemNodeName); |
157 | 150 |
158 » } | 151 } |
159 » domConfig.setParameter("validate", false); | 152 domConfig.setParameter("validate", false); |
160 » doc.normalizeDocument(); | 153 doc.normalizeDocument(); |
161 docElem = doc.documentElement; | 154 docElem = doc.documentElement; |
162 | 155 |
163 docElemNodeName = docElem.nodeName; | 156 docElemNodeName = docElem.nodeName; |
164 | 157 |
165 assertEquals("documentnormalizedocument08_False","html",docElemNodeName); | 158 assertEquals("documentnormalizedocument08_False","html",docElemNodeName); |
166 | 159 |
167 } | 160 } |
168 | 161 |
169 | |
170 | |
171 | |
172 function runTest() { | 162 function runTest() { |
173 documentnormalizedocument12(); | 163 documentnormalizedocument12(); |
174 } | 164 } |
OLD | NEW |