Skip to content

Commit 0ca0377

Browse files
committed
Make <menuitem> parse like an unknown element
This partially reverts commits: 2999aa0 5e49a20 Fixes #2308.
1 parent 74a78cb commit 0ca0377

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
@@ -55847,8 +55847,10 @@ interface <dfn>HTMLMenuItemElement</dfn> : <span>HTMLElement</span> {
5584755847
&lt;menu type=context id=namemenu>
5584855848
&lt;menuitem onclick="document.forms.npc.elements.char.value = getRandomName()">
5584955849
Pick random name
55850+
&lt;/menuitem>
5585055851
&lt;menuitem onclick="prefillFields(document.forms.npc.elements.char.value)">
5585155852
Prefill other fields based on name
55853+
&lt;/menuitem>
5585255854
&lt;/menu>
5585355855
&lt;/form></pre>
5585455856

@@ -55943,11 +55945,11 @@ interface <dfn>HTMLMenuItemElement</dfn> : <span>HTMLElement</span> {
5594355945

5594455946
<pre>&lt;img src="cats.jpeg" alt="Cats" contextmenu=catsmenu>
5594555947
&lt;menu type="context" id="catsmenu">
55946-
&lt;menuitem label="Pet the kittens" onclick="kittens.pet()">
55947-
&lt;menuitem label="Cuddle with the kittens" onclick="kittens.cuddle()">
55948+
&lt;menuitem label="Pet the kittens" onclick="kittens.pet()">&lt;/menuitem>
55949+
&lt;menuitem label="Cuddle with the kittens" onclick="kittens.cuddle()">&lt;/menuitem>
5594855950
&lt;menu label="Feed the kittens"><!-- note: contents of this submenu aren't visible in the pictures below -->
55949-
&lt;menuitem label="Fish" onclick="kittens.feed(fish)">
55950-
&lt;menuitem label="Chicken" onclick="kittens.feed(chicken)">
55951+
&lt;menuitem label="Fish" onclick="kittens.feed(fish)">&lt;/menuitem>
55952+
&lt;menuitem label="Chicken" onclick="kittens.feed(chicken)">&lt;/menuitem>
5595155953
&lt;/menu>
5595255954
&lt;/menu></pre>
5595355955

@@ -98896,12 +98898,6 @@ dictionary <dfn>StorageEventInit</dfn> : <span>EventInit</span> {
9889698898
if it is immediately followed by an <code>optgroup</code> element, or if there is no more content
9889798899
in the parent element.</p>
9889898900

98899-
<!-- </menuitem> -->
98900-
<p>A <code>menuitem</code> element's <span data-x="syntax-end-tag">end tag</span> may be omitted
98901-
if the <code>menuitem</code> element is immediately followed by a <code>menuitem</code>,
98902-
<code>hr</code>, or <code>menu</code> element, or if there is no more content in the parent
98903-
element.</p>
98904-
9890598901
<!-- <colgroup> -->
9890698902
<p>A <code>colgroup</code> element's <span data-x="syntax-start-tag">start tag</span> may be
9890798903
omitted if the first thing inside the <code>colgroup</code> element is a <code>col</code> element,
@@ -103776,10 +103772,10 @@ document.body.appendChild(text);
103776103772

103777103773
<p>When the steps below require the UA to <dfn>generate implied end tags</dfn>, then, while the
103778103774
<span>current node</span> is a <code>dd</code> element, a <code>dt</code> element, an
103779-
<code>li</code> element, a <code>menuitem</code> element, an <code>optgroup</code> element, an
103780-
<code>option</code> element, a <code>p</code> element, an <code>rb</code> element, an
103781-
<code>rp</code> element, an <code>rt</code> element, or an <code>rtc</code> element, the UA must
103782-
pop the <span>current node</span> off the <span>stack of open elements</span>.</p>
103775+
<code>li</code> element, an <code>optgroup</code> element, an <code>option</code> element, a
103776+
<code>p</code> element, an <code>rb</code> element, an <code>rp</code> element, an <code>rt</code>
103777+
element, or an <code>rtc</code> element, the UA must pop the <span>current node</span> off the
103778+
<span>stack of open elements</span>.</p>
103783103779

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

104685104681
<li><p>If there is a node in the <span>stack of open elements</span> that is not either a
104686-
<code>dd</code> element, a <code>dt</code> element, an <code>li</code> element, a
104687-
<code>menuitem</code> element, an <code>optgroup</code> element, an <code>option</code>
104688-
element, a <code>p</code> element, an <code>rb</code> element, an <code>rp</code> element, an
104689-
<code>rt</code> element, an <code>rtc</code> element, a <code>tbody</code> element, a
104690-
<code>td</code> element, a <code>tfoot</code> element, a <code>th</code> element, a
104691-
<code>thead</code> element, a <code>tr</code> element, the <code>body</code> element, or the
104692-
<code>html</code> element, then this is a <span>parse error</span>.</p></li> <!-- (some of
104693-
those are fragment cases) -->
104682+
<code>dd</code> element, a <code>dt</code> element, an <code>li</code> element, an
104683+
<code>optgroup</code> element, an <code>option</code> element, a <code>p</code> element, an
104684+
<code>rb</code> element, an <code>rp</code> element, an <code>rt</code> element, an
104685+
<code>rtc</code> element, a <code>tbody</code> element, a <code>td</code> element, a
104686+
<code>tfoot</code> element, a <code>th</code> element, a <code>thead</code> element, a
104687+
<code>tr</code> element, the <code>body</code> element, or the <code>html</code> element, then
104688+
this is a <span>parse error</span>.</p></li> <!-- (some of those are fragment cases) -->
104694104689

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

@@ -104708,15 +104703,15 @@ document.body.appendChild(text);
104708104703
<!-- if we get here, the insertion mode here is forcibly "in body". -->
104709104704

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

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

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

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

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

104779104774
</dd>
104780104775

104781-
<!-- as normal, but close menuitem if it's the current node -->
104782-
<dt>A start tag whose tag name is "menu"</dt>
104783-
<dd>
104784-
104785-
<p>If the <span>stack of open elements</span> <span data-x="has an element in button scope">has a
104786-
<code>p</code> element in button scope</span>, then <span>close a <code>p</code>
104787-
element</span>.</p>
104788-
104789-
<!-- fake </menuitem> (maybe) -->
104790-
<p>If the <span>current node</span> is a <code>menuitem</code> element, pop that node from the
104791-
<span>stack of open elements</span>.</p>
104792-
<!-- end of fake </menuitem> -->
104793-
104794-
<p><span>Insert an HTML element</span> for the token.</p>
104795-
104796-
</dd>
104797-
104798104776
<!-- as normal, but close h1-h6 if it's the current node -->
104799104777
<dt>A start tag whose tag name is one of: "h1", "h2", "h3", "h4",
104800104778
"h5", "h6"</dt>
@@ -105048,7 +105026,7 @@ document.body.appendChild(text);
105048105026

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

105051-
<!-- the normal ones (and menu) -->
105029+
<!-- the normal ones -->
105052105030
<dt>An end tag whose tag name is one of: "address", "article", "aside", "blockquote", "button",
105053105031
"center", "details", "dialog", "dir", "div", "dl", "fieldset", "figcaption", "figure", "footer",
105054105032
"header", "hgroup", "listing", "main", "menu", "nav", "ol", "pre", "section", "summary",
@@ -105419,11 +105397,6 @@ document.body.appendChild(text);
105419105397
<code>p</code> element in button scope</span>, then <span>close a <code>p</code>
105420105398
element</span>.</p>
105421105399

105422-
<!-- fake </menuitem> (maybe) -->
105423-
<p>If the <span>current node</span> is a <code>menuitem</code> element, pop that node from the
105424-
<span>stack of open elements</span>.</p>
105425-
<!-- end of fake </menuitem> -->
105426-
105427105400
<p><span>Insert an HTML element</span> for the token. Immediately pop the <span>current
105428105401
node</span> off the <span>stack of open elements</span>.</p>
105429105402

@@ -105533,18 +105506,6 @@ document.body.appendChild(text);
105533105506

105534105507
</dd>
105535105508

105536-
<dt>A start tag whose tag name is "menuitem"</dt>
105537-
<dd>
105538-
105539-
<p>If the <span>current node</span> is a <code>menuitem</code> element, then pop the
105540-
<span>current node</span> off the <span>stack of open elements</span>.</p>
105541-
105542-
<p><span>Reconstruct the active formatting elements</span>, if any.</p>
105543-
105544-
<p><span>Insert an HTML element</span> for the token.</p>
105545-
105546-
</dd>
105547-
105548105509
<dt>A start tag whose tag name is one of: "rb", "rtc"</dt>
105549105510
<dd>
105550105511

0 commit comments

Comments
 (0)