Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Serialize the children of void elements as the empty string #4238

Merged
merged 4 commits into from
Dec 19, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 10 additions & 11 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -99935,7 +99935,6 @@ dictionary <dfn>StorageEventInit</dfn> : <span>EventInit</span> {
<dd><code>area</code>, <code>base</code>, <code>br</code>, <code>col</code>, <code>embed</code>,
<code>hr</code>, <code>img</code>, <code>input</code>, <code>link</code>, <code>meta</code>,
<code>param</code>, <code>source</code>, <code>track</code>, <code>wbr</code></dd>
<!-- see also other places that say VOIDLIST -->
<!-- non-conforming elements treated as void by the parser are not listed here: basefont,
bgsound, frame, keygen -->

Expand Down Expand Up @@ -110549,6 +110548,10 @@ document.body.appendChild(text);

<!--en-GB--><h3 id="serialising-html-fragments">Serializing HTML fragments</h3>

<p>For the purposes of the following algorithm, an element <dfn>serializes as void</dfn> if its
element type is one of the <span>void elements</span>, or is <code>basefont</code>,
<code>bgsound</code>, <code>frame</code>, or <code>keygen</code>.</p>

<p>The following steps form the <!--en-GB--><dfn id="html-fragment-serialisation-algorithm"
data-export="">HTML fragment serialization algorithm</dfn>. The algorithm takes as input a DOM
<code>Element</code>, <code>Document</code>, or <code>DocumentFragment</code> referred to as
Expand All @@ -110559,6 +110562,9 @@ document.body.appendChild(text);

<ol>

<li><p>If <var>the node</var> <span>serializes as void</span>, then return the empty
string.</p></li>

<li><p>Let <var>s</var> be a string, and initialize it to the empty string.</p></li>

<li><p>If <var>the node</var> is a <code>template</code> element, then let <var>the node</var> instead be the <code>template</code> element's <span>template
Expand Down Expand Up @@ -110663,15 +110669,8 @@ document.body.appendChild(text);

<p>Append a U+003E GREATER-THAN SIGN character (&gt;).</p>

<p>If <var>current node</var> is an <code>area</code>, <code>base</code>,
<code>basefont</code>, <code>bgsound</code>, <code>br</code>, <code>col</code>,
<code>embed</code>, <code>frame</code>, <code>hr</code>, <code>img</code>,
<code>input</code>, <code>keygen</code>, <code>link</code>, <code>meta</code>,
<code>param</code>, <code>source</code>, <code>track</code> or <code>wbr</code> element,
then continue on to the next child node at this point.</p>
<!-- VOIDLIST superset -->
Zirro marked this conversation as resolved.
Show resolved Hide resolved
<!-- also, i guess: image, but we don't list it because we don't consider it an "element",
more a "macro", and thus we should never serialize it -->
<p>If <var>current node</var> <span>serializes as void</span>, then continue on to the next
child node at this point.</p>

<p>Append the value of running the <span>HTML fragment serialization algorithm</span> on the
<var>current node</var> element (thus recursing into this algorithm for that
Expand Down Expand Up @@ -110746,7 +110745,7 @@ document.body.appendChild(text);

</li>

<li><p>The result of the algorithm is the string <var>s</var>.</p></li>
<li><p>Return <var>s</var>.</p></li>

</ol>

Expand Down