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.
36 lines
686 B
Rust
36 lines
686 B
Rust
const JS_DOM_EVENT_ATTRS: &[&str] = &[
|
|
// 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
|
|
.iter()
|
|
.find(|a| attr_name.eq_ignore_ascii_case(a))
|
|
.is_some()
|
|
}
|