Fistright Fistright - 6 months ago 10x
Javascript Question

Code behind javascript's methods

Is there a way to see the code behind a javascript's method?For example:how can i do if I want to see how javascript calculate the offsetTop of an element ?


JavaScript is implemented by the browser, so it depends on the browser.

Google's browser, Chrome, is closed-source not open-source. Which means that you can't view their source code, including their implementation of JavaScript.

Mozilla's browser, Firefox, is open-source just like all of their projects. You can view all of the source code for Mozilla projects here. You'll find the code that implements JavaScript in Firefox right here.

For closed-source implementations of JavaScript, like Chrome's, you can never be sure exactly how each method works. By reading the documentation available, (Chrome JS documentation) you will be able to get the best available idea of how a method might be implemented.