mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Implement <option> 'defaultSelected' and 'selected' attributes
Continued from #7743
This commit is contained in:
parent
37ce248f31
commit
dec0031112
6 changed files with 111 additions and 124 deletions
|
@ -17351,6 +17351,10 @@
|
|||
"path": "html/semantics/forms/the-option-element/option-label.html",
|
||||
"url": "/html/semantics/forms/the-option-element/option-label.html"
|
||||
},
|
||||
{
|
||||
"path": "html/semantics/forms/the-option-element/option-selected.html",
|
||||
"url": "/html/semantics/forms/the-option-element/option-selected.html"
|
||||
},
|
||||
{
|
||||
"path": "html/semantics/forms/the-option-element/option-text-backslash.html",
|
||||
"url": "/html/semantics/forms/the-option-element/option-text-backslash.html"
|
||||
|
|
|
@ -5520,24 +5520,12 @@
|
|||
[HTMLOptionElement interface: attribute form]
|
||||
expected: FAIL
|
||||
|
||||
[HTMLOptionElement interface: attribute defaultSelected]
|
||||
expected: FAIL
|
||||
|
||||
[HTMLOptionElement interface: attribute selected]
|
||||
expected: FAIL
|
||||
|
||||
[HTMLOptionElement interface: attribute index]
|
||||
expected: FAIL
|
||||
|
||||
[HTMLOptionElement interface: document.createElement("option") must inherit property "form" with the proper type (1)]
|
||||
expected: FAIL
|
||||
|
||||
[HTMLOptionElement interface: document.createElement("option") must inherit property "defaultSelected" with the proper type (3)]
|
||||
expected: FAIL
|
||||
|
||||
[HTMLOptionElement interface: document.createElement("option") must inherit property "selected" with the proper type (4)]
|
||||
expected: FAIL
|
||||
|
||||
[HTMLOptionElement interface: document.createElement("option") must inherit property "index" with the proper type (7)]
|
||||
expected: FAIL
|
||||
|
||||
|
|
|
@ -10542,114 +10542,6 @@
|
|||
[option.tabIndex: IDL set to -2147483648 followed by getAttribute()]
|
||||
expected: FAIL
|
||||
|
||||
[option.defaultSelected (<option selected>): typeof IDL attribute]
|
||||
expected: FAIL
|
||||
|
||||
[option.defaultSelected (<option selected>): IDL get with DOM attribute unset]
|
||||
expected: FAIL
|
||||
|
||||
[option.defaultSelected (<option selected>): setAttribute() to "" followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
[option.defaultSelected (<option selected>): setAttribute() to " foo " followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
[option.defaultSelected (<option selected>): setAttribute() to undefined followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
[option.defaultSelected (<option selected>): setAttribute() to null followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
[option.defaultSelected (<option selected>): setAttribute() to 7 followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
[option.defaultSelected (<option selected>): setAttribute() to 1.5 followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
[option.defaultSelected (<option selected>): setAttribute() to true followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
[option.defaultSelected (<option selected>): setAttribute() to false followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
[option.defaultSelected (<option selected>): setAttribute() to object "[object Object\]" followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
[option.defaultSelected (<option selected>): setAttribute() to NaN followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
[option.defaultSelected (<option selected>): setAttribute() to Infinity followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
[option.defaultSelected (<option selected>): setAttribute() to -Infinity followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
[option.defaultSelected (<option selected>): setAttribute() to "\\0" followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
[option.defaultSelected (<option selected>): setAttribute() to object "test-toString" followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
[option.defaultSelected (<option selected>): setAttribute() to object "test-valueOf" followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
[option.defaultSelected (<option selected>): setAttribute() to "selected" followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
[option.defaultSelected (<option selected>): IDL set to "" followed by hasAttribute()]
|
||||
expected: FAIL
|
||||
|
||||
[option.defaultSelected (<option selected>): IDL set to "" followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
[option.defaultSelected (<option selected>): IDL set to " foo " followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
[option.defaultSelected (<option selected>): IDL set to undefined followed by hasAttribute()]
|
||||
expected: FAIL
|
||||
|
||||
[option.defaultSelected (<option selected>): IDL set to undefined followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
[option.defaultSelected (<option selected>): IDL set to null followed by hasAttribute()]
|
||||
expected: FAIL
|
||||
|
||||
[option.defaultSelected (<option selected>): IDL set to null followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
[option.defaultSelected (<option selected>): IDL set to 7 followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
[option.defaultSelected (<option selected>): IDL set to 1.5 followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
[option.defaultSelected (<option selected>): IDL set to false followed by hasAttribute()]
|
||||
expected: FAIL
|
||||
|
||||
[option.defaultSelected (<option selected>): IDL set to object "[object Object\]" followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
[option.defaultSelected (<option selected>): IDL set to NaN followed by hasAttribute()]
|
||||
expected: FAIL
|
||||
|
||||
[option.defaultSelected (<option selected>): IDL set to NaN followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
[option.defaultSelected (<option selected>): IDL set to Infinity followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
[option.defaultSelected (<option selected>): IDL set to -Infinity followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
[option.defaultSelected (<option selected>): IDL set to "\\0" followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
[option.defaultSelected (<option selected>): IDL set to object "test-toString" followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
[option.defaultSelected (<option selected>): IDL set to object "test-valueOf" followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
[option.itemScope: typeof IDL attribute]
|
||||
expected: FAIL
|
||||
|
||||
|
|
|
@ -0,0 +1,61 @@
|
|||
<!doctype html>
|
||||
<meta charset=utf-8>
|
||||
<title>HTMLOptionElement.selected</title>
|
||||
<link rel=author title="Corey Farwell" href="mailto:coreyf@rwell.org">
|
||||
<link rel=help href="https://html.spec.whatwg.org/multipage/forms.html#dom-option-selected">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id=log></div>
|
||||
|
||||
<script>
|
||||
test(function () {
|
||||
var elem = document.createElement("option");
|
||||
assert_equals(elem.selected, false);
|
||||
|
||||
elem.setAttribute("selected", "");
|
||||
assert_equals(elem.selected, true);
|
||||
|
||||
elem.removeAttribute("selected");
|
||||
assert_equals(elem.selected, false);
|
||||
|
||||
elem.defaultSelected = true
|
||||
assert_equals(elem.selected, true);
|
||||
|
||||
elem.defaultSelected = false;
|
||||
assert_equals(elem.selected, false);
|
||||
}, "not dirty");
|
||||
|
||||
test(function () {
|
||||
testDirty(true);
|
||||
}, "dirty, selected");
|
||||
|
||||
test(function () {
|
||||
testDirty(false);
|
||||
}, "dirty, not selected");
|
||||
|
||||
function testDirty(isSelected) {
|
||||
var elem = document.createElement("option");
|
||||
|
||||
elem.selected = isSelected; // After this assignment, dirtiness=true
|
||||
assertDirty(elem, isSelected);
|
||||
|
||||
elem.selected = !isSelected; // Change the value, still dirty
|
||||
assertDirty(elem, !isSelected);
|
||||
};
|
||||
|
||||
function assertDirty(elem, expect) {
|
||||
assert_equals(elem.selected, expect);
|
||||
|
||||
elem.setAttribute("selected", "");
|
||||
assert_equals(elem.selected, expect);
|
||||
|
||||
elem.removeAttribute("selected");
|
||||
assert_equals(elem.selected, expect);
|
||||
|
||||
elem.defaultSelected = true;
|
||||
assert_equals(elem.selected, expect);
|
||||
|
||||
elem.defaultSelected = false;
|
||||
assert_equals(elem.selected, expect);
|
||||
}
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue