Expand description
The script crate contains all matters DOM.
Re-exports
pub use script_runtime::JSEngineSetup;
Modules
A timeline module, used to specify an
AnimationTimeline
which determines
the time used for synchronizing animations in the script thread.The set of animations for a document.
body 🔒
devtools 🔒
Tracking of pending loads in a document.
dom 🔒
The implementation of the DOM.
init 🔒
A safe wrapper for DOM nodes that prevents layout from mutating the DOM, from letting DOM nodes
escape, and from generally doing anything that it isn’t supposed to. This is accomplished via
a simple whitelist of allowed operations, along with some lifetime magic to prevent nodes from
escaping.
Infrastructure to initiate network requests for images needed by the layout
thread. The script thread needs to be responsible for them because there’s
no guarantee that the responsible nodes will still exist in the future if the
layout thread holds on to them during asynchronous operations.
mem 🔒
Routines for handling measuring the memory usage of arbitrary DOM nodes.
Implementation of microtasks and
microtask queues. It is up to implementations of event loops to store a queue and
perform checkpoints at appropriate times, as well as enqueue microtasks as required.
realms 🔒
The script module mod contains common traits and structs
related to
type=module
for script thread or worker threads.The script runtime contains common traits and structs commonly used by the
script thread, the dom, and the worker threads.
The script thread is the thread that owns the DOM in memory, runs JavaScript, and spawns parsing
and layout threads. It’s in charge of processing events for all same-origin pages in a frame
tree, and manages the entire lifetime of pages in the frame tree from initial request to
teardown.
The service worker manager persists the descriptor of any registered service workers.
It also stores an active workers map, which holds descriptors of running service workers.
If an active service worker timeouts, then it removes the descriptor entry from its
active_workers map
Machinery for task-queue.
Common handling of keyboard input and state management for text input controls
timers 🔒
Macros
Usage:
Usage: