Skip to content

Commit 4473bbe

Browse files
committed
Make <menuitem> parse like an unknown element
This partially reverts commits: 2999aa0 5e49a20 Fixes #2308.
1 parent 916e1b9 commit 4473bbe

File tree

1 file changed

+37
-76
lines changed

1 file changed

+37
-76
lines changed

source

Lines changed: 37 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -55746,8 +55746,10 @@ interface <dfn>HTMLMenuItemElement</dfn> : <span>HTMLElement</span> {
5574655746
&lt;menu type=context id=namemenu>
5574755747
&lt;menuitem onclick="document.forms.npc.elements.char.value = getRandomName()">
5574855748
Pick random name
55749+
&lt;/menuitem>
5574955750
&lt;menuitem onclick="prefillFields(document.forms.npc.elements.char.value)">
5575055751
Prefill other fields based on name
55752+
&lt;/menuitem>
5575155753
&lt;/menu>
5575255754
&lt;/form></pre>
5575355755

@@ -55842,11 +55844,11 @@ interface <dfn>HTMLMenuItemElement</dfn> : <span>HTMLElement</span> {
5584255844

5584355845
<pre>&lt;img src="cats.jpeg" alt="Cats" contextmenu=catsmenu>
5584455846
&lt;menu type="context" id="catsmenu">
55845-
&lt;menuitem label="Pet the kittens" onclick="kittens.pet()">
55846-
&lt;menuitem label="Cuddle with the kittens" onclick="kittens.cuddle()">
55847+
&lt;menuitem label="Pet the kittens" onclick="kittens.pet()">&lt;/menuitem>
55848+
&lt;menuitem label="Cuddle with the kittens" onclick="kittens.cuddle()">&lt;/menuitem>
5584755849
&lt;menu label="Feed the kittens"><!-- note: contents of this submenu aren't visible in the pictures below -->
55848-
&lt;menuitem label="Fish" onclick="kittens.feed(fish)">
55849-
&lt;menuitem label="Chicken" onclick="kittens.feed(chicken)">
55850+
&lt;menuitem label="Fish" onclick="kittens.feed(fish)">&lt;/menuitem>
55851+
&lt;menuitem label="Chicken" onclick="kittens.feed(chicken)">&lt;/menuitem>
5585055852
&lt;/menu>
5585155853
&lt;/menu></pre>
5585255854

@@ -98790,12 +98792,6 @@ dictionary <dfn>StorageEventInit</dfn> : <span>EventInit</span> {
9879098792
if it is immediately followed by an <code>optgroup</code> element, or if there is no more content
9879198793
in the parent element.</p>
9879298794

98793-
<!-- </menuitem> -->
98794-
<p>A <code>menuitem</code> element's <span data-x="syntax-end-tag">end tag</span> may be omitted
98795-
if the <code>menuitem</code> element is immediately followed by a <code>menuitem</code>,
98796-
<code>hr</code>, or <code>menu</code> element, or if there is no more content in the parent
98797-
element.</p>
98798-
9879998795
<!-- <colgroup> -->
9880098796
<p>A <code>colgroup</code> element's <span data-x="syntax-start-tag">start tag</span> may be
9880198797
omitted if the first thing inside the <code>colgroup</code> element is a <code>col</code> element,
@@ -103670,10 +103666,10 @@ document.body.appendChild(text);
103670103666

103671103667
<p>When the steps below require the UA to <dfn>generate implied end tags</dfn>, then, while the
103672103668
<span>current node</span> is a <code>dd</code> element, a <code>dt</code> element, an
103673-
<code>li</code> element, a <code>menuitem</code> element, an <code>optgroup</code> element, an
103674-
<code>option</code> element, a <code>p</code> element, an <code>rb</code> element, an
103675-
<code>rp</code> element, an <code>rt</code> element, or an <code>rtc</code> element, the UA must
103676-
pop the <span>current node</span> off the <span>stack of open elements</span>.</p>
103669+
<code>li</code> element, an <code>optgroup</code> element, an <code>option</code> element, a
103670+
<code>p</code> element, an <code>rb</code> element, an <code>rp</code> element, an <code>rt</code>
103671+
element, or an <code>rtc</code> element, the UA must pop the <span>current node</span> off the
103672+
<span>stack of open elements</span>.</p>
103677103673

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

104579104575
<li><p>If there is a node in the <span>stack of open elements</span> that is not either a
104580-
<code>dd</code> element, a <code>dt</code> element, an <code>li</code> element, a
104581-
<code>menuitem</code> element, an <code>optgroup</code> element, an <code>option</code>
104582-
element, a <code>p</code> element, an <code>rb</code> element, an <code>rp</code> element, an
104583-
<code>rt</code> element, an <code>rtc</code> element, a <code>tbody</code> element, a
104584-
<code>td</code> element, a <code>tfoot</code> element, a <code>th</code> element, a
104585-
<code>thead</code> element, a <code>tr</code> element, the <code>body</code> element, or the
104586-
<code>html</code> element, then this is a <span>parse error</span>.</p></li> <!-- (some of
104587-
those are fragment cases) -->
104576+
<code>dd</code> element, a <code>dt</code> element, an <code>li</code> element, an
104577+
<code>optgroup</code> element, an <code>option</code> element, a <code>p</code> element, an
104578+
<code>rb</code> element, an <code>rp</code> element, an <code>rt</code> element, an
104579+
<code>rtc</code> element, a <code>tbody</code> element, a <code>td</code> element, a
104580+
<code>tfoot</code> element, a <code>th</code> element, a <code>thead</code> element, a
104581+
<code>tr</code> element, the <code>body</code> element, or the <code>html</code> element, then
104582+
this is a <span>parse error</span>.</p></li> <!-- (some of those are fragment cases) -->
104588104583

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

@@ -104602,15 +104597,15 @@ document.body.appendChild(text);
104602104597
<!-- if we get here, the insertion mode here is forcibly "in body". -->
104603104598

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

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

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

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

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

104673104668
</dd>
104674104669

104675-
<!-- as normal, but close menuitem if it's the current node -->
104676-
<dt>A start tag whose tag name is "menu"</dt>
104677-
<dd>
104678-
104679-
<p>If the <span>stack of open elements</span> <span data-x="has an element in button scope">has a
104680-
<code>p</code> element in button scope</span>, then <span>close a <code>p</code>
104681-
element</span>.</p>
104682-
104683-
<!-- fake </menuitem> (maybe) -->
104684-
<p>If the <span>current node</span> is a <code>menuitem</code> element, pop that node from the
104685-
<span>stack of open elements</span>.</p>
104686-
<!-- end of fake </menuitem> -->
104687-
104688-
<p><span>Insert an HTML element</span> for the token.</p>
104689-
104690-
</dd>
104691-
104692104670
<!-- as normal, but close h1-h6 if it's the current node -->
104693104671
<dt>A start tag whose tag name is one of: "h1", "h2", "h3", "h4",
104694104672
"h5", "h6"</dt>
@@ -104942,7 +104920,7 @@ document.body.appendChild(text);
104942104920

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

104945-
<!-- the normal ones (and menu) -->
104923+
<!-- the normal ones -->
104946104924
<dt>An end tag whose tag name is one of: "address", "article", "aside", "blockquote", "button",
104947104925
"center", "details", "dialog", "dir", "div", "dl", "fieldset", "figcaption", "figure", "footer",
104948104926
"header", "hgroup", "listing", "main", "menu", "nav", "ol", "pre", "section", "summary",
@@ -105313,11 +105291,6 @@ document.body.appendChild(text);
105313105291
<code>p</code> element in button scope</span>, then <span>close a <code>p</code>
105314105292
element</span>.</p>
105315105293

105316-
<!-- fake </menuitem> (maybe) -->
105317-
<p>If the <span>current node</span> is a <code>menuitem</code> element, pop that node from the
105318-
<span>stack of open elements</span>.</p>
105319-
<!-- end of fake </menuitem> -->
105320-
105321105294
<p><span>Insert an HTML element</span> for the token. Immediately pop the <span>current
105322105295
node</span> off the <span>stack of open elements</span>.</p>
105323105296

@@ -105427,18 +105400,6 @@ document.body.appendChild(text);
105427105400

105428105401
</dd>
105429105402

105430-
<dt>A start tag whose tag name is "menuitem"</dt>
105431-
<dd>
105432-
105433-
<p>If the <span>current node</span> is a <code>menuitem</code> element, then pop the
105434-
<span>current node</span> off the <span>stack of open elements</span>.</p>
105435-
105436-
<p><span>Reconstruct the active formatting elements</span>, if any.</p>
105437-
105438-
<p><span>Insert an HTML element</span> for the token.</p>
105439-
105440-
</dd>
105441-
105442105403
<dt>A start tag whose tag name is one of: "rb", "rtc"</dt>
105443105404
<dd>
105444105405

0 commit comments

Comments
 (0)