зеркало из https://github.com/mozilla/gecko-dev.git
47 строки
1.9 KiB
HTML
47 строки
1.9 KiB
HTML
<html>
|
|
<head>
|
|
<script src="harness.js"></script>
|
|
</head>
|
|
<body>
|
|
<script>
|
|
// test1: existing document's head
|
|
{
|
|
is_not(document.head, null, "test1-0, existing document's head");
|
|
is_a(document.head, HTMLHeadElement, "test1-1, exising document's head");
|
|
is(document.head && document.head.tagName, "HEAD", "test1-2, existing document's head");
|
|
}
|
|
|
|
// test2: append head to a new document
|
|
{
|
|
let new_document = new Document();
|
|
new_document.appendChild(new_document.createElement("html"));
|
|
let new_head = new_document.createElement("head");
|
|
|
|
is_not(new_head, null, "test2-0, append head to a new document");
|
|
is_a(new_head, HTMLHeadElement, "test2-1, append head to a new document");
|
|
is(new_head && new_head.tagName, "head", "test2-2, append head to a new document");
|
|
|
|
// Document::head is read-only.
|
|
new_document.head = new_head;
|
|
is(new_document.head, null, "test2-3, append head to a new document");
|
|
|
|
new_document.documentElement.appendChild(new_head);
|
|
is(new_document.head, new_head, "test2-4, append head to a new document");
|
|
}
|
|
|
|
// test3: head's parent should be document element
|
|
{
|
|
let new_document = new Document();
|
|
let html = new_document.createElement("html");
|
|
let foo = new_document.createElement("foo");
|
|
let head = new_document.createElement("head");
|
|
new_document.appendChild(html);
|
|
html.appendChild(foo);
|
|
foo.appendChild(head);
|
|
is(new_document.head, null, "test3-0, head's parent should be document element");
|
|
}
|
|
finish();
|
|
</script>
|
|
</body>
|
|
</html>
|