Version 3 (modified by 12 years ago) ( diff ) | ,
---|
DOM in JavaScript
Overview
In this proposal, we upload the four basic DOM pointers (firstChild, lastChild, nextSibling, previousSibling) into the JavaScript engine so that they can be accessed more quickly from JavaScript. We then provide C++ an optimized code path for reading and writing these properties.
JavaScript
The main change in this proposal is to move the four basic DOM pointers from C++ pointers to JavaScript properties. When accessing nextSibling, for example, from JavaScript, the JavaScript engine will simply read the nextSibling property as usual (and apply all its usual optimizations). The DOM structure, then, is stored in JavaScript.
C++
After moving the DOM pointers into the JavaScript VM, we'll still need to provide a fast path for C++ code to access the pointers. Today, C++ simply reads a pointer from a fixed offset in the Node object. In this proposal, C++ code will need to take a slightly more indirect route: