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 6982555
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T18:18:13+00:00 2026-05-27T18:18:13+00:00

Javascript lets you fire custom events when the user hovers over an element or

  • 0

Javascript lets you fire custom events when the user hovers over an element or when a user clicks on an element. But how does Javascript know which elements should receive the click event?

For example an HTML element like this:

<div style="width: 300; height: 300;">
    <a href="hello">Hello World</a>
</div>

If I click on the link, the browser knows to execute all click events attached to that link. But how does the browser know where on the page the link is (or even that it’s visible?)

Consider:

<div id="mydiv" style="width: 300; height: 300;">
    <a href="hello">Hello World</a>
</div>
<style>
    #mydiv a {
        display: none;
    }
</style>

Now nothing will happen when I click on the space where the link used to be visible. How does the browser know not to fire click/hover events in this case? If I wanted to recreate the algorithm used, what elements would I need?

I assume there is some function in browser code that looks like this:

/* Take user's mouse coordinates and return a DOM element. */
function returnElementBasedOnMouseCoordinate(x, y) {

    /* Does a lookup function on some data structure */
    return someElementInTheDom;
}

How does that function work?

  • 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-27T18:18:14+00:00Added an answer on May 27, 2026 at 6:18 pm

    Typically (meaning WebKit :)) browsers create a render tree which roughly corresponds to the document DOM tree but reflects the visual rather than logical structure of the document. For invisible elements (display: none), there are no corresponding render objects which participate in mouse event handling. The render tree is modified every time the DOM or some of its visual aspects (element display, visibility, dimensions, etc.) change.

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

Sidebar

Related Questions

I have written this innocent javascript code, which lets the user create two markers
does anyone know how to round corners of div using javascript, but round only
Lets say you have a JavaScript widget which needs to fire off a request
Lets say you need to attach some JavaScript functionality to an ASP.NET User Control
Lets say I have a javascript function call moveItem which takes two parameters source
I have one webpage (lets call it A.html). A.html has some javascript which switches
I'm having some Javascript woes, lets say we have a constructor function test(element) {
Is there a javascript library which lets me draw on a web page and
I'm trying to write a lightweight html/javascript widget which lets me colour each character
I'm writing an app with Titanium Developer which lets me use Javascript, PHP, Ruby

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.