开发者

$(window).mouseup handler in a Chrome extension is breaking Flash

开发者 https://www.devze.com 2023-03-01 21:39 出处:网络
I\'m working on a Google Chrome extension that monitors mouse events. For some reason the following javascript code in the extension\'s content script is causing embedded Flash content to break:

I'm working on a Google Chrome extension that monitors mouse events. For some reason the following javascript code in the extension's content script is causing embedded Flash content to break:

$(window).mouseup(function() {
    // do benign stuff
});

If you mousedown inside a Flash element, it never registers the mouseup and it appears as th开发者_StackOverflow中文版ough you're still holding your mouse button down even though you've let go. At first I thought it was some kind of event bubbling issue, that this method was swallowing the event, so I tried returning true (and false for that matter) but it didn't seem to have any effect. Any ideas?


Well, no response from the peanut gallery after a few days, but I figured it out on my lonesome:

// Bad
$(window).mouseup(function() { ... });

// Good
window.addEventListener("mouseup", function(event) { ... });
0

精彩评论

暂无评论...
验证码 换一张
取 消