mirror of
https://github.com/servo/servo.git
synced 2025-08-02 20:20:14 +01:00
Add oninput/onchange so tests work
This commit is contained in:
parent
e7ac792ed6
commit
e7b3caa386
15 changed files with 43 additions and 200 deletions
|
@ -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)
|
||||
}
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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)
|
||||
)
|
||||
)
|
|
@ -23,6 +23,8 @@ typedef OnErrorEventHandlerNonNull? OnErrorEventHandler;
|
|||
interface GlobalEventHandlers {
|
||||
attribute EventHandler onclick;
|
||||
attribute EventHandler onload;
|
||||
attribute EventHandler oninput;
|
||||
attribute EventHandler onchange;
|
||||
};
|
||||
|
||||
[NoInterfaceObject]
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue