Implement 'htmlFor' attribute for <label> elements

This commit is contained in:
Corey Farwell 2015-10-24 13:09:15 -04:00
parent f97d1d148b
commit 98a6fc07e2
5 changed files with 7 additions and 139 deletions

View file

@ -46,6 +46,12 @@ impl HTMLLabelElementMethods for HTMLLabelElement {
self.form_owner()
}
// https://html.spec.whatwg.org/multipage/#dom-label-htmlfor
make_getter!(HtmlFor, "for");
// https://html.spec.whatwg.org/multipage/#dom-label-htmlfor
make_atomic_setter!(SetHtmlFor, "for");
// https://html.spec.whatwg.org/multipage/#dom-label-control
fn GetControl(&self) -> Option<Root<HTMLElement>> {
if !self.upcast::<Node>().is_in_doc() {

View file

@ -6,6 +6,6 @@
// https://html.spec.whatwg.org/multipage/#htmllabelelement
interface HTMLLabelElement : HTMLElement {
readonly attribute HTMLFormElement? form;
// attribute DOMString htmlFor;
attribute DOMString htmlFor;
readonly attribute HTMLElement? control;
};

View file

@ -4881,12 +4881,6 @@
[HTMLLabelElement interface: existence and properties of interface object]
expected: FAIL
[HTMLLabelElement interface: attribute htmlFor]
expected: FAIL
[HTMLLabelElement interface: document.createElement("label") must inherit property "htmlFor" with the proper type (1)]
expected: FAIL
[HTMLInputElement interface: existence and properties of interface object]
expected: FAIL

View file

@ -2913,135 +2913,6 @@
[label.tabIndex: IDL set to -2147483648 followed by getAttribute()]
expected: FAIL
[label.htmlFor (<label for>): typeof IDL attribute]
expected: FAIL
[label.htmlFor (<label for>): IDL get with DOM attribute unset]
expected: FAIL
[label.htmlFor (<label for>): setAttribute() to "" followed by IDL get]
expected: FAIL
[label.htmlFor (<label for>): setAttribute() to " \\0\\x01\\x02\\x03\\x04\\x05\\x06\\x07 \\b\\t\\n\\v\\f\\r\\x0e\\x0f \\x10\\x11\\x12\\x13\\x14\\x15\\x16\\x17 \\x18\\x19\\x1a\\x1b\\x1c\\x1d\\x1e\\x1f foo " followed by IDL get]
expected: FAIL
[label.htmlFor (<label for>): setAttribute() to undefined followed by IDL get]
expected: FAIL
[label.htmlFor (<label for>): setAttribute() to 7 followed by IDL get]
expected: FAIL
[label.htmlFor (<label for>): setAttribute() to 1.5 followed by IDL get]
expected: FAIL
[label.htmlFor (<label for>): setAttribute() to true followed by IDL get]
expected: FAIL
[label.htmlFor (<label for>): setAttribute() to false followed by IDL get]
expected: FAIL
[label.htmlFor (<label for>): setAttribute() to object "[object Object\]" followed by IDL get]
expected: FAIL
[label.htmlFor (<label for>): setAttribute() to NaN followed by IDL get]
expected: FAIL
[label.htmlFor (<label for>): setAttribute() to Infinity followed by IDL get]
expected: FAIL
[label.htmlFor (<label for>): setAttribute() to -Infinity followed by IDL get]
expected: FAIL
[label.htmlFor (<label for>): setAttribute() to "\\0" followed by IDL get]
expected: FAIL
[label.htmlFor (<label for>): setAttribute() to null followed by IDL get]
expected: FAIL
[label.htmlFor (<label for>): setAttribute() to object "test-toString" followed by IDL get]
expected: FAIL
[label.htmlFor (<label for>): setAttribute() to object "test-valueOf" followed by IDL get]
expected: FAIL
[label.htmlFor (<label for>): IDL set to "" followed by getAttribute()]
expected: FAIL
[label.htmlFor (<label for>): IDL set to " \\0\\x01\\x02\\x03\\x04\\x05\\x06\\x07 \\b\\t\\n\\v\\f\\r\\x0e\\x0f \\x10\\x11\\x12\\x13\\x14\\x15\\x16\\x17 \\x18\\x19\\x1a\\x1b\\x1c\\x1d\\x1e\\x1f foo " followed by getAttribute()]
expected: FAIL
[label.htmlFor (<label for>): IDL set to undefined followed by getAttribute()]
expected: FAIL
[label.htmlFor (<label for>): IDL set to undefined followed by IDL get]
expected: FAIL
[label.htmlFor (<label for>): IDL set to 7 followed by getAttribute()]
expected: FAIL
[label.htmlFor (<label for>): IDL set to 7 followed by IDL get]
expected: FAIL
[label.htmlFor (<label for>): IDL set to 1.5 followed by getAttribute()]
expected: FAIL
[label.htmlFor (<label for>): IDL set to 1.5 followed by IDL get]
expected: FAIL
[label.htmlFor (<label for>): IDL set to true followed by getAttribute()]
expected: FAIL
[label.htmlFor (<label for>): IDL set to true followed by IDL get]
expected: FAIL
[label.htmlFor (<label for>): IDL set to false followed by getAttribute()]
expected: FAIL
[label.htmlFor (<label for>): IDL set to false followed by IDL get]
expected: FAIL
[label.htmlFor (<label for>): IDL set to object "[object Object\]" followed by getAttribute()]
expected: FAIL
[label.htmlFor (<label for>): IDL set to object "[object Object\]" followed by IDL get]
expected: FAIL
[label.htmlFor (<label for>): IDL set to NaN followed by getAttribute()]
expected: FAIL
[label.htmlFor (<label for>): IDL set to NaN followed by IDL get]
expected: FAIL
[label.htmlFor (<label for>): IDL set to Infinity followed by getAttribute()]
expected: FAIL
[label.htmlFor (<label for>): IDL set to Infinity followed by IDL get]
expected: FAIL
[label.htmlFor (<label for>): IDL set to -Infinity followed by getAttribute()]
expected: FAIL
[label.htmlFor (<label for>): IDL set to -Infinity followed by IDL get]
expected: FAIL
[label.htmlFor (<label for>): IDL set to "\\0" followed by getAttribute()]
expected: FAIL
[label.htmlFor (<label for>): IDL set to null followed by getAttribute()]
expected: FAIL
[label.htmlFor (<label for>): IDL set to null followed by IDL get]
expected: FAIL
[label.htmlFor (<label for>): IDL set to object "test-toString" followed by getAttribute()]
expected: FAIL
[label.htmlFor (<label for>): IDL set to object "test-toString" followed by IDL get]
expected: FAIL
[label.htmlFor (<label for>): IDL set to object "test-valueOf" followed by IDL get]
expected: FAIL
[label.itemScope: typeof IDL attribute]
expected: FAIL

View file

@ -12,6 +12,3 @@
[A form control has no label 2.]
expected: FAIL
[A label's htmlFor attribute must reflect the for content attribute]
expected: FAIL