mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
Implements DefaultChecked and resets of checkboxes
This commit is contained in:
parent
a5c0bb708d
commit
38e4d86b14
2 changed files with 11 additions and 7 deletions
|
@ -183,6 +183,12 @@ impl<'a> HTMLInputElementMethods for JSRef<'a, HTMLInputElement> {
|
|||
// http://www.whatwg.org/html/#dom-fe-disabled
|
||||
make_bool_setter!(SetDisabled, "disabled")
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/forms.html#dom-input-defaultchecked
|
||||
make_bool_getter!(DefaultChecked, "checked")
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/forms.html#dom-input-defaultchecked
|
||||
make_bool_setter!(SetDefaultChecked, "checked")
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/forms.html#dom-input-checked
|
||||
fn Checked(self) -> bool {
|
||||
self.checked.get()
|
||||
|
@ -573,13 +579,11 @@ impl<'a> FormControl<'a> for JSRef<'a, HTMLInputElement> {
|
|||
}
|
||||
|
||||
fn reset(self) {
|
||||
let ty = self.Type();
|
||||
|
||||
match ty.as_slice() {
|
||||
"radio" | "checkbox" => {
|
||||
// TODO Reset radios/checkboxes here
|
||||
match self.input_type.get() {
|
||||
InputRadio | InputCheckbox => {
|
||||
self.SetChecked(self.DefaultChecked());
|
||||
},
|
||||
"image" => (),
|
||||
InputImage => (),
|
||||
_ => ()
|
||||
}
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ interface HTMLInputElement : HTMLElement {
|
|||
// attribute DOMString alt;
|
||||
// attribute DOMString autocomplete;
|
||||
// attribute boolean autofocus;
|
||||
// attribute boolean defaultChecked;
|
||||
attribute boolean defaultChecked;
|
||||
attribute boolean checked;
|
||||
// attribute DOMString dirName;
|
||||
attribute boolean disabled;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue