How operating system links events with dom object?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}
When we click mouse ,it send signal to operating system and through this way OS can identify which resource is affected and run event handler.
How does this mouse click is mapped to our click event on dom object?
how OS attach our event handler to the dom tree objects and executes it in event loop?
/Editted/
I asked this question for specific hardware resource.Would it be same for internal resources eg: when we say nodejs server listens for request event and executes event handler.Here Nodejs is runs on operating system and http server is setup by nodejs(ip + port)..so in this case which resource is Listening for incoming request ?
javascript event-handling operating-system event-loop
add a comment |
When we click mouse ,it send signal to operating system and through this way OS can identify which resource is affected and run event handler.
How does this mouse click is mapped to our click event on dom object?
how OS attach our event handler to the dom tree objects and executes it in event loop?
/Editted/
I asked this question for specific hardware resource.Would it be same for internal resources eg: when we say nodejs server listens for request event and executes event handler.Here Nodejs is runs on operating system and http server is setup by nodejs(ip + port)..so in this case which resource is Listening for incoming request ?
javascript event-handling operating-system event-loop
This is not an issue.I want to understand the concept of event handling .
– Suraj Prakash Joshi
Jan 4 at 9:28
When we click mouse ,it send signal to operating system Not exactly. Most of things are handled by JSruntime
and browserwebAPIs
– George Bailey
Jan 4 at 9:28
@FZs - The question is clear without code (in fact, I don't see how code would make it clearer).
– T.J. Crowder
Jan 4 at 9:30
add a comment |
When we click mouse ,it send signal to operating system and through this way OS can identify which resource is affected and run event handler.
How does this mouse click is mapped to our click event on dom object?
how OS attach our event handler to the dom tree objects and executes it in event loop?
/Editted/
I asked this question for specific hardware resource.Would it be same for internal resources eg: when we say nodejs server listens for request event and executes event handler.Here Nodejs is runs on operating system and http server is setup by nodejs(ip + port)..so in this case which resource is Listening for incoming request ?
javascript event-handling operating-system event-loop
When we click mouse ,it send signal to operating system and through this way OS can identify which resource is affected and run event handler.
How does this mouse click is mapped to our click event on dom object?
how OS attach our event handler to the dom tree objects and executes it in event loop?
/Editted/
I asked this question for specific hardware resource.Would it be same for internal resources eg: when we say nodejs server listens for request event and executes event handler.Here Nodejs is runs on operating system and http server is setup by nodejs(ip + port)..so in this case which resource is Listening for incoming request ?
javascript event-handling operating-system event-loop
javascript event-handling operating-system event-loop
edited Jan 4 at 9:59
Suraj Prakash Joshi
asked Jan 4 at 9:19
Suraj Prakash JoshiSuraj Prakash Joshi
7516
7516
This is not an issue.I want to understand the concept of event handling .
– Suraj Prakash Joshi
Jan 4 at 9:28
When we click mouse ,it send signal to operating system Not exactly. Most of things are handled by JSruntime
and browserwebAPIs
– George Bailey
Jan 4 at 9:28
@FZs - The question is clear without code (in fact, I don't see how code would make it clearer).
– T.J. Crowder
Jan 4 at 9:30
add a comment |
This is not an issue.I want to understand the concept of event handling .
– Suraj Prakash Joshi
Jan 4 at 9:28
When we click mouse ,it send signal to operating system Not exactly. Most of things are handled by JSruntime
and browserwebAPIs
– George Bailey
Jan 4 at 9:28
@FZs - The question is clear without code (in fact, I don't see how code would make it clearer).
– T.J. Crowder
Jan 4 at 9:30
This is not an issue.I want to understand the concept of event handling .
– Suraj Prakash Joshi
Jan 4 at 9:28
This is not an issue.I want to understand the concept of event handling .
– Suraj Prakash Joshi
Jan 4 at 9:28
When we click mouse ,it send signal to operating system Not exactly. Most of things are handled by JS
runtime
and browser webAPIs
– George Bailey
Jan 4 at 9:28
When we click mouse ,it send signal to operating system Not exactly. Most of things are handled by JS
runtime
and browser webAPIs
– George Bailey
Jan 4 at 9:28
@FZs - The question is clear without code (in fact, I don't see how code would make it clearer).
– T.J. Crowder
Jan 4 at 9:30
@FZs - The question is clear without code (in fact, I don't see how code would make it clearer).
– T.J. Crowder
Jan 4 at 9:30
add a comment |
1 Answer
1
active
oldest
votes
The operating system doesn't. The event goes through a series of layers. Each layer knows more detail about that specific layer than the previous one:
- The mouse handler (in the OS) relays a click at X,Y on the screen to the window manager (also often part of the OS, but swappable on various *nix variants)
- The window manager relays the click to the application for the window the click occurred in
- The application in the window (in this case, a web browser) relays the click to your event handler
Since the browser knows the DOM, and knows which DOM element was clicked, it can check for event handlers on that element and call those handlers with the correct element.
Each layer has only the details specific to that layer. The mouse handler knows what kind of mouse it's dealing with, but the window manager and browser (probably) don't. (They can ask the OS if they want to know, but usually don't have to.) The mouse handler doesn't know where the windows are (or even that there are windows), but the window manager does. The window manager doesn't know about the DOM elements (and various other parts of the browser like its bookmarks bar or similar) are, but the browser does.
(The above is just a very rough sketch, there are more layers involved, but it gives you the idea.)
thanks, This is helpful to visualize the flow.I asked this question for specific hardware resource.Would it be same for internal resources eg: when we say nodejs server listens for request event and executes event handler.Here Nodejs is runs on operating system and http server is setup by nodejs(ip + port)..so in this case which resource is listens for incoming request ?
– Suraj Prakash Joshi
Jan 4 at 9:55
@SurajPrakashJoshi - The OS's network stack does. The OS offers system calls to interact with the network. Node.js uses those system calls to implement its API. Your code uses Node.js's API to implement your server. Layers again. :-)
– T.J. Crowder
Jan 4 at 9:59
It's the same for nearly everything on a modern computer: Video display, audio input/output, etc. There are layers, where each layer knows enough to do its job for the other layers.
– T.J. Crowder
Jan 4 at 10:05
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54036035%2fhow-operating-system-links-events-with-dom-object%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
The operating system doesn't. The event goes through a series of layers. Each layer knows more detail about that specific layer than the previous one:
- The mouse handler (in the OS) relays a click at X,Y on the screen to the window manager (also often part of the OS, but swappable on various *nix variants)
- The window manager relays the click to the application for the window the click occurred in
- The application in the window (in this case, a web browser) relays the click to your event handler
Since the browser knows the DOM, and knows which DOM element was clicked, it can check for event handlers on that element and call those handlers with the correct element.
Each layer has only the details specific to that layer. The mouse handler knows what kind of mouse it's dealing with, but the window manager and browser (probably) don't. (They can ask the OS if they want to know, but usually don't have to.) The mouse handler doesn't know where the windows are (or even that there are windows), but the window manager does. The window manager doesn't know about the DOM elements (and various other parts of the browser like its bookmarks bar or similar) are, but the browser does.
(The above is just a very rough sketch, there are more layers involved, but it gives you the idea.)
thanks, This is helpful to visualize the flow.I asked this question for specific hardware resource.Would it be same for internal resources eg: when we say nodejs server listens for request event and executes event handler.Here Nodejs is runs on operating system and http server is setup by nodejs(ip + port)..so in this case which resource is listens for incoming request ?
– Suraj Prakash Joshi
Jan 4 at 9:55
@SurajPrakashJoshi - The OS's network stack does. The OS offers system calls to interact with the network. Node.js uses those system calls to implement its API. Your code uses Node.js's API to implement your server. Layers again. :-)
– T.J. Crowder
Jan 4 at 9:59
It's the same for nearly everything on a modern computer: Video display, audio input/output, etc. There are layers, where each layer knows enough to do its job for the other layers.
– T.J. Crowder
Jan 4 at 10:05
add a comment |
The operating system doesn't. The event goes through a series of layers. Each layer knows more detail about that specific layer than the previous one:
- The mouse handler (in the OS) relays a click at X,Y on the screen to the window manager (also often part of the OS, but swappable on various *nix variants)
- The window manager relays the click to the application for the window the click occurred in
- The application in the window (in this case, a web browser) relays the click to your event handler
Since the browser knows the DOM, and knows which DOM element was clicked, it can check for event handlers on that element and call those handlers with the correct element.
Each layer has only the details specific to that layer. The mouse handler knows what kind of mouse it's dealing with, but the window manager and browser (probably) don't. (They can ask the OS if they want to know, but usually don't have to.) The mouse handler doesn't know where the windows are (or even that there are windows), but the window manager does. The window manager doesn't know about the DOM elements (and various other parts of the browser like its bookmarks bar or similar) are, but the browser does.
(The above is just a very rough sketch, there are more layers involved, but it gives you the idea.)
thanks, This is helpful to visualize the flow.I asked this question for specific hardware resource.Would it be same for internal resources eg: when we say nodejs server listens for request event and executes event handler.Here Nodejs is runs on operating system and http server is setup by nodejs(ip + port)..so in this case which resource is listens for incoming request ?
– Suraj Prakash Joshi
Jan 4 at 9:55
@SurajPrakashJoshi - The OS's network stack does. The OS offers system calls to interact with the network. Node.js uses those system calls to implement its API. Your code uses Node.js's API to implement your server. Layers again. :-)
– T.J. Crowder
Jan 4 at 9:59
It's the same for nearly everything on a modern computer: Video display, audio input/output, etc. There are layers, where each layer knows enough to do its job for the other layers.
– T.J. Crowder
Jan 4 at 10:05
add a comment |
The operating system doesn't. The event goes through a series of layers. Each layer knows more detail about that specific layer than the previous one:
- The mouse handler (in the OS) relays a click at X,Y on the screen to the window manager (also often part of the OS, but swappable on various *nix variants)
- The window manager relays the click to the application for the window the click occurred in
- The application in the window (in this case, a web browser) relays the click to your event handler
Since the browser knows the DOM, and knows which DOM element was clicked, it can check for event handlers on that element and call those handlers with the correct element.
Each layer has only the details specific to that layer. The mouse handler knows what kind of mouse it's dealing with, but the window manager and browser (probably) don't. (They can ask the OS if they want to know, but usually don't have to.) The mouse handler doesn't know where the windows are (or even that there are windows), but the window manager does. The window manager doesn't know about the DOM elements (and various other parts of the browser like its bookmarks bar or similar) are, but the browser does.
(The above is just a very rough sketch, there are more layers involved, but it gives you the idea.)
The operating system doesn't. The event goes through a series of layers. Each layer knows more detail about that specific layer than the previous one:
- The mouse handler (in the OS) relays a click at X,Y on the screen to the window manager (also often part of the OS, but swappable on various *nix variants)
- The window manager relays the click to the application for the window the click occurred in
- The application in the window (in this case, a web browser) relays the click to your event handler
Since the browser knows the DOM, and knows which DOM element was clicked, it can check for event handlers on that element and call those handlers with the correct element.
Each layer has only the details specific to that layer. The mouse handler knows what kind of mouse it's dealing with, but the window manager and browser (probably) don't. (They can ask the OS if they want to know, but usually don't have to.) The mouse handler doesn't know where the windows are (or even that there are windows), but the window manager does. The window manager doesn't know about the DOM elements (and various other parts of the browser like its bookmarks bar or similar) are, but the browser does.
(The above is just a very rough sketch, there are more layers involved, but it gives you the idea.)
answered Jan 4 at 9:29
T.J. CrowderT.J. Crowder
701k12412441341
701k12412441341
thanks, This is helpful to visualize the flow.I asked this question for specific hardware resource.Would it be same for internal resources eg: when we say nodejs server listens for request event and executes event handler.Here Nodejs is runs on operating system and http server is setup by nodejs(ip + port)..so in this case which resource is listens for incoming request ?
– Suraj Prakash Joshi
Jan 4 at 9:55
@SurajPrakashJoshi - The OS's network stack does. The OS offers system calls to interact with the network. Node.js uses those system calls to implement its API. Your code uses Node.js's API to implement your server. Layers again. :-)
– T.J. Crowder
Jan 4 at 9:59
It's the same for nearly everything on a modern computer: Video display, audio input/output, etc. There are layers, where each layer knows enough to do its job for the other layers.
– T.J. Crowder
Jan 4 at 10:05
add a comment |
thanks, This is helpful to visualize the flow.I asked this question for specific hardware resource.Would it be same for internal resources eg: when we say nodejs server listens for request event and executes event handler.Here Nodejs is runs on operating system and http server is setup by nodejs(ip + port)..so in this case which resource is listens for incoming request ?
– Suraj Prakash Joshi
Jan 4 at 9:55
@SurajPrakashJoshi - The OS's network stack does. The OS offers system calls to interact with the network. Node.js uses those system calls to implement its API. Your code uses Node.js's API to implement your server. Layers again. :-)
– T.J. Crowder
Jan 4 at 9:59
It's the same for nearly everything on a modern computer: Video display, audio input/output, etc. There are layers, where each layer knows enough to do its job for the other layers.
– T.J. Crowder
Jan 4 at 10:05
thanks, This is helpful to visualize the flow.I asked this question for specific hardware resource.Would it be same for internal resources eg: when we say nodejs server listens for request event and executes event handler.Here Nodejs is runs on operating system and http server is setup by nodejs(ip + port)..so in this case which resource is listens for incoming request ?
– Suraj Prakash Joshi
Jan 4 at 9:55
thanks, This is helpful to visualize the flow.I asked this question for specific hardware resource.Would it be same for internal resources eg: when we say nodejs server listens for request event and executes event handler.Here Nodejs is runs on operating system and http server is setup by nodejs(ip + port)..so in this case which resource is listens for incoming request ?
– Suraj Prakash Joshi
Jan 4 at 9:55
@SurajPrakashJoshi - The OS's network stack does. The OS offers system calls to interact with the network. Node.js uses those system calls to implement its API. Your code uses Node.js's API to implement your server. Layers again. :-)
– T.J. Crowder
Jan 4 at 9:59
@SurajPrakashJoshi - The OS's network stack does. The OS offers system calls to interact with the network. Node.js uses those system calls to implement its API. Your code uses Node.js's API to implement your server. Layers again. :-)
– T.J. Crowder
Jan 4 at 9:59
It's the same for nearly everything on a modern computer: Video display, audio input/output, etc. There are layers, where each layer knows enough to do its job for the other layers.
– T.J. Crowder
Jan 4 at 10:05
It's the same for nearly everything on a modern computer: Video display, audio input/output, etc. There are layers, where each layer knows enough to do its job for the other layers.
– T.J. Crowder
Jan 4 at 10:05
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54036035%2fhow-operating-system-links-events-with-dom-object%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
This is not an issue.I want to understand the concept of event handling .
– Suraj Prakash Joshi
Jan 4 at 9:28
When we click mouse ,it send signal to operating system Not exactly. Most of things are handled by JS
runtime
and browserwebAPIs
– George Bailey
Jan 4 at 9:28
@FZs - The question is clear without code (in fact, I don't see how code would make it clearer).
– T.J. Crowder
Jan 4 at 9:30