I have a library function, that I cannot change, which uses MooTools to attach an event.
$(document.body).addEvents({
"mousedown:relay(a.className)": function (a, b) {
if (!a.rightClick) {
//do something
}
return false
});
I'm not too familiar with MooTools, but I've tried everything I can think of to override this with a jQuery.click()
event.
I've tried attaching a listener to .className
, its parents (a few levels up), and even the whole body
; each time, I use function (e) { e.preventDefault() }
in my click
event.
I've always assumed the preventDefault()
would always prevent all default events associated with the newly-triggered event.
Can anyone enlighten me as to why my event override isn't working?
// EDIT
I'm not looking to use MooTools because we will probably port everything to jQuery (or at least not MooTools) in the future. I guess I'll have to, though, if there's no other way.
// EDIT 2
I've tried jQuery.off()
in several different ways, including
$j('body').off('click mousedown','.className');
and it still fails to remove the MooTools event.
// EDIT 3
I decided it was best to just not mess with MooTools; I've changed the classname so the MooTools doesn't do anything and just replicated what happened in the //do something
part of the code above.
I have a feeling I can't do anything with the click event because of the return false
at the end of the MooTools event listener.