Is it possible to stopPropagation to Browser Extension?

277 views Asked by At

The LastPass Browser Extension is executing some code within a "mouseup" event which is slowing down my page when there are several thousand input elements (checkboxes) on the page. I know, I know, but it is within a large tree control with checkboxes on each node of the tree.

I found someone talking about this on the LastPass forums here: https://forums.lastpass.com/viewtopic.php?f=12&t=286955

However, since there has been no response from LastPass to that post, I was wondering if there is a way to stopPropagation of the event to LastPass to prevent it from going to them on the pages where I know it will cause a slowdown.

Is there any way to intercept an event and stop it from propagating to a browser extension?

I've tried adding an "onmouseup" handler and calling event.stopPropagation() and event.stopImmediatePropagation(), but that doesnt seem to stop the browser extension from running its "mouseup" function.
Where this is happening, I have no need for the LastPass extension, and when I disable the extension, I do not experience the slowdown.

LastPass profiler Here is a screenshot of Chrome's profiler showing a 757ms delay that is happening on every mouseup!! Add to that jQuery's Sizzle selector delay of 267ms and its just painfully slow to navigate the tree control on my page.

1

There are 1 answers

0
Stephen On BEST ANSWER

Just wanted to close this out in case anyone comes here with the same question.

e.stopImmediatePropagation did work. The problem I had with it not working related to event Capturing vs Bubbling. The event I was trying to prevent was registered with useCapture=true. In order for the stopImmediatePropagation to work, I had to also add my event with useCapture=true.

$(document).ready(function () {
    //this is to stop LastPass from listening to mouseup on my page
    window.addEventListener('mouseup', function (e) {
        e.stopImmediatePropagation();
    }, true);
});

The good news here is that click events still fire even though I have stopped all handling of the mouseup.

Dont know why that eluded me... hopefully it will help someone else as well.