Skip to content

chore: regenerate types for parseFromString isDocument param - #350

Open
tlq5l wants to merge 2 commits into
WebReflection:mainfrom
tlq5l:fix/body-without-html
Open

tlq5l wants to merge 2 commits into
WebReflection:mainfrom
tlq5l:fix/body-without-html

Conversation

@tlq5l

@tlq5l tlq5l commented Oct 21, 2026

Copy link
Copy Markdown

Fixes #283

parseHTML('<body>...') has no <html>, so the <body> element became the document element. document.head and document.body assume <html> is the root, so they created a new <head> and a new, empty <body> inside the real body.

The parser now adds an implicit <html> when a top level <head> or <body> appears in a full document parse (DOMParser / parseHTML). innerHTML fragment parsing is unchanged. I changed esm, regenerated cjs and worker.js, and added a test in test/html/document.js.

Ran live: parseHTML('<body><div class="whatever"></div></body>') -> document.querySelector('body') === document.body is true, and documentElement.outerHTML is <html><head></head><body><div class="whatever"></div></body></html>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[bug] document shortcut element properties lose their children

1 participant