(windows).mouseleave(function() {

Ask for help about NoScript, no registration needed to post
User avatar
Thrawn
Master Bug Buster
Posts: 3106
Joined: Mon Jan 16, 2012 3:46 am
Location: Australia
Contact:

Re: (windows).mouseleave(function() {

Post by Thrawn »

You could probably reuse the function instead of defining it twice:

Code: Select all

function blockEvent(e) {e.stopImmediatePropagation();e.stopPropagation();}; window.addEventListener("mouseleave", blockEvent, false); window.addEventListener("mouseout", blockEvent, false);
======
Thrawn
------------
Religion is not the opium of the masses. Daily life is the opium of the masses.

True religion, which dares to acknowledge death and challenge the way we live, is an attempt to wake up.
Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:40.0) Gecko/20100101 Firefox/40.0
barbaz
Senior Member
Posts: 11089
Joined: Sat Aug 03, 2013 5:45 pm

Re: (windows).mouseleave(function() {

Post by barbaz »

Yes, re-using the same function when possible is much better practice (I read somewhere that it saves a LOT on memory use, can't remember where). I was just thinking "sample code that should works & at least gives the basic idea" and not "most optimized code to do the job". :roll:
Thank you for pointing that out.
*Always* check the changelogs BEFORE updating that important software!
-
Post Reply