P0b: document.currentScript.parentElement null für Dynamic Scripts #75
Labels
No labels
bug
docs
feature
housekeeping
html-spec
performance
react-compat
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
glow-all/true-headless-browser#75
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
P0b:
document.currentScript.parentElementnull für Dynamic ScriptsPriority: HIGH
Betrifft: kit.svelte.dev, web.dev, speedtest.net, ALLE Seiten mit Inline-Scripts im <head>
Impact: Scripts crashen beim Start. SvelteKit-Seite kann nicht bootstrappen.
Problembeschreibung
Der DynamicScriptHandler führt Scripts aus, BEVOR sie im DOM attached sind.
document.currentScriptwird zwar korrekt gesetzt (Sprint 12), aber das Script-Elementhat zu diesem Zeitpunkt
.parentElement === null.Aktueller Ablauf:
<script>-Tag__currentScriptdocument.currentScript.parentElement→ null (nicht attached)Gewünschtes Verhalten
Im Browser:
<script>-TagcurrentScript.parentElement= korrektes DOM-ElementOption A: Script vor execute() attachien (EMPFEHLUNG)
Akzeptanzkriterien
document.currentScript.parentElementist niemals null während executionBetroffene Dateien
src/js/dynamic-scripts.tstests/unit/sprint16-currentscript.test.ts✅ Sprint 16 implementiert —
document.currentScript.parentElementFixWas wurde gemacht:
execution-realm.ts:execute(): Nur__currentScriptsetzen wennscriptElement.parentNodeexistiertparser.ts:makeScriptElement(): Fakes Script-Element hat jetztparentNode = document.head+parentElementGetterTypeErrorbei SvelteKit/web.dev/speedtest Inline-ScriptsCommit:
eca1765