Implement script element loading and execution (defer, async)
Add script execution to the page loading pipeline: after HTML parsing,
walk the DOM for <script> elements and execute them in a shared JS VM
with full DOM access. Scripts can modify the DOM before CSS/image
collection.
Key changes:
- New script_loader module: discovers scripts in document order,
fetches external scripts, handles defer/async/type attributes
- VM.detach_document(): reclaim Document after script execution
- Top-level var declarations now emit StoreGlobal so variables
persist across multiple execute() calls (shared global scope)
- Resource::Script variant for JavaScript MIME types
- Exhaustive match updates in css_loader and img_loader
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
authored by
tangled.org
2720f105
b0333c45