Skip to content
Permalink
Browse files

Implements DefaultChecked and resets of checkboxes

  • Loading branch information
mttr committed Dec 16, 2014
1 parent a5c0bb7 commit 38e4d86b148c198771f3917c0e0d6f2a639a0ca1
Showing with 11 additions and 7 deletions.
  1. +10 −6 components/script/dom/htmlinputelement.rs
  2. +1 −1 components/script/dom/webidls/HTMLInputElement.webidl
@@ -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;

0 comments on commit 38e4d86

Please sign in to comment.
You can’t perform that action at this time.