aboutsummaryrefslogtreecommitdiffstats
path: root/test/js
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2024-11-22 20:18:53 +0100
committerbptato <nincsnevem662@gmail.com>2024-11-22 20:24:54 +0100
commit6e7cae47b2037860f53d4ae90d37a91d8b29906b (patch)
treedb8966bced3b74e25dd4c2bf824d130fee41be7c /test/js
parent7d549f10ba356486201645ae11fc4796ef5a4441 (diff)
downloadchawan-6e7cae47b2037860f53d4ae90d37a91d8b29906b.tar.gz
dom: implement HTMLDocument, make Image C/W
* add HTMLDocument as alias to Document * set Image as configurable/writable So looking closer, HTMLDocument *is* specified, just major browsers don't follow the spec. I doubt this incompatibility causes issues, anyway.
Diffstat (limited to 'test/js')
-rw-r--r--test/js/document.html9
-rw-r--r--test/js/window.html4
2 files changed, 9 insertions, 4 deletions
diff --git a/test/js/document.html b/test/js/document.html
index 1020283c..10ecf17d 100644
--- a/test/js/document.html
+++ b/test/js/document.html
@@ -12,10 +12,11 @@ assertEquals(document.toString, document.getElementById("toString"));
document.toString.remove();
document.testtest = "hi";
assertEquals(Object.getOwnPropertyNames(document).toString(), "testtest,location,img2,img3,asdf");
-// the spec doesn't have HTMLDocument, but browsers do.
-//TODO: we'll probably have to implement HTMLDocument ourselves too
-// nonetheless.
-if (!window.HTMLDocument)
+/*
+ * Note: the spec says Document == HTMLDocument, but in other browsers
+ * this is not true.
+ */
+if (HTMLDocument == Document)
assertEquals(document.toString(), "[object Document]");
assertEquals(document, window.document);
assertEquals(document.implementation, document.implementation);
diff --git a/test/js/window.html b/test/js/window.html
index 81485cad..06729e0e 100644
--- a/test/js/window.html
+++ b/test/js/window.html
@@ -15,5 +15,9 @@ delete window.localStorage.b;
assertEquals(window.localStorage["b"], undefined);
window.localStorage["b"] = "y";
assert(window.sessionStorage instanceof Storage);
+Image = "test";
+HTMLDocument = "test";
+assertEquals(Image, "test");
+assertEquals(HTMLDocument, "test");
document.getElementById("x").textContent = "Success";
</script>