Skip to content

Commit

Permalink
Add form getter for input/button elements; update test expectations
Browse files Browse the repository at this point in the history
  • Loading branch information
Manishearth committed Sep 24, 2015
1 parent ed30923 commit b677f0f
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 21 deletions.
7 changes: 6 additions & 1 deletion components/script/dom/htmlbuttonelement.rs
Expand Up @@ -15,7 +15,7 @@ use dom::event::Event;
use dom::eventtarget::{EventTarget, EventTargetTypeId}; use dom::eventtarget::{EventTarget, EventTargetTypeId};
use dom::htmlelement::{HTMLElement, HTMLElementTypeId}; use dom::htmlelement::{HTMLElement, HTMLElementTypeId};
use dom::htmlformelement::{FormControl, FormSubmitter}; use dom::htmlformelement::{FormControl, FormSubmitter};
use dom::htmlformelement::{SubmittedFrom}; use dom::htmlformelement::{SubmittedFrom, HTMLFormElement};
use dom::node::{Node, NodeTypeId, document_from_node, window_from_node}; use dom::node::{Node, NodeTypeId, document_from_node, window_from_node};
use dom::validitystate::ValidityState; use dom::validitystate::ValidityState;
use dom::virtualmethods::VirtualMethods; use dom::virtualmethods::VirtualMethods;
Expand Down Expand Up @@ -82,6 +82,11 @@ impl HTMLButtonElementMethods for HTMLButtonElement {
// https://www.whatwg.org/html/#dom-fe-disabled // https://www.whatwg.org/html/#dom-fe-disabled
make_bool_setter!(SetDisabled, "disabled"); make_bool_setter!(SetDisabled, "disabled");


// https://html.spec.whatwg.org/multipage#dom-fae-form
fn GetForm(&self) -> Option<Root<HTMLFormElement>> {
self.form_owner()
}

// https://html.spec.whatwg.org/multipage/#dom-button-type // https://html.spec.whatwg.org/multipage/#dom-button-type
fn Type(&self) -> DOMString { fn Type(&self) -> DOMString {
let elem = ElementCast::from_ref(self); let elem = ElementCast::from_ref(self);
Expand Down
5 changes: 5 additions & 0 deletions components/script/dom/htmlinputelement.rs
Expand Up @@ -229,6 +229,11 @@ impl HTMLInputElementMethods for HTMLInputElement {
// https://www.whatwg.org/html/#dom-fe-disabled // https://www.whatwg.org/html/#dom-fe-disabled
make_bool_setter!(SetDisabled, "disabled"); make_bool_setter!(SetDisabled, "disabled");


// https://html.spec.whatwg.org/multipage/#dom-fae-form
fn GetForm(&self) -> Option<Root<HTMLFormElement>> {
self.form_owner()
}

// https://html.spec.whatwg.org/multipage/#dom-input-defaultchecked // https://html.spec.whatwg.org/multipage/#dom-input-defaultchecked
make_bool_getter!(DefaultChecked, "checked"); make_bool_getter!(DefaultChecked, "checked");


Expand Down
2 changes: 1 addition & 1 deletion components/script/dom/webidls/HTMLButtonElement.webidl
Expand Up @@ -7,7 +7,7 @@
interface HTMLButtonElement : HTMLElement { interface HTMLButtonElement : HTMLElement {
// attribute boolean autofocus; // attribute boolean autofocus;
attribute boolean disabled; attribute boolean disabled;
//readonly attribute HTMLFormElement? form; readonly attribute HTMLFormElement? form;
attribute DOMString formAction; attribute DOMString formAction;
attribute DOMString formEnctype; attribute DOMString formEnctype;
attribute DOMString formMethod; attribute DOMString formMethod;
Expand Down
2 changes: 1 addition & 1 deletion components/script/dom/webidls/HTMLInputElement.webidl
Expand Up @@ -13,7 +13,7 @@ interface HTMLInputElement : HTMLElement {
attribute boolean checked; attribute boolean checked;
// attribute DOMString dirName; // attribute DOMString dirName;
attribute boolean disabled; attribute boolean disabled;
//readonly attribute HTMLFormElement? form; readonly attribute HTMLFormElement? form;
//readonly attribute FileList? files; //readonly attribute FileList? files;
attribute DOMString formAction; attribute DOMString formAction;
attribute DOMString formEnctype; attribute DOMString formEnctype;
Expand Down
12 changes: 0 additions & 12 deletions tests/wpt/metadata/html/dom/interfaces.html.ini
Expand Up @@ -5079,9 +5079,6 @@
[HTMLInputElement interface: attribute dirName] [HTMLInputElement interface: attribute dirName]
expected: FAIL expected: FAIL


[HTMLInputElement interface: attribute form]
expected: FAIL

[HTMLInputElement interface: attribute files] [HTMLInputElement interface: attribute files]
expected: FAIL expected: FAIL


Expand Down Expand Up @@ -5208,9 +5205,6 @@
[HTMLInputElement interface: document.createElement("input") must inherit property "dirName" with the proper type (6)] [HTMLInputElement interface: document.createElement("input") must inherit property "dirName" with the proper type (6)]
expected: FAIL expected: FAIL


[HTMLInputElement interface: document.createElement("input") must inherit property "form" with the proper type (8)]
expected: FAIL

[HTMLInputElement interface: document.createElement("input") must inherit property "files" with the proper type (9)] [HTMLInputElement interface: document.createElement("input") must inherit property "files" with the proper type (9)]
expected: FAIL expected: FAIL


Expand Down Expand Up @@ -5346,9 +5340,6 @@
[HTMLButtonElement interface: attribute autofocus] [HTMLButtonElement interface: attribute autofocus]
expected: FAIL expected: FAIL


[HTMLButtonElement interface: attribute form]
expected: FAIL

[HTMLButtonElement interface: attribute formNoValidate] [HTMLButtonElement interface: attribute formNoValidate]
expected: FAIL expected: FAIL


Expand Down Expand Up @@ -5376,9 +5367,6 @@
[HTMLButtonElement interface: document.createElement("button") must inherit property "autofocus" with the proper type (0)] [HTMLButtonElement interface: document.createElement("button") must inherit property "autofocus" with the proper type (0)]
expected: FAIL expected: FAIL


[HTMLButtonElement interface: document.createElement("button") must inherit property "form" with the proper type (2)]
expected: FAIL

[HTMLButtonElement interface: document.createElement("button") must inherit property "formNoValidate" with the proper type (6)] [HTMLButtonElement interface: document.createElement("button") must inherit property "formNoValidate" with the proper type (6)]
expected: FAIL expected: FAIL


Expand Down
@@ -1,14 +1,8 @@
[form.html] [form.html]
type: testharness type: testharness
[button.form]
expected: FAIL

[fieldset.form] [fieldset.form]
expected: FAIL expected: FAIL


[input.form]
expected: FAIL

[keygen.form] [keygen.form]
expected: FAIL expected: FAIL


Expand Down

0 comments on commit b677f0f

Please sign in to comment.