Skip to content

html/dom: document.body returns a synthetic body for childless documents #29

Description

@ImLunaHey

Area: html/dom (98.6% pass)

Summary

document.body returns a synthetic <body> even for a document that has none, and the getter/setter don't follow the spec for childless / non-<body> root cases.

FAIL [2/26]  html/dom/documents/dom-tree-accessors/Document.body.html
  — Childless document: assert_equals: expected null but got Element node <body></body>

Expected

Per HTML §dom-document-body: document.body is the first child of the document element that is a <body> or <frameset>, or null if there is none. Setting body replaces/insets per spec and throws HierarchyRequestError for non-body/frameset values. A childless document must return null, not a fabricated body.

Repro

cargo run --release -p wpt-runner -- ./wpt html/dom/documents/dom-tree-accessors/Document.body.html 100

Metadata

Metadata

Labels

bugSomething isn't workingclaimedAn open issue someone is actively working ongood first issueGood for newcomers

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions