| OLD | NEW |
| (Empty) |
| 1 | |
| 2 /* | |
| 3 Copyright © 2001-2004 World Wide Web Consortium, | |
| 4 (Massachusetts Institute of Technology, European Research Consortium | |
| 5 for Informatics and Mathematics, Keio University). All | |
| 6 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 | |
| 8 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | |
| 9 | |
| 10 [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231 | |
| 11 */ | |
| 12 | |
| 13 | |
| 14 | |
| 15 /** | |
| 16 * Gets URI that identifies the test. | |
| 17 * @return uri identifier of test | |
| 18 */ | |
| 19 function getTargetURI() { | |
| 20 return "http://www.w3.org/2001/DOM-Test-Suite/level3/core/nodegetfeature13
"; | |
| 21 } | |
| 22 | |
| 23 var docsLoaded = -1000000; | |
| 24 var builder = null; | |
| 25 | |
| 26 // | |
| 27 // This function is called by the testing framework before | |
| 28 // running the test suite. | |
| 29 // | |
| 30 // If there are no configuration exceptions, asynchronous | |
| 31 // document loading is started. Otherwise, the status | |
| 32 // is set to complete and the exception is immediately | |
| 33 // raised when entering the body of the test. | |
| 34 // | |
| 35 function setUpPage() { | |
| 36 setUpPageStatus = 'running'; | |
| 37 try { | |
| 38 // | |
| 39 // creates test document builder, may throw exception | |
| 40 // | |
| 41 builder = createConfiguredBuilder(); | |
| 42 | |
| 43 docsLoaded = 0; | |
| 44 | |
| 45 var docRef = null; | |
| 46 if (typeof(this.doc) != 'undefined') { | |
| 47 docRef = this.doc; | |
| 48 } | |
| 49 docsLoaded += preload(docRef, "doc", "hc_staff"); | |
| 50 | |
| 51 if (docsLoaded == 1) { | |
| 52 setUpPageStatus = 'complete'; | |
| 53 } | |
| 54 } catch(ex) { | |
| 55 catchInitializationError(builder, ex); | |
| 56 setUpPageStatus = 'complete'; | |
| 57 } | |
| 58 } | |
| 59 | |
| 60 | |
| 61 | |
| 62 // | |
| 63 // This method is called on the completion of | |
| 64 // each asychronous load started in setUpTests. | |
| 65 // | |
| 66 // When every synchronous loaded document has completed, | |
| 67 // the page status is changed which allows the | |
| 68 // body of the test to be executed. | |
| 69 function loadComplete() { | |
| 70 if (++docsLoaded == 1) { | |
| 71 setUpPageStatus = 'complete'; | |
| 72 } | |
| 73 } | |
| 74 | |
| 75 | |
| 76 /** | |
| 77 * | |
| 78 Check implementation of Node.getFeature on Notation. | |
| 79 | |
| 80 * @author Curt Arnold | |
| 81 * @see http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-getFea
ture | |
| 82 */ | |
| 83 function nodegetfeature13() { | |
| 84 var success; | |
| 85 if(checkInitialization(builder, "nodegetfeature13") != null) return; | |
| 86 var doc; | |
| 87 var node; | |
| 88 var nullVersion = null; | |
| 89 | |
| 90 var featureImpl; | |
| 91 var isSupported; | |
| 92 var domImpl; | |
| 93 var notations; | |
| 94 var doctype; | |
| 95 | |
| 96 var docRef = null; | |
| 97 if (typeof(this.doc) != 'undefined') { | |
| 98 docRef = this.doc; | |
| 99 } | |
| 100 doc = load(docRef, "doc", "hc_staff"); | |
| 101 domImpl = doc.implementation; | |
| 102 doctype = doc.doctype; | |
| 103 | |
| 104 notations = doctype.notations; | |
| 105 | |
| 106 node = notations.getNamedItem("notation1"); | |
| 107 featureImpl = node.getFeature("Core",nullVersion); | |
| 108 assertSame("coreUnspecifiedVersion",node,featureImpl); | |
| 109 featureImpl = node.getFeature("cOrE",nullVersion); | |
| 110 assertSame("cOrEUnspecifiedVersion",node,featureImpl); | |
| 111 featureImpl = node.getFeature("+cOrE",nullVersion); | |
| 112 assertSame("PlusCoreUnspecifiedVersion",node,featureImpl); | |
| 113 featureImpl = node.getFeature("org.w3c.domts.bogus.feature",nullVersion); | |
| 114 assertNull("unrecognizedFeature",featureImpl); | |
| 115 featureImpl = node.getFeature("cOrE","2.0"); | |
| 116 assertSame("Core20",node,featureImpl); | |
| 117 featureImpl = node.getFeature("cOrE","3.0"); | |
| 118 assertSame("Core30",node,featureImpl); | |
| 119 isSupported = node.isSupported("XML",nullVersion); | |
| 120 featureImpl = node.getFeature("XML",nullVersion); | |
| 121 | |
| 122 if( | |
| 123 isSupported | |
| 124 ) { | |
| 125 assertSame("XMLUnspecified",node,featureImpl); | |
| 126 | |
| 127 } | |
| 128 isSupported = node.isSupported("SVG",nullVersion); | |
| 129 featureImpl = node.getFeature("SVG",nullVersion); | |
| 130 | |
| 131 if( | |
| 132 isSupported | |
| 133 ) { | |
| 134 assertSame("SVGUnspecified",node,featureImpl); | |
| 135 | |
| 136 } | |
| 137 isSupported = node.isSupported("HTML",nullVersion); | |
| 138 featureImpl = node.getFeature("HTML",nullVersion); | |
| 139 | |
| 140 if( | |
| 141 isSupported | |
| 142 ) { | |
| 143 assertSame("HTMLUnspecified",node,featureImpl); | |
| 144 | |
| 145 } | |
| 146 isSupported = node.isSupported("Events",nullVersion); | |
| 147 featureImpl = node.getFeature("Events",nullVersion); | |
| 148 | |
| 149 if( | |
| 150 isSupported | |
| 151 ) { | |
| 152 assertSame("EventsUnspecified",node,featureImpl); | |
| 153 | |
| 154 } | |
| 155 isSupported = node.isSupported("LS",nullVersion); | |
| 156 featureImpl = node.getFeature("LS",nullVersion); | |
| 157 | |
| 158 if( | |
| 159 isSupported | |
| 160 ) { | |
| 161 assertSame("LSUnspecified",node,featureImpl); | |
| 162 | |
| 163 } | |
| 164 isSupported = node.isSupported("LS-Async",nullVersion); | |
| 165 featureImpl = node.getFeature("LS-Async",nullVersion); | |
| 166 | |
| 167 if( | |
| 168 isSupported | |
| 169 ) { | |
| 170 assertSame("LSAsyncUnspecified",node,featureImpl); | |
| 171 | |
| 172 } | |
| 173 isSupported = node.isSupported("XPath",nullVersion); | |
| 174 featureImpl = node.getFeature("XPath",nullVersion); | |
| 175 | |
| 176 if( | |
| 177 isSupported | |
| 178 ) { | |
| 179 assertSame("XPathUnspecified",node,featureImpl); | |
| 180 | |
| 181 } | |
| 182 isSupported = node.isSupported("+HTML",nullVersion); | |
| 183 featureImpl = node.getFeature("HTML",nullVersion); | |
| 184 | |
| 185 if( | |
| 186 isSupported | |
| 187 ) { | |
| 188 assertNotNull("PlusHTMLUnspecified",featureImpl); | |
| 189 | |
| 190 } | |
| 191 isSupported = node.isSupported("+SVG",nullVersion); | |
| 192 featureImpl = node.getFeature("SVG",nullVersion); | |
| 193 | |
| 194 if( | |
| 195 isSupported | |
| 196 ) { | |
| 197 assertNotNull("PlusSVGUnspecified",featureImpl); | |
| 198 | |
| 199 } | |
| 200 | |
| 201 } | |
| 202 | |
| 203 | |
| 204 | |
| 205 | |
| 206 function runTest() { | |
| 207 nodegetfeature13(); | |
| 208 } | |
| OLD | NEW |