Skip to content

Commit

Permalink
Call out inconsistency in document.body behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
zcorpan committed Feb 12, 2018
1 parent 1d64c41 commit aa2bec4
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -9602,6 +9602,23 @@ partial interface <dfn id="document" data-lt="">Document</dfn> {

</ol>

<p class="note">The value returned by the <code data-x="dom-document-body">body</code> getter is
not always the one passed to the setter.</p>

<div class="example">
<p>In this example, the setter successfully inserts a <code>body</code> element (though this is
non-conforming since SVG does not allow a <code>body</code> as child of <span>SVG
<code>svg</code></span>). However the getter will return null because the document element is not
<code>html</code>.</p>

<pre>&lt;svg xmlns="http://www.w3.org/2000/svg">
&lt;script>
document.body = document.createElementNS("http://www.w3.org/1999/xhtml", "body");
console.assert(document.body === null);
&lt;/script>
&lt;/svg></pre>
</div>

</div>

<hr>
Expand Down

0 comments on commit aa2bec4

Please sign in to comment.