2022-01-20 19:03:48 +00:00
|
|
|
export function ignoreClick (e) {
|
2023-07-23 15:08:43 +00:00
|
|
|
return (e.target.onclick || // the target has a click handler
|
2022-01-20 19:03:48 +00:00
|
|
|
// the target has an interactive parent
|
2023-07-23 15:08:43 +00:00
|
|
|
e.target.matches(':where(.upvoteParent, .pointer, a, form, textarea, button, input) :scope') ||
|
2022-01-20 19:03:48 +00:00
|
|
|
// the target is an interactive element
|
2023-07-23 15:08:43 +00:00
|
|
|
['TEXTAREA', 'BUTTON', 'INPUT', 'A', 'FORM'].includes(e.target.tagName.toUpperCase()) ||
|
2022-01-20 19:03:48 +00:00
|
|
|
// the target is an interactive element
|
2023-05-18 18:36:01 +00:00
|
|
|
e.target.class === 'upvoteParent' || e.target.class === 'pointer' ||
|
|
|
|
// the click is caused by a selection
|
2023-07-23 15:08:43 +00:00
|
|
|
window.getSelection()?.toString())
|
2022-01-20 19:03:48 +00:00
|
|
|
}
|