mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +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
|
// http://www.whatwg.org/html/#dom-fe-disabled
|
||||||
make_bool_setter!(SetDisabled, "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
|
// https://html.spec.whatwg.org/multipage/forms.html#dom-input-checked
|
||||||
fn Checked(self) -> bool {
|
fn Checked(self) -> bool {
|
||||||
self.checked.get()
|
self.checked.get()
|
||||||
|
@ -573,13 +579,11 @@ impl<'a> FormControl<'a> for JSRef<'a, HTMLInputElement> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn reset(self) {
|
fn reset(self) {
|
||||||
let ty = self.Type();
|
match self.input_type.get() {
|
||||||
|
InputRadio | InputCheckbox => {
|
||||||
match ty.as_slice() {
|
self.SetChecked(self.DefaultChecked());
|
||||||
"radio" | "checkbox" => {
|
|
||||||
// TODO Reset radios/checkboxes here
|
|
||||||
},
|
},
|
||||||
"image" => (),
|
InputImage => (),
|
||||||
_ => ()
|
_ => ()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ interface HTMLInputElement : HTMLElement {
|
||||||
// attribute DOMString alt;
|
// attribute DOMString alt;
|
||||||
// attribute DOMString autocomplete;
|
// attribute DOMString autocomplete;
|
||||||
// attribute boolean autofocus;
|
// attribute boolean autofocus;
|
||||||
// attribute boolean defaultChecked;
|
attribute boolean defaultChecked;
|
||||||
attribute boolean checked;
|
attribute boolean checked;
|
||||||
// attribute DOMString dirName;
|
// attribute DOMString dirName;
|
||||||
attribute boolean disabled;
|
attribute boolean disabled;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue