mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-01 14:45:29 +00:00
4f922915fe
We can reset `<input type=text>` fields! I wish I could've done something with checkboxes, but unfortunately, that's it for now. In addition to that, this PR implements `HTMLInputAttribute.defaultValue`, updates wpt-test to expect passing tests as a result of that implementation, and fixes an index error crash with text inputs. edit: also includes an html example where one may lazily watch form resets in action: ` tests/html/form_reset_handsfree.html` Source-Repo: https://github.com/servo/servo Source-Revision: 5951056973fc0e08e70224214740a274ca8ef20f
26 lines
598 B
HTML
26 lines
598 B
HTML
<html>
|
|
<head></head>
|
|
<body>
|
|
<form>
|
|
<textarea id="textarea">Write something here
|
|
and maybe here</textarea>
|
|
<button id=setcontent type=button>setContent</button>
|
|
<button id=setvalue type=button>setValue</button>
|
|
<input type=reset>
|
|
<script>
|
|
var text_area = document.getElementById("textarea");
|
|
var set_c = document.getElementById("setcontent");
|
|
var value = document.getElementById("setvalue");
|
|
var x = 0;
|
|
|
|
set_c.addEventListener("click", function () {
|
|
text_area.textContent = x;
|
|
x++;
|
|
});
|
|
|
|
value.addEventListener("click", function () {
|
|
text_area.value = "new value!";
|
|
});
|
|
</script>
|
|
</body>
|