File: test_createHTMLDocument.html

package info (click to toggle)
wine-gecko-2.21 2.21%2Bdfsg2-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 646,272 kB
  • ctags: 630,086
  • sloc: cpp: 2,895,786; ansic: 1,502,970; python: 156,675; asm: 115,373; java: 111,421; sh: 63,309; xml: 62,872; makefile: 58,685; perl: 19,182; objc: 3,461; yacc: 2,051; lex: 979; pascal: 929; exp: 449; php: 244; lisp: 228; awk: 211; sed: 26; csh: 21; ada: 16; ruby: 3
file content (50 lines) | stat: -rw-r--r-- 2,325 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<!DOCTYPE html>
<title>createHTMLDocument</title>
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" href="/tests/SimpleTest/test.css" />
<link rel="author" title="Ms2ger" href="mailto:ms2ger@gmail.com">
<link rel="help" href="http://www.whatwg.org/html5/#creating-documents">
<link rel="help" href="http://www.whatwg.org/html5/#document.title">
<link rel="help" href="http://www.whatwg.org/html5/#dom-document-readystate">
<body>
<script>
function isElement(element, localName) {
  is(element.localName, localName);
  is(element.namespaceURI, "http://www.w3.org/1999/xhtml");
  is(element.tagName, localName.toUpperCase());
  is(element.nodeName, localName.toUpperCase());
  is(element.prefix, null);
}
function checkDoc(title, expectedtitle, normalizedtitle) {
  var doc = document.implementation.createHTMLDocument(title);
  is(doc.readyState, "complete");
  is(doc.compatMode, "CSS1Compat");
  // Opera doesn't have a doctype: DSK-311092
  ok(doc.doctype, "Need a doctype");
  is(doc.doctype.name, "html");
  is(doc.doctype.publicId, "");
  is(doc.doctype.systemId, "");
  is(doc.doctype.internalSubset, null, "internalSubset should be null!");
  isElement(doc.documentElement, "html");
  isElement(doc.documentElement.firstChild, "head");
  is(doc.documentElement.firstChild.childNodes.length, 1);
  isElement(doc.documentElement.firstChild.firstChild, "title");
  // Doesn't always work out in WebKit.
  ok(doc.documentElement.firstChild.firstChild.firstChild, "Need a text node.");
  is(doc.documentElement.firstChild.firstChild.firstChild.data, expectedtitle);
  isElement(doc.documentElement.lastChild, "body");
  is(doc.documentElement.lastChild.childNodes.length, 0);
  ((!title || title.indexOf("\f") === -1) ? is : todo_is)
    (doc.title, normalizedtitle);
  doc.body.innerHTML = "foo";
  is(doc.body.innerHTML, "foo", "innerHTML should work in HTML data documents!");
}
checkDoc("", "", "");
checkDoc(null, "null", "null");
checkDoc(undefined, "undefined", "undefined");
checkDoc("foo  bar baz", "foo  bar baz", "foo bar baz");
checkDoc("foo\t\tbar baz", "foo\t\tbar baz", "foo bar baz");
checkDoc("foo\n\nbar baz", "foo\n\nbar baz", "foo bar baz");
checkDoc("foo\f\fbar baz", "foo\f\fbar baz", "foo bar baz");
checkDoc("foo\r\rbar baz", "foo\r\rbar baz", "foo bar baz");
</script>