diff options
author | bptato <nincsnevem662@gmail.com> | 2024-07-18 18:22:15 +0200 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2024-07-18 18:22:56 +0200 |
commit | f94b84bde340739647ffe7dd92cfcefb6686eca2 (patch) | |
tree | 6e4af17196945d39ff8a1f9ab5e3516f9c0a2514 /test | |
parent | 01cb95c89fb53a936172412e6dd69b943bf73b4b (diff) | |
download | chawan-f94b84bde340739647ffe7dd92cfcefb6686eca2.tar.gz |
html: event cleanup, XHR progress
Diffstat (limited to 'test')
-rw-r--r-- | test/js/click_setter.html | 13 | ||||
-rw-r--r-- | test/js/xhr.html | 17 |
2 files changed, 30 insertions, 0 deletions
diff --git a/test/js/click_setter.html b/test/js/click_setter.html new file mode 100644 index 00000000..125c8490 --- /dev/null +++ b/test/js/click_setter.html @@ -0,0 +1,13 @@ +<!doctype html> +<title>onclick setter/getter</title> +<div id=x>Fail</div> +<script src=asserts.js></script> +<script> +assert(document.getElementById("x").onclick === null); +function myFunction() { + this.textContent = "hello" +} +document.getElementById("x").onclick = myFunction; +assert(myFunction == document.getElementById("x").onclick); +document.getElementById("x").textContent = "Success"; +</script> diff --git a/test/js/xhr.html b/test/js/xhr.html new file mode 100644 index 00000000..4bd66b95 --- /dev/null +++ b/test/js/xhr.html @@ -0,0 +1,17 @@ +<!doctype html> +<title>onclick setter/getter</title> +<div id=x>Fail</div> +<script src=asserts.js></script> +<script> +const x = new XMLHttpRequest(); +assert(x.onreadystatechange === null); +function myFunction() { + console.log("change"); +} +x.onreadystatechange = myFunction; +assert(myFunction === x.onreadystatechange); +assert(x.readyState === XMLHttpRequest.UNSENT); +x.open("GET", ""); +document.getElementById("x").textContent = "Success"; +x.send(); +</script> |