Auto merge of #11697 - mrmiywj:form-index-getter, r=Ms2ger

indexed getter of form elements

<!-- 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. -->

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/11697)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2016-06-15 01:10:49 -05:00 committed by GitHub
commit 2086d216dd
5 changed files with 36 additions and 6 deletions

View file

@ -36064,6 +36064,12 @@
"url": "/html/semantics/embedded-content/the-iframe-element/same_origin_parentage.html"
}
],
"html/semantics/forms/the-form-element/form-indexed-element.html": [
{
"path": "html/semantics/forms/the-form-element/form-indexed-element.html",
"url": "/html/semantics/forms/the-form-element/form-indexed-element.html"
}
],
"url/url-domainToUnicode.html": [
{
"path": "url/url-domainToUnicode.html",

View file

@ -1,5 +0,0 @@
[031.html]
type: testharness
[ scheduler: focus and blur events]
expected: FAIL

View file

@ -0,0 +1,22 @@
<!doctype html>
<meta charset="utf-8">
<title>form.elements: indexed</title>
<link rel="author" title="Ivan.Yang" href="mailto:jsyangwenjie@gmail.com">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<div id="test">
<form id=form>
<input type="radio" name="radio1" id="r1" value=1>
<input type="radio" name="radio2" id="r2" value=2>
</form>
</div>
<script>
test(function() {
var form = document.getElementById("form");
assert_equals(form[0], document.getElementById("r1"));
assert_equals(form[1], document.getElementById("r2"));
assert_equals(form[2], undefined);
assert_equals(form[-1], undefined);
}, "form.elements should be accessed correctly by index")
</script>