mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +01:00
Implements reset button
This commit is contained in:
parent
7e0c39a82d
commit
4d0a6a6bd6
2 changed files with 27 additions and 1 deletions
|
@ -27,7 +27,7 @@ use dom::eventtarget::{EventTarget, NodeTargetTypeId};
|
|||
use dom::htmlelement::HTMLElement;
|
||||
use dom::keyboardevent::KeyboardEvent;
|
||||
use dom::htmlformelement::{InputElement, FormControl, HTMLFormElement, HTMLFormElementHelpers};
|
||||
use dom::htmlformelement::{NotFromFormSubmitMethod};
|
||||
use dom::htmlformelement::{NotFromFormSubmitMethod, NotFromFormResetMethod};
|
||||
use dom::node::{DisabledStateHelpers, Node, NodeHelpers, ElementNodeTypeId, OtherNodeDamage};
|
||||
use dom::node::{document_from_node, window_from_node};
|
||||
use dom::virtualmethods::VirtualMethods;
|
||||
|
@ -701,6 +701,15 @@ impl<'a> Activatable for JSRef<'a, HTMLInputElement> {
|
|||
});
|
||||
}
|
||||
},
|
||||
InputReset => {
|
||||
// https://html.spec.whatwg.org/multipage/forms.html#reset-button-state-(type=reset):activation-behavior
|
||||
// FIXME (Manishearth): support document owners (needs ability to get parent browsing context)
|
||||
if self.mutable() /* and document owner is fully active */ {
|
||||
self.form_owner().map(|o| {
|
||||
o.root().reset(NotFromFormResetMethod)
|
||||
});
|
||||
}
|
||||
},
|
||||
InputCheckbox | InputRadio => {
|
||||
// https://html.spec.whatwg.org/multipage/forms.html#checkbox-state-(type=checkbox):activation-behavior
|
||||
// https://html.spec.whatwg.org/multipage/forms.html#radio-button-state-(type=radio):activation-behavior
|
||||
|
|
17
tests/html/form_reset.html
Normal file
17
tests/html/form_reset.html
Normal file
|
@ -0,0 +1,17 @@
|
|||
<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>
|
||||
<textarea id=textarea>Hello
|
||||
TextArea!</textarea>
|
||||
<input type=reset>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
Loading…
Add table
Add a link
Reference in a new issue