Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implements basic form resetting #4133

Merged
merged 12 commits into from Dec 16, 2014

Implements DefaultChecked and resets of checkboxes

  • Loading branch information
mttr committed Dec 16, 2014
commit 38e4d86b148c198771f3917c0e0d6f2a639a0ca1
@@ -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;
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.