Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5986905
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T22:44:21+00:00 2026-05-22T22:44:21+00:00

In source code here http://www.daftlogic.com/sandbox-javascript-slider-control.htm There is these instructions: // safely hook document/window events

  • 0

In source code here
http://www.daftlogic.com/sandbox-javascript-slider-control.htm

There is these instructions:

// safely hook document/window events
if (document.onmousemove != f_sliderMouseMove) {
window.f_savedMouseMove = document.onmousemove;
document.onmousemove = f_sliderMouseMove;
}

I don’t understand what it does and why it would be safer to do that this way, does someone understand?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T22:44:21+00:00Added an answer on May 22, 2026 at 10:44 pm

    It might be that some other code already assigned an event handler to document.onmousemove. The problem with this method, as opposed to addEventListener, is that only one function can be assigned to element.onXXXX. Thus, if you blindly assign a new event handler, an already existing one might be overwritten and other code might break.

    In such a case, I would write:

    if (document.onmousemove) {
        (function() {
             var old_handler = document.onmousemove;
             document.onmousemove = function() {
                old_handler.apply(this, arguments);
                f_sliderMouseMove.apply(this, arguments);
             };
        }());
    }
    else {
        document.onmousemove = f_sliderMouseMove;
    }
    

    This way it is ensured that both event handlers are executed. But I guess that depends on the context of the code. Maybe f_sliderMouseMove calls window.f_savedMouseMove anyway.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Download source code here: http://www.eyeClaxton.com/download/delphi/ColorSwap.zip Yes, I want to convert something mostly blue to
Check out the source code here: http://www.savvissl.com/demo1/showcode.php check out the script here http://www.savvissl.com/demo1/testPDF.php Here
I downloaded the source code for an applet from here: http://www.oxygenxml.com/demo/AuthorDemoApplet/author-component-dita.html As instructed, I've
As described here http://www.ddj.com/cpp/184401688 I do not have time to write this from scratch.
If you click on the click here to order button here: http://www.game onglove.com/ gog/
I'm building a python application from some source code I've found Here I've managed
Are there any good source-code analyses tools for OSX. I am particularly interested in
Everyone uses source-code control to manage versions (right?) and this provides some level of
I'm working with a C# sample application (taken from here : http://www.piccoder.co.uk/content/view/42/26/1/4/ ) The
I have a pagination script, which can be seen here: http://www.automotori6282.tk/phpsandbox/ This is the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.