mirror of https://github.com/Y2Z/monolith
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
645 B
Rust
33 lines
645 B
Rust
5 years ago
|
const JS_DOM_EVENT_ATTRS: [&str; 21] = [
|
||
|
// Input
|
||
|
"onfocus",
|
||
|
"onblur",
|
||
|
"onselect",
|
||
|
"onchange",
|
||
|
"onsubmit",
|
||
|
"onreset",
|
||
|
"onkeydown",
|
||
|
"onkeypress",
|
||
|
"onkeyup",
|
||
|
// Mouse
|
||
|
"onmouseover",
|
||
|
"onmouseout",
|
||
|
"onmousedown",
|
||
|
"onmouseup",
|
||
|
"onmousemove",
|
||
|
// Click
|
||
|
"onclick",
|
||
|
"ondblclick",
|
||
|
// Load
|
||
|
"onload",
|
||
|
"onunload",
|
||
|
"onabort",
|
||
|
"onerror",
|
||
|
"onresize",
|
||
|
];
|
||
|
|
||
|
// Returns true if DOM attribute name matches a native JavaScript event handler
|
||
|
pub fn attr_is_event_handler(attr_name: &str) -> bool {
|
||
|
JS_DOM_EVENT_ATTRS.contains(&attr_name.to_lowercase().as_str())
|
||
|
}
|