diff options
15 files changed, 43 insertions, 200 deletions
diff --git a/components/script/dom/document.rs b/components/script/dom/document.rs index f282aa3b483..fad44638f64 100644 --- a/components/script/dom/document.rs +++ b/components/script/dom/document.rs @@ -966,7 +966,6 @@ impl<'a> DocumentMethods for JSRef<'a, Document> { self.ready_state.get() } - event_handler!(click, GetOnclick, SetOnclick) - event_handler!(load, GetOnload, SetOnload) + global_event_handlers!() event_handler!(readystatechange, GetOnreadystatechange, SetOnreadystatechange) } diff --git a/components/script/dom/htmlelement.rs b/components/script/dom/htmlelement.rs index 7467ea56fdf..010946fabc4 100644 --- a/components/script/dom/htmlelement.rs +++ b/components/script/dom/htmlelement.rs @@ -75,7 +75,7 @@ impl<'a> HTMLElementMethods for JSRef<'a, HTMLElement> { make_bool_getter!(Hidden) make_bool_setter!(SetHidden, "hidden") - event_handler!(click, GetOnclick, SetOnclick) + global_event_handlers!(NoOnload) fn GetOnload(self) -> Option<EventHandlerNonNull> { if self.is_body_or_frameset() { diff --git a/components/script/dom/htmlinputelement.rs b/components/script/dom/htmlinputelement.rs index be3b52b4ae6..bfe686330fe 100644 --- a/components/script/dom/htmlinputelement.rs +++ b/components/script/dom/htmlinputelement.rs @@ -633,8 +633,7 @@ impl<'a> Activatable for JSRef<'a, HTMLInputElement> { Some(o) => { // Avoiding iterating through the whole tree here, instead // we can check if the conditions for radio group siblings apply - if name != None && // unless self no longer has a button group - name == o.get_radio_group_name() && // TODO should be compatibility caseless + if name == o.get_radio_group_name() && // TODO should be compatibility caseless self.form_owner() == o.form_owner() && // TODO Both a and b are in the same home subtree o.input_type.get() == InputRadio { diff --git a/components/script/dom/macros.rs b/components/script/dom/macros.rs index 630a112c032..b98d67a090f 100644 --- a/components/script/dom/macros.rs +++ b/components/script/dom/macros.rs @@ -211,3 +211,19 @@ macro_rules! error_event_handler( define_event_handler!(OnErrorEventHandlerNonNull, $event_type, $getter, $setter) ) ) + +// https://html.spec.whatwg.org/multipage/webappapis.html#globaleventhandlers +// see webidls/EventHandler.webidl +// As more methods get added, just update them here. +macro_rules! global_event_handlers( + () => ( + event_handler!(load, GetOnload, SetOnload) + global_event_handlers!(NoOnload) + + ); + (NoOnload) => ( + event_handler!(click, GetOnclick, SetOnclick) + event_handler!(input, GetOninput, SetOninput) + event_handler!(change, GetOnchange, SetOnchange) + ) +)
\ No newline at end of file diff --git a/components/script/dom/webidls/EventHandler.webidl b/components/script/dom/webidls/EventHandler.webidl index 1278d7467fd..de491455302 100644 --- a/components/script/dom/webidls/EventHandler.webidl +++ b/components/script/dom/webidls/EventHandler.webidl @@ -23,6 +23,8 @@ typedef OnErrorEventHandlerNonNull? OnErrorEventHandler; interface GlobalEventHandlers { attribute EventHandler onclick; attribute EventHandler onload; + attribute EventHandler oninput; + attribute EventHandler onchange; }; [NoInterfaceObject] diff --git a/components/script/dom/window.rs b/components/script/dom/window.rs index 0e6e00ed200..da0cc228b0a 100644 --- a/components/script/dom/window.rs +++ b/components/script/dom/window.rs @@ -270,8 +270,7 @@ impl<'a> WindowMethods for JSRef<'a, Window> { self.performance.or_init(|| Performance::new(self)) } - event_handler!(click, GetOnclick, SetOnclick) - event_handler!(load, GetOnload, SetOnload) + global_event_handlers!() event_handler!(unload, GetOnunload, SetOnunload) error_event_handler!(error, GetOnerror, SetOnerror) diff --git a/tests/wpt/metadata/html/dom/interfaces.html.ini b/tests/wpt/metadata/html/dom/interfaces.html.ini index 40fc05cdb10..3a281c37b6f 100644 --- a/tests/wpt/metadata/html/dom/interfaces.html.ini +++ b/tests/wpt/metadata/html/dom/interfaces.html.ini @@ -120,9 +120,6 @@ [Document interface: attribute oncanplaythrough] expected: FAIL - [Document interface: attribute onchange] - expected: FAIL - [Document interface: attribute onclose] expected: FAIL @@ -174,9 +171,6 @@ [Document interface: attribute onfocus] expected: FAIL - [Document interface: attribute oninput] - expected: FAIL - [Document interface: attribute oninvalid] expected: FAIL @@ -984,9 +978,6 @@ [HTMLElement interface: attribute itemValue] expected: FAIL - [HTMLElement interface: operation click()] - expected: FAIL - [HTMLElement interface: attribute tabIndex] expected: FAIL @@ -1062,9 +1053,6 @@ [HTMLElement interface: attribute oncanplaythrough] expected: FAIL - [HTMLElement interface: attribute onchange] - expected: FAIL - [HTMLElement interface: attribute onclose] expected: FAIL @@ -1116,9 +1104,6 @@ [HTMLElement interface: attribute onfocus] expected: FAIL - [HTMLElement interface: attribute oninput] - expected: FAIL - [HTMLElement interface: attribute oninvalid] expected: FAIL @@ -1254,9 +1239,6 @@ [HTMLElement interface: document.createElement("noscript") must inherit property "itemValue" with the proper type (11)] expected: FAIL - [HTMLElement interface: document.createElement("noscript") must inherit property "click" with the proper type (13)] - expected: FAIL - [HTMLElement interface: document.createElement("noscript") must inherit property "tabIndex" with the proper type (14)] expected: FAIL @@ -1332,9 +1314,6 @@ [HTMLElement interface: document.createElement("noscript") must inherit property "oncanplaythrough" with the proper type (38)] expected: FAIL - [HTMLElement interface: document.createElement("noscript") must inherit property "onchange" with the proper type (39)] - expected: FAIL - [HTMLElement interface: document.createElement("noscript") must inherit property "onclose" with the proper type (41)] expected: FAIL @@ -1386,9 +1365,6 @@ [HTMLElement interface: document.createElement("noscript") must inherit property "onfocus" with the proper type (57)] expected: FAIL - [HTMLElement interface: document.createElement("noscript") must inherit property "oninput" with the proper type (58)] - expected: FAIL - [HTMLElement interface: document.createElement("noscript") must inherit property "oninvalid" with the proper type (59)] expected: FAIL @@ -4800,9 +4776,6 @@ [HTMLInputElement interface: attribute height] expected: FAIL - [HTMLInputElement interface: attribute indeterminate] - expected: FAIL - [HTMLInputElement interface: attribute inputMode] expected: FAIL @@ -4830,9 +4803,6 @@ [HTMLInputElement interface: attribute placeholder] expected: FAIL - [HTMLInputElement interface: attribute readOnly] - expected: FAIL - [HTMLInputElement interface: attribute required] expected: FAIL @@ -4944,9 +4914,6 @@ [HTMLInputElement interface: document.createElement("input") must inherit property "height" with the proper type (15)] expected: FAIL - [HTMLInputElement interface: document.createElement("input") must inherit property "indeterminate" with the proper type (16)] - expected: FAIL - [HTMLInputElement interface: document.createElement("input") must inherit property "inputMode" with the proper type (17)] expected: FAIL @@ -4974,9 +4941,6 @@ [HTMLInputElement interface: document.createElement("input") must inherit property "placeholder" with the proper type (26)] expected: FAIL - [HTMLInputElement interface: document.createElement("input") must inherit property "readOnly" with the proper type (27)] - expected: FAIL - [HTMLInputElement interface: document.createElement("input") must inherit property "required" with the proper type (28)] expected: FAIL @@ -7170,9 +7134,6 @@ [Window interface: attribute oncanplaythrough] expected: FAIL - [Window interface: attribute onchange] - expected: FAIL - [Window interface: attribute onclose] expected: FAIL @@ -7221,9 +7182,6 @@ [Window interface: attribute onfocus] expected: FAIL - [Window interface: attribute oninput] - expected: FAIL - [Window interface: attribute oninvalid] expected: FAIL @@ -7512,9 +7470,6 @@ [Window interface: window must inherit property "oncanplaythrough" with the proper type (44)] expected: FAIL - [Window interface: window must inherit property "onchange" with the proper type (45)] - expected: FAIL - [Window interface: window must inherit property "onclose" with the proper type (47)] expected: FAIL @@ -7563,9 +7518,6 @@ [Window interface: window must inherit property "onfocus" with the proper type (63)] expected: FAIL - [Window interface: window must inherit property "oninput" with the proper type (64)] - expected: FAIL - [Window interface: window must inherit property "oninvalid" with the proper type (65)] expected: FAIL diff --git a/tests/wpt/metadata/html/dom/reflection-forms.html.ini b/tests/wpt/metadata/html/dom/reflection-forms.html.ini index 2569e501673..55375dd30d2 100644 --- a/tests/wpt/metadata/html/dom/reflection-forms.html.ini +++ b/tests/wpt/metadata/html/dom/reflection-forms.html.ini @@ -5925,114 +5925,6 @@ [input.placeholder: IDL set to object "test-valueOf" followed by IDL get] expected: FAIL - [input.readOnly: typeof IDL attribute] - expected: FAIL - - [input.readOnly: IDL get with DOM attribute unset] - expected: FAIL - - [input.readOnly: setAttribute() to "" followed by IDL get] - expected: FAIL - - [input.readOnly: setAttribute() to " foo " followed by IDL get] - expected: FAIL - - [input.readOnly: setAttribute() to undefined followed by IDL get] - expected: FAIL - - [input.readOnly: setAttribute() to null followed by IDL get] - expected: FAIL - - [input.readOnly: setAttribute() to 7 followed by IDL get] - expected: FAIL - - [input.readOnly: setAttribute() to 1.5 followed by IDL get] - expected: FAIL - - [input.readOnly: setAttribute() to true followed by IDL get] - expected: FAIL - - [input.readOnly: setAttribute() to false followed by IDL get] - expected: FAIL - - [input.readOnly: setAttribute() to object "[object Object\]" followed by IDL get] - expected: FAIL - - [input.readOnly: setAttribute() to NaN followed by IDL get] - expected: FAIL - - [input.readOnly: setAttribute() to Infinity followed by IDL get] - expected: FAIL - - [input.readOnly: setAttribute() to -Infinity followed by IDL get] - expected: FAIL - - [input.readOnly: setAttribute() to "\\0" followed by IDL get] - expected: FAIL - - [input.readOnly: setAttribute() to object "test-toString" followed by IDL get] - expected: FAIL - - [input.readOnly: setAttribute() to object "test-valueOf" followed by IDL get] - expected: FAIL - - [input.readOnly: setAttribute() to "readOnly" followed by IDL get] - expected: FAIL - - [input.readOnly: IDL set to "" followed by hasAttribute()] - expected: FAIL - - [input.readOnly: IDL set to "" followed by IDL get] - expected: FAIL - - [input.readOnly: IDL set to " foo " followed by IDL get] - expected: FAIL - - [input.readOnly: IDL set to undefined followed by hasAttribute()] - expected: FAIL - - [input.readOnly: IDL set to undefined followed by IDL get] - expected: FAIL - - [input.readOnly: IDL set to null followed by hasAttribute()] - expected: FAIL - - [input.readOnly: IDL set to null followed by IDL get] - expected: FAIL - - [input.readOnly: IDL set to 7 followed by IDL get] - expected: FAIL - - [input.readOnly: IDL set to 1.5 followed by IDL get] - expected: FAIL - - [input.readOnly: IDL set to false followed by hasAttribute()] - expected: FAIL - - [input.readOnly: IDL set to object "[object Object\]" followed by IDL get] - expected: FAIL - - [input.readOnly: IDL set to NaN followed by hasAttribute()] - expected: FAIL - - [input.readOnly: IDL set to NaN followed by IDL get] - expected: FAIL - - [input.readOnly: IDL set to Infinity followed by IDL get] - expected: FAIL - - [input.readOnly: IDL set to -Infinity followed by IDL get] - expected: FAIL - - [input.readOnly: IDL set to "\\0" followed by IDL get] - expected: FAIL - - [input.readOnly: IDL set to object "test-toString" followed by IDL get] - expected: FAIL - - [input.readOnly: IDL set to object "test-valueOf" followed by IDL get] - expected: FAIL - [input.required: typeof IDL attribute] expected: FAIL diff --git a/tests/wpt/metadata/html/semantics/forms/the-input-element/button.html.ini b/tests/wpt/metadata/html/semantics/forms/the-input-element/button.html.ini index a1bf2f8e7cd..6a64dd8cb98 100644 --- a/tests/wpt/metadata/html/semantics/forms/the-input-element/button.html.ini +++ b/tests/wpt/metadata/html/semantics/forms/the-input-element/button.html.ini @@ -1,17 +1,5 @@ [button.html] type: testharness - [clicking on button should not submit a form] - expected: FAIL - [the element is barred from constraint validation] expected: FAIL - [clicking on button should not reset other form fields] - expected: FAIL - - [clicking on button should not unchecked radio buttons] - expected: FAIL - - [clicking on button should not change its indeterminate IDL attribute] - expected: FAIL - diff --git a/tests/wpt/metadata/html/semantics/forms/the-input-element/checkbox.html.ini b/tests/wpt/metadata/html/semantics/forms/the-input-element/checkbox.html.ini index 7ec52aa8ee9..afdd08c6014 100644 --- a/tests/wpt/metadata/html/semantics/forms/the-input-element/checkbox.html.ini +++ b/tests/wpt/metadata/html/semantics/forms/the-input-element/checkbox.html.ini @@ -1,17 +1,5 @@ [checkbox.html] type: testharness - [click on mutable checkbox fires the input and change events] - expected: FAIL - - [click on non-mutable checkbox doesn\'t fire the input or change event] - expected: FAIL - - [pre-activation steps on unchecked checkbox] - expected: FAIL - - [pre-activation steps on checked checkbox] - expected: FAIL - [canceled activation steps on unchecked checkbox] expected: FAIL diff --git a/tests/wpt/metadata/html/semantics/forms/the-input-element/input-type-button.html.ini b/tests/wpt/metadata/html/semantics/forms/the-input-element/input-type-button.html.ini index 0c7b5a7b06b..e0fd34f9938 100644 --- a/tests/wpt/metadata/html/semantics/forms/the-input-element/input-type-button.html.ini +++ b/tests/wpt/metadata/html/semantics/forms/the-input-element/input-type-button.html.ini @@ -1,14 +1,5 @@ [input-type-button.html] type: testharness - [default behavior] - expected: FAIL - [label value] expected: FAIL - [mutable element\'s activation behavior is to do nothing.] - expected: FAIL - - [immutable element has no activation behavior.] - expected: FAIL - diff --git a/tests/wpt/metadata/html/semantics/forms/the-input-element/input-type-checkbox.html.ini b/tests/wpt/metadata/html/semantics/forms/the-input-element/input-type-checkbox.html.ini index 3570a956f8c..50592c4b1b1 100644 --- a/tests/wpt/metadata/html/semantics/forms/the-input-element/input-type-checkbox.html.ini +++ b/tests/wpt/metadata/html/semantics/forms/the-input-element/input-type-checkbox.html.ini @@ -1,8 +1,5 @@ [input-type-checkbox.html] type: testharness - [a checkbox has an indeterminate state set to false onload] - expected: FAIL - [default/on: on getting, if the element has a value attribute, it must return that attribute\'s value; otherwise, it must return the string \'on\'] expected: FAIL diff --git a/tests/wpt/metadata/html/semantics/forms/the-input-element/radio.html.ini b/tests/wpt/metadata/html/semantics/forms/the-input-element/radio.html.ini index b99ec91c469..c27d5e5d352 100644 --- a/tests/wpt/metadata/html/semantics/forms/the-input-element/radio.html.ini +++ b/tests/wpt/metadata/html/semantics/forms/the-input-element/radio.html.ini @@ -1,3 +1,8 @@ [radio.html] type: testharness - expected: TIMEOUT + [canceled activation steps on unchecked radio] + expected: FAIL + + [radio inputs with name attributes gro\xc3\xbcp2 and gro\xc3\x9cp2 belong to the same radio button group] + expected: FAIL + diff --git a/tests/wpt/metadata/html/semantics/selectors/pseudo-classes/checked.html.ini b/tests/wpt/metadata/html/semantics/selectors/pseudo-classes/checked.html.ini index 751e4176f9c..ef274381edc 100644 --- a/tests/wpt/metadata/html/semantics/selectors/pseudo-classes/checked.html.ini +++ b/tests/wpt/metadata/html/semantics/selectors/pseudo-classes/checked.html.ini @@ -6,3 +6,6 @@ [\':checked\' should no longer match <input>s whose type checkbox/radio has been removed] expected: FAIL + [\':checked\' matches clicked checkbox and radio buttons] + expected: FAIL + diff --git a/tests/wpt/metadata/html/semantics/selectors/pseudo-classes/indeterminate.html.ini b/tests/wpt/metadata/html/semantics/selectors/pseudo-classes/indeterminate.html.ini index adf31b3f868..7510b189e41 100644 --- a/tests/wpt/metadata/html/semantics/selectors/pseudo-classes/indeterminate.html.ini +++ b/tests/wpt/metadata/html/semantics/selectors/pseudo-classes/indeterminate.html.ini @@ -6,3 +6,15 @@ [dynamically check a radio input in a radio button group] expected: FAIL + [click on radio4 which is in the indeterminate state] + expected: FAIL + + [adding a value to progress1 should put it in a determinate state] + expected: FAIL + + [removing progress2\'s value should put it in an indeterminate state] + expected: FAIL + + [\':progress\' also matches <input> checkbox whose indeterminate IDL is set to true] + expected: FAIL + |