Add oninput/onchange so tests work

This commit is contained in:
Manish Goregaokar 2014-11-26 22:29:41 +05:30
parent e7ac792ed6
commit e7b3caa386
15 changed files with 43 additions and 200 deletions

View file

@ -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)
}

View file

@ -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() {

View file

@ -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 {

View file

@ -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)
)
)

View file

@ -23,6 +23,8 @@ typedef OnErrorEventHandlerNonNull? OnErrorEventHandler;
interface GlobalEventHandlers {
attribute EventHandler onclick;
attribute EventHandler onload;
attribute EventHandler oninput;
attribute EventHandler onchange;
};
[NoInterfaceObject]

View file

@ -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)

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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