Skip to content

Commit

Permalink
Test document.body and document.bgColor when root is not <html>
Browse files Browse the repository at this point in the history
  • Loading branch information
zcorpan committed Jan 29, 2018
1 parent cd714f0 commit 825c80b
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
8 changes: 8 additions & 0 deletions html/dom/documents/dom-tree-accessors/Document.body.html
Original file line number Diff line number Diff line change
Expand Up @@ -166,4 +166,12 @@
doc.body = new_frameset;
assert_equals(doc.body, new_frameset, "test6-3, append frameset to a new document");
}, "Setting document.body to a new frameset element.");
test(function() {
var doc = createDocument();
doc.appendChild(doc.createElement("test"));
var new_body = doc.createElement("body");
doc.body = new_body;
assert_equals(doc.documentElement.firstChild, new_body, "new_body should be inserted");
assert_equals(doc.body, null, "Getter should return null when the root is not html");
}, "Setting document.body to a new body element when the root element is a test element.");
</script>
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,24 @@

document.body = body;
}, "setting document color attributes with no body");

test(function() {
var doc = document.implementation.createHTMLDocument();
doc.replaceChild(doc.createElement('test'), doc.documentElement);
var new_body = doc.createElement('body');
doc.documentElement.appendChild(new_body);

doc.fgColor = "red";
doc.bgColor = "red";
doc.linkColor = "red";
doc.vlinkColor = "red";
doc.alinkColor = "red";

assert_equals(new_body.attributes.length, 0, 'new_body.attributes.length');
assert_equals(doc.fgColor, "");
assert_equals(doc.bgColor, "");
assert_equals(doc.linkColor, "");
assert_equals(doc.vlinkColor, "");
assert_equals(doc.alinkColor, "");
}, "document color attributes when the root element is a test element");
</script>

0 comments on commit 825c80b

Please sign in to comment.