servo: Merge #11697 - indexed getter of form elements (from mrmiywj:form-index-getter); r=Ms2ger

<!-- Please describe your changes on the following line: -->

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix #11405 (github issue number if applicable).

<!-- Either: -->
- [X] There are tests for these changes OR
- [ ] These changes do not require tests because _____

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

Source-Repo: https://github.com/servo/servo
Source-Revision: 2086d216ddf2cf87f44dd2da44281daaf810e0a0
This commit is contained in:
mrmiywj 2016-06-15 01:10:49 -05:00
parent acee66a283
commit 22828e691d
2 changed files with 8 additions and 1 deletions

View File

@ -6,6 +6,7 @@ use dom::bindings::codegen::Bindings::BlobBinding::BlobMethods;
use dom::bindings::codegen::Bindings::DocumentBinding::DocumentMethods;
use dom::bindings::codegen::Bindings::EventBinding::EventMethods;
use dom::bindings::codegen::Bindings::HTMLButtonElementBinding::HTMLButtonElementMethods;
use dom::bindings::codegen::Bindings::HTMLFormControlsCollectionBinding::HTMLFormControlsCollectionMethods;
use dom::bindings::codegen::Bindings::HTMLFormElementBinding;
use dom::bindings::codegen::Bindings::HTMLFormElementBinding::HTMLFormElementMethods;
use dom::bindings::codegen::Bindings::HTMLInputElementBinding::HTMLInputElementMethods;
@ -229,6 +230,12 @@ impl HTMLFormElementMethods for HTMLFormElement {
fn Length(&self) -> u32 {
self.Elements().Length() as u32
}
// https://html.spec.whatwg.org/multipage/#dom-form-item
fn IndexedGetter(&self, index: u32, found: &mut bool) -> Option<Root<Element>> {
let elements = self.Elements();
elements.IndexedGetter(index, found)
}
}
#[derive(Copy, Clone, HeapSizeOf, PartialEq)]

View File

@ -17,7 +17,7 @@ interface HTMLFormElement : HTMLElement {
[SameObject] readonly attribute HTMLFormControlsCollection elements;
readonly attribute unsigned long length;
//getter Element (unsigned long index);
getter Element? (unsigned long index);
//getter (RadioNodeList or Element) (DOMString name);
void submit();