Skip to content

Parsing: <menuitem> should not be a void element #234

Closed
@zcorpan

Description

@zcorpan

https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inbody

A start tag whose tag name is one of: "menuitem", "param", "source", "track"
Insert an HTML element for the token. Immediately pop the current node off the stack of open elements.

Acknowledge the token's self-closing flag, if it is set.

Original email:

As per specification [1][2], <menuitem> should not have end tag, but few
websites uses <menuitem>Some markup</menuitem> which resulted in broken
sites[3][4].
https://lists.w3.org/Archives/Public/public-whatwg-archive/2014Nov/0143.html

When I researched this last year I concluded

Based on this, it seems possible to keep it as a void element and only use
the label attribute.
https://lists.w3.org/Archives/Public/public-whatwg-archive/2014Dec/0028.html

Now @tabatkins reported https://developer.apple.com/library/prerelease/ios/documentation/HealthKit/Reference/HealthKit_Constants/index.html#//apple_ref/c/econst/HKBodyTemperatureSensorLocationRectum as being broken with void menuitem parsing.
https://lists.w3.org/Archives/Public/public-whatwg-archive/2015Oct/0006.html

Proposed fix:

  • Make the end tag optional and have <menuitem>, <menu> and <hr> generate implied </menuitem> end tags. (Maybe other tags like <li> and <p> can also imply </menuitem>.) The label attribute be honored if specified, otherwise use the textContent with leading and trailing whitespace trimmed.

This would allow either syntax unless I'm missing something.
https://lists.w3.org/Archives/Public/public-whatwg-archive/2014Nov/0145.html

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions