From f72d153c8d91b1d273cc1563646871ccfa28169b Mon Sep 17 00:00:00 2001 From: Corey Farwell Date: Sun, 10 Jan 2016 13:39:33 -0500 Subject: [PATCH] Implement HTMLFormElement::Length --- components/script/dom/htmlformelement.rs | 5 +++++ components/script/dom/webidls/HTMLFormElement.webidl | 2 +- tests/wpt/metadata/html/dom/interfaces.html.ini | 6 ------ .../forms/the-form-element/form-nameditem.html.ini | 6 ------ 4 files changed, 6 insertions(+), 13 deletions(-) diff --git a/components/script/dom/htmlformelement.rs b/components/script/dom/htmlformelement.rs index 072231d4054..43cf6bce3ce 100644 --- a/components/script/dom/htmlformelement.rs +++ b/components/script/dom/htmlformelement.rs @@ -195,6 +195,11 @@ impl HTMLFormElementMethods for HTMLFormElement { let window = window_from_node(self); HTMLFormControlsCollection::new(window.r(), self.upcast(), filter) } + + // https://html.spec.whatwg.org/multipage/#dom-form-length + fn Length(&self) -> i32 { + self.Elements().Length() as i32 + } } #[derive(Copy, Clone, HeapSizeOf, PartialEq)] diff --git a/components/script/dom/webidls/HTMLFormElement.webidl b/components/script/dom/webidls/HTMLFormElement.webidl index 4fde856a6a5..d97de7dd22d 100644 --- a/components/script/dom/webidls/HTMLFormElement.webidl +++ b/components/script/dom/webidls/HTMLFormElement.webidl @@ -17,7 +17,7 @@ interface HTMLFormElement : HTMLElement { attribute DOMString target; [SameObject] readonly attribute HTMLFormControlsCollection elements; - //readonly attribute long length; + readonly attribute long length; //getter Element (unsigned long index); //getter (RadioNodeList or Element) (DOMString name); diff --git a/tests/wpt/metadata/html/dom/interfaces.html.ini b/tests/wpt/metadata/html/dom/interfaces.html.ini index 30a17856204..0a4948517a1 100644 --- a/tests/wpt/metadata/html/dom/interfaces.html.ini +++ b/tests/wpt/metadata/html/dom/interfaces.html.ini @@ -4758,9 +4758,6 @@ [HTMLFormElement interface: existence and properties of interface object] expected: FAIL - [HTMLFormElement interface: attribute length] - expected: FAIL - [HTMLFormElement interface: operation checkValidity()] expected: FAIL @@ -4770,9 +4767,6 @@ [HTMLFormElement interface: operation requestAutocomplete()] expected: FAIL - [HTMLFormElement interface: document.createElement("form") must inherit property "length" with the proper type (10)] - expected: FAIL - [HTMLFormElement interface: document.createElement("form") must inherit property "checkValidity" with the proper type (15)] expected: FAIL diff --git a/tests/wpt/metadata/html/semantics/forms/the-form-element/form-nameditem.html.ini b/tests/wpt/metadata/html/semantics/forms/the-form-element/form-nameditem.html.ini index 9409afa1a8a..3afc5ac928d 100644 --- a/tests/wpt/metadata/html/semantics/forms/the-form-element/form-nameditem.html.ini +++ b/tests/wpt/metadata/html/semantics/forms/the-form-element/form-nameditem.html.ini @@ -15,12 +15,6 @@ [Named elements should override builtins] expected: FAIL - [Named items outside the form should not be returned (no children)] - expected: FAIL - - [Named items outside the form should not be returned (one child)] - expected: FAIL - [The form attribute should be taken into account for named getters (single element)] expected: FAIL