dom/tests/mochitest/dom-level2-html/test_hasFeature04.html

branch
TOR_BUG_9701
changeset 9
a63d609f5ebe
equal deleted inserted replaced
-1:000000000000 0:0758026740c2
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
2 <html>
3 <head>
4 <META http-equiv="Content-Type" content="text/html; charset=UTF-8">
5 <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
6 <title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/hasFeature04</title>
7 <link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
8 <script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
9 <script src="DOMTestCase.js" type="text/javascript"></script>
10 <script type="text/javascript">
11 // expose test function names
12 function exposeTestFunctionNames()
13 {
14 return ['hasFeature04'];
15 }
16
17 var docsLoaded = -1000000;
18 var builder = null;
19
20 //
21 // This function is called by the testing framework before
22 // running the test suite.
23 //
24 // If there are no configuration exceptions, asynchronous
25 // document loading is started. Otherwise, the status
26 // is set to complete and the exception is immediately
27 // raised when entering the body of the test.
28 //
29 function setUpPage() {
30 setUpPageStatus = 'running';
31 try {
32 //
33 // creates test document builder, may throw exception
34 //
35 builder = createConfiguredBuilder();
36
37 docsLoaded = 0;
38
39 if (docsLoaded == 0) {
40 setUpPage = 'complete';
41 }
42 } catch(ex) {
43 catchInitializationError(builder, ex);
44 setUpPage = 'complete';
45 }
46 runJSUnitTests();
47 SimpleTest.finish();
48 }
49
50
51
52 //
53 // This method is called on the completion of
54 // each asychronous load started in setUpTests.
55 //
56 // When every synchronous loaded document has completed,
57 // the page status is changed which allows the
58 // body of the test to be executed.
59 function loadComplete() {
60 if (++docsLoaded == 0) {
61 setUpPageStatus = 'complete';
62 }
63 }
64
65
66 /**
67 *
68 hasFeature("xhTmL", "2.0") should return true if hasFeature("XML", "2.0") returns true.
69
70 * @author Curt Arnold
71 * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-5CED94D7
72 */
73 function hasFeature04() {
74 var success;
75 if(checkInitialization(builder, "hasFeature04") != null) return;
76 var doc;
77 var domImpl;
78 var version = "2.0";
79 var state;
80 var hasXML;
81 domImpl = getImplementation();
82 hasXML = domImpl.hasFeature("XML",version);
83 state = domImpl.hasFeature("xhTmL",version);
84 assertEquals("hasXHTML",hasXML,state);
85
86 }
87
88 </script>
89 </head>
90 <body>
91 <h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/hasFeature04</h2>
92 <p>&lt;test name='hasFeature04' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-2 dom2.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;hasFeature04&lt;/title&gt;
93 <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;Curt Arnold&lt;/creator&gt;
94 <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
95 hasFeature("xhTmL", "2.0") should return true if hasFeature("XML", "2.0") returns true.
96 &lt;/description&gt;
97 <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2004-03-18&lt;/date&gt;
98 <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/DOM-Level-2-Core/core#ID-5CED94D7">http://www.w3.org/TR/DOM-Level-2-Core/core#ID-5CED94D7</a>'/&gt;
99 <br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='domImpl' type='DOMImplementation'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='version' type='DOMString' value='"2.0"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='state' type='boolean'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='hasXML' type='boolean'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;implementation var='domImpl'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;hasFeature obj='domImpl' var='hasXML' feature='"XML"' version='version'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;hasFeature obj='domImpl' var='state' feature='"xhTmL"' version='version'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='state' expected='hasXML' ignoreCase='false' <a id="hasXHTML">id='hasXHTML'</a>/&gt;<br>&lt;/test&gt;<br>
100 </p>
101 <p>
102 Copyright (c) 2001-2004 World Wide Web Consortium,
103 (Massachusetts Institute of Technology, Institut National de
104 Recherche en Informatique et en Automatique, Keio University). All
105 Rights Reserved. This program is distributed under the W3C's Software
106 Intellectual Property License. This program is distributed in the
107 hope that it will be useful, but WITHOUT ANY WARRANTY; without even
108 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
109 PURPOSE.
110 </p>
111 <p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
112 for more details.</p>
113 </body>
114 </html>

mercurial