Skip to content

Commit

Permalink
Fix #234: Change <menuitem> from void to like-<option>
Browse files Browse the repository at this point in the history
- Add menuitem to "Generate implied end tags"
- <menuitem>, <hr> and <menu> pop a <menuitem>
- <menuitem> is not void and is not "special"
- An open menuitem at </body>, </html> or EOF is not a parse error.
  • Loading branch information
zcorpan committed Apr 8, 2016
1 parent 8fdccb5 commit 5e49a20
Showing 1 changed file with 90 additions and 48 deletions.
138 changes: 90 additions & 48 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -56820,8 +56820,10 @@ fur
<pre>&lt;form name="npc">
&lt;label>Character name: &lt;input name=char type=text contextmenu=namemenu required>&lt;/label>
&lt;menu type=context id=namemenu>
&lt;menuitem label="Pick random name" onclick="document.forms.npc.elements.char.value = getRandomName()">
&lt;menuitem label="Prefill other fields based on name" onclick="prefillFields(document.forms.npc.elements.char.value)">
&lt;menuitem onclick="document.forms.npc.elements.char.value = getRandomName()">
Pick random name
&lt;menuitem onclick="prefillFields(document.forms.npc.elements.char.value)">
Prefill other fields based on name
&lt;/menu>
&lt;/form></pre>

Expand Down Expand Up @@ -96593,8 +96595,8 @@ 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>keygen</code>, <code>link</code>,
<code>menuitem</code>, <code>meta</code>, <code>param</code>, <code>source</code>,
<code>track</code>, <code>wbr</code></dd>
<code>meta</code>, <code>param</code>, <code>source</code>, <code>track</code>,
<code>wbr</code></dd>
<!-- see also other places that say VOIDLIST -->

<dt><dfn>Raw text elements</dfn></dt>
Expand Down Expand Up @@ -97168,6 +97170,12 @@ dictionary <dfn>StorageEventInit</dfn> : <span>EventInit</span> {
if it is immediately followed by an <code>optgroup</code> element, or if there is no more content
in the parent element.</p>

<!-- </menuitem> -->
<p>A <code>menuitem</code> element's <span data-x="syntax-end-tag">end tag</span> may be omitted
if the <code>menuitem</code> element is immediately followed by a <code>menuitem</code>,
<code>hr</code>, or <code>menu</code> element, or if there is no more content in the parent
element.</p>

<!-- <colgroup> -->
<p>A <code>colgroup</code> element's <span data-x="syntax-start-tag">start tag</span> may be
omitted if the first thing inside the <code>colgroup</code> element is a <code>col</code> element,
Expand Down Expand Up @@ -98916,12 +98924,13 @@ dictionary <dfn>StorageEventInit</dfn> : <span>EventInit</span> {
<code>style</code>, <code>summary</code>, <code>table</code>, <code>tbody</code>,
<code>td</code>, <code>template</code>, <code>textarea</code>, <code>tfoot</code>,
<code>th</code>, <code>thead</code>, <code>title</code>, <code>tr</code>, <code>track</code>,
<code>ul</code>, <code>wbr</code>, and <code>xmp</code>; <span>MathML <code>mi</code></span>,
<span>MathML <code>mo</code></span>, <span>MathML <code>mn</code></span>, <span>MathML
<code>ms</code></span>, <span>MathML <code>mtext</code></span>, and <span>MathML
<code>annotation-xml</code></span>; and <span>SVG <code>foreignObject</code></span>, <span>SVG
<code>desc</code></span>, and <span>SVG <code>title</code></span>.</p></dd>
<!-- We could actually put all non-HTML elements in this list, I think -->
<code>ul</code>, <code>wbr</code>, and <code>xmp</code>; MathML's <code
data-x="math:mi">mi</code>, <code data-x="math:mo">mo</code>, <code data-x="math:mn">mn</code>,
<code data-x="math:ms">ms</code>, <code data-x="math:mtext">mtext</code>, and <code
data-x="math:annotation-xml">annotation-xml</code>; and SVG's <code
data-x="">foreignObject</code>, <code data-x="">desc</code>, and <code
data-x="">title</code>.</p></dd> <!-- we could actually put all non-HTML elements in this list, I
think -->

<dt><dfn>Formatting</dfn></dt>
<dd><p>The following HTML elements are those that end up in the <span>list of active formatting
Expand Down Expand Up @@ -101891,10 +101900,10 @@ document.body.appendChild(text);

<p>When the steps below require the UA to <dfn>generate implied end tags</dfn>, then, while the
<span>current node</span> is a <code>dd</code> element, a <code>dt</code> element, an
<code>li</code> element, an <code>optgroup</code> element, an <code>option</code> element, a
<code>p</code> element, an <code>rb</code> element, an <code>rp</code> element, an <code>rt</code>
element, or an <code>rtc</code> element, the UA must pop the <span>current node</span> off the
<span>stack of open elements</span>.</p>
<code>li</code> element, a <code>menuitem</code> element, an <code>optgroup</code> element, an
<code>option</code> element, a <code>p</code> element, an <code>rb</code> element, an
<code>rp</code> element, an <code>rt</code> element, or an <code>rtc</code> element, the UA must
pop the <span>current node</span> off the <span>stack of open elements</span>.</p>

<p>If a step requires the UA to generate implied end tags but lists an element to exclude from the
process, then the UA must perform the above steps as if that element was not in the above
Expand Down Expand Up @@ -102835,13 +102844,14 @@ document.body.appendChild(text);
<ol>

<li><p>If there is a node in the <span>stack of open elements</span> that is not either a
<code>dd</code> element, a <code>dt</code> element, an <code>li</code> element, an
<code>optgroup</code> element, an <code>option</code> element, a <code>p</code> element, an
<code>rb</code> element, an <code>rp</code> element, an <code>rt</code> element, an
<code>rtc</code> element, a <code>tbody</code> element, a <code>td</code> element, a
<code>tfoot</code> element, a <code>th</code> element, a <code>thead</code> element, a
<code>tr</code> element, the <code>body</code> element, or the <code>html</code> element, then
this is a <span>parse error</span>.</p></li> <!-- (some of those are fragment cases) -->
<code>dd</code> element, a <code>dt</code> element, an <code>li</code> element, a
<code>menuitem</code> element, an <code>optgroup</code> element, an <code>option</code>
element, a <code>p</code> element, an <code>rb</code> element, an <code>rp</code> element, an
<code>rt</code> element, an <code>rtc</code> element, a <code>tbody</code> element, a
<code>td</code> element, a <code>tfoot</code> element, a <code>th</code> element, a
<code>thead</code> element, a <code>tr</code> element, the <code>body</code> element, or the
<code>html</code> element, then this is a <span>parse error</span>.</p></li> <!-- (some of
those are fragment cases) -->

<li><p><span>Stop parsing</span>.</p></li>

Expand All @@ -102859,15 +102869,15 @@ document.body.appendChild(text);
<!-- if we get here, the insertion mode here is forcibly "in body". -->

<p>Otherwise, if there is a node in the <span>stack of open elements</span> that is not either a
<code>dd</code> element, a <code>dt</code> element, an <code>li</code> element, an
<code>optgroup</code> element, an <code>option</code> element, a <code>p</code> element, an
<code>rb</code> element, an <code>rp</code> element, an <code>rt</code> element, an
<code>rtc</code> element, a <code>tbody</code> element, a <code>td</code> element, a
<code>tfoot</code> element, a <code>th</code> element, a <code>thead</code> element, a
<code>tr</code> element, the <code>body</code> element, or the <code>html</code> element, then
this is a <span>parse error</span>.</p> <!-- (some of those are fragment cases, e.g., for
<tbody> you'd have hit the first paragraph since the <body> wouldn't be in scope, unless it was
a fragment case) -->
<code>dd</code> element, a <code>dt</code> element, an <code>li</code> element, a
<code>menuitem</code> element, an <code>optgroup</code> element, an <code>option</code> element,
a <code>p</code> element, an <code>rb</code> element, an <code>rp</code> element, an
<code>rt</code> element, an <code>rtc</code> element, a <code>tbody</code> element, a
<code>td</code> element, a <code>tfoot</code> element, a <code>th</code> element, a
<code>thead</code> element, a <code>tr</code> element, the <code>body</code> element, or the
<code>html</code> element, then this is a <span>parse error</span>.</p> <!-- (some of those are
fragment cases, e.g., for <tbody> you'd have hit the first paragraph since the <body> wouldn't
be in scope, unless it was a fragment case) -->

<!-- If we ever change the frameset-ok flag to an insertion mode, then we'd have to somehow keep
track of its state when we switch to after-body. -->
Expand All @@ -102888,15 +102898,15 @@ document.body.appendChild(text);
<!-- if we get here, the insertion mode here is forcibly "in body". -->

<p>Otherwise, if there is a node in the <span>stack of open elements</span> that is not either a
<code>dd</code> element, a <code>dt</code> element, an <code>li</code> element, an
<code>optgroup</code> element, an <code>option</code> element, a <code>p</code> element, an
<code>rb</code> element, an <code>rp</code> element, an <code>rt</code> element, an
<code>rtc</code> element, a <code>tbody</code> element, a <code>td</code> element, a
<code>tfoot</code> element, a <code>th</code> element, a <code>thead</code> element, a
<code>tr</code> element, the <code>body</code> element, or the <code>html</code> element, then
this is a <span>parse error</span>.</p> <!-- (some of those are fragment cases, e.g., for
<tbody> you'd have hit the first paragraph since the <body> wouldn't be in scope, unless it was
a fragment case) -->
<code>dd</code> element, a <code>dt</code> element, an <code>li</code> element, a
<code>menuitem</code> element, an <code>optgroup</code> element, an <code>option</code> element,
a <code>p</code> element, an <code>rb</code> element, an <code>rp</code> element, an
<code>rt</code> element, an <code>rtc</code> element, a <code>tbody</code> element, a
<code>td</code> element, a <code>tfoot</code> element, a <code>th</code> element, a
<code>thead</code> element, a <code>tr</code> element, the <code>body</code> element, or the
<code>html</code> element, then this is a <span>parse error</span>.</p> <!-- (some of those are
fragment cases, e.g., for <tbody> you'd have hit the first paragraph since the <body> wouldn't
be in scope, unless it was a fragment case) -->

<!-- If we ever change the frameset-ok flag to an insertion mode, then we'd have to somehow keep
track of its state when we switch to after-body. -->
Expand All @@ -102914,7 +102924,7 @@ document.body.appendChild(text);
<!-- the normal ones -->
<dt>A start tag whose tag name is one of: "address", "article", "aside", "blockquote", "center",
"details", "dialog", "dir", "div", "dl", "fieldset", "figcaption", "figure", "footer", "header",
"hgroup", "main", "menu", "nav", "ol", "p", "section", "summary", "ul"</dt>
"hgroup", "main", "nav", "ol", "p", "section", "summary", "ul"</dt>
<dd>

<!-- As of May 2008 this doesn't match any browser exactly, but is as close to what IE does as I
Expand All @@ -102929,6 +102939,23 @@ document.body.appendChild(text);

</dd>

<!-- as normal, but close menuitem if it's the current node -->
<dt>A start tag whose tag name is "menu"</dt>
<dd>

<p>If the <span>stack of open elements</span> <span data-x="has an element in button scope">has a
<code>p</code> element in button scope</span>, then <span>close a <code>p</code>
element</span>.</p>

<!-- fake </menuitem> (maybe) -->
<p>If the <span>current node</span> is a <code>menuitem</code> element, pop that node from the
<span>stack of open elements</span>.</p>
<!-- end of fake </menuitem> -->

<p><span>Insert an HTML element</span> for the token.</p>

</dd>

<!-- as normal, but close h1-h6 if it's the current node -->
<dt>A start tag whose tag name is one of: "h1", "h2", "h3", "h4",
"h5", "h6"</dt>
Expand Down Expand Up @@ -103182,7 +103209,7 @@ document.body.appendChild(text);

<!-- end tags for non-phrasing flow content elements (and button) -->

<!-- the normal ones -->
<!-- the normal ones (and menu) -->
<dt>An end tag whose tag name is one of: "address", "article", "aside", "blockquote", "button",
"center", "details", "dialog", "dir", "div", "dl", "fieldset", "figcaption", "figure", "footer",
"header", "hgroup", "listing", "main", "menu", "nav", "ol", "pre", "section", "summary",
Expand Down Expand Up @@ -103535,7 +103562,7 @@ document.body.appendChild(text);

</dd>

<dt>A start tag whose tag name is one of: "menuitem", "param", "source", "track"</dt>
<dt>A start tag whose tag name is one of: "param", "source", "track"</dt>
<dd>

<p><span>Insert an HTML element</span> for the token. Immediately pop the <span>current
Expand All @@ -103553,6 +103580,11 @@ document.body.appendChild(text);
<code>p</code> element in button scope</span>, then <span>close a <code>p</code>
element</span>.</p>

<!-- fake </menuitem> (maybe) -->
<p>If the <span>current node</span> is a <code>menuitem</code> element, pop that node from the
<span>stack of open elements</span>.</p>
<!-- end of fake </menuitem> -->

<p><span>Insert an HTML element</span> for the token. Immediately pop the <span>current
node</span> off the <span>stack of open elements</span>.</p>

Expand Down Expand Up @@ -103742,6 +103774,16 @@ document.body.appendChild(text);

</dd>

<dt>A start tag whose tag name is "menuitem"</dt>
<dd>

<p>If the <span>current node</span> is a <code>menuitem</code> element, then pop the
<span>current node</span> off the <span>stack of open elements</span>.</p>

<p><span>Insert an HTML element</span> for the token.</p>

</dd>

<dt>A start tag whose tag name is one of: "rb", "rtc"</dt>
<dd>

Expand Down Expand Up @@ -103818,9 +103860,9 @@ document.body.appendChild(text);
<dt>A start <!--or end--> tag whose tag name is one of: "caption", "col", "colgroup", "frame",
"head", "tbody", "td", "tfoot", "th", "thead", "tr"</dt>
<!--<dt>An end tag whose tag name is one of: "area", "base", "basefont", "bgsound", "embed",
"hr", "iframe", "image", "img", "input", "isindex", "keygen", "link", "menuitem", "meta",
"noembed", "noframes", "param", "script", "select", "source", "style", "table", "textarea",
"title", "track", "wbr"</dt>-->
"hr", "iframe", "image", "img", "input", "isindex", "keygen", "link", "meta", "noembed",
"noframes", "param", "script", "select", "source", "style", "table", "textarea", "title",
"track", "wbr"</dt>-->
<!--<dt>An end tag whose tag name is "noscript", if the <span>scripting flag</span> is
enabled</dt>-->
<dd>
Expand Down Expand Up @@ -106550,9 +106592,9 @@ document.body.appendChild(text);
<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>menuitem</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>
<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 -->
<!-- also, i guess: image and isindex, but we don't list those because we don't consider
those "elements", more "macros", and thus we should never serialise them -->
Expand Down

0 comments on commit 5e49a20

Please sign in to comment.