Skip to content

Commit aa2bec4

Browse files
authored
Call out inconsistency in document.body behavior
Fixes #3403. Tests: web-platform-tests/wpt#9231
1 parent 1d64c41 commit aa2bec4

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

source

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9602,6 +9602,23 @@ partial interface <dfn id="document" data-lt="">Document</dfn> {
96029602

96039603
</ol>
96049604

9605+
<p class="note">The value returned by the <code data-x="dom-document-body">body</code> getter is
9606+
not always the one passed to the setter.</p>
9607+
9608+
<div class="example">
9609+
<p>In this example, the setter successfully inserts a <code>body</code> element (though this is
9610+
non-conforming since SVG does not allow a <code>body</code> as child of <span>SVG
9611+
<code>svg</code></span>). However the getter will return null because the document element is not
9612+
<code>html</code>.</p>
9613+
9614+
<pre>&lt;svg xmlns="http://www.w3.org/2000/svg">
9615+
&lt;script>
9616+
document.body = document.createElementNS("http://www.w3.org/1999/xhtml", "body");
9617+
console.assert(document.body === null);
9618+
&lt;/script>
9619+
&lt;/svg></pre>
9620+
</div>
9621+
96059622
</div>
96069623

96079624
<hr>

0 commit comments

Comments
 (0)