Implements basic form resetting

What can this do? Reset `<input type=text>` fields back to their default
value through a call to a form's reset method. That's all for now!

Fixes compile error after rebase
This commit is contained in:
Matthew Rasmus 2014-11-27 15:48:01 -08:00
parent f932a6947a
commit f0ce2af89c
3 changed files with 96 additions and 1 deletions

View file

@ -0,0 +1,23 @@
<html>
<head></head>
<body>
<!-- Run with nc -l 8000 -->
<form action="http://localhost:8000" method=get id="foo">
<input name=bar type=checkbox checked>
<input name=baz value="baz1" type=radio checked>
<input name=baz value="baz2" type=radio>
<input type=text id=hi name=bye value="hi!">
<input type=text id=aloha name=empty value="">
<input type=text id=welcome name=reallyempty>
<script>
// setTimeout because https://github.com/servo/servo/issues/3628
setTimeout(function(){
document.getElementById("hi").value=("bloop");
document.getElementById("aloha").value=("bloop");
document.getElementById("welcome").value=("bloop");
setTimeout(function(){document.getElementById("foo").reset()},2000);
},2000)
</script>
</form>
</body>
</html>