OLD | NEW |
---|---|
(Empty) | |
1 <!DOCTYPE html> | |
2 <title>document.contentType</title> | |
3 <link rel="help" href="http://dom.spec.whatwg.org/#dom-document-contenttype"> | |
4 <script src="/js-test-resources/js-test.js"></script> | |
5 <body> | |
6 | |
7 <script> | |
8 window.jsTestIsAsync = true; | |
9 | |
10 var toTest = [ | |
11 { mt: "text/html", uri: "resources/send-mime-type.php?m=text/html" }, | |
12 { mt: "text/xml", uri: "resources/send-mime-type.php?m=text/xml" }, | |
13 { mt: "application/xml", uri: "resources/send-mime-type.php?m=application/xm l" }, | |
14 { mt: "text/html", uri: "resources/send-mime-type.php?m=text/html;charset=ut f-8" }, | |
15 { mt: "text/xml", uri: "resources/send-mime-type.php?m=text/xml;charset=utf- 8" }, | |
16 { mt: "application/xml", uri: "resources/send-mime-type.php?m=application/xm l;charset=utf-8" } | |
17 ]; | |
18 | |
19 function onrequestload(expectedMimeType) { | |
20 shouldBeEqualToNumber('xhr.status', 200); | |
21 | |
22 if (xhr.responseXML) | |
23 shouldBeEqualToString('xhr.responseXML.contentType', expectedMimeType); | |
24 else | |
25 testFailed("Null document for mime-type " + expectedMimeType); | |
26 | |
27 stepTest(); | |
28 } | |
29 | |
30 var xhr; | |
31 | |
32 function stepTest() { | |
33 var thisTest = toTest.shift(); | |
34 if (thisTest) { | |
35 xhr = new XMLHttpRequest(); | |
36 xhr.open('GET', thisTest.uri, true); | |
37 xhr.responseType = 'document'; | |
38 xhr.onload = onrequestload.bind(null, thisTest.mt); | |
39 xhr.send(''); | |
40 } | |
arv (Not doing code reviews)
2014/03/24 16:20:11
} else {
| |
41 else | |
42 finishJSTest(); | |
43 } | |
44 | |
45 stepTest(); | |
46 | |
47 </script> | |
OLD | NEW |