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

empty <menuitem>s misnest #96

Open
mikesamuel opened this issue Oct 4, 2016 · 1 comment
Open

empty <menuitem>s misnest #96

mikesamuel opened this issue Oct 4, 2016 · 1 comment
Labels

Comments

@mikesamuel
Copy link
Contributor

mikesamuel commented Oct 4, 2016

wynne.jg reports

Sanitizing

<div contenteditable="true" contextmenu="MY_MENU" dir="ltr" draggable="true" dropzone="copy" hidden="" spellcheck="true" translate="yes">
  <menu id="MY_MENU" type="context"> 
    <menuitem label="Refresh"></menuitem> 
    <menuitem label="Twitter"></menuitem>
  </menu> LOTS OF TEXT HERE
</div>

yields the following

<div contenteditable="true" contextmenu="MY_MENU" dir="ltr" draggable="true" dropzone="copy" hidden="" spellcheck="true" translate="yes"> 
  <menu id="MY_MENU" type="context">
    <menuitem label="Refresh"> <menuitem label="Twitter"></menuitem></menuitem>
  </menu> LOTS OF TEXT HERE 
</div>

Note the <menuitem>s are nesting in the output but are siblings in the input.

@pickle-weasle
Copy link

A bit more information for this one.
The tags seem to only get misnested if there is no text between the opening and closing tags.
e.g.
<menuitem label="Refresh"></menuitem> <menuitem label="Twitter"></menuitem>
will be misnested, however
<menuitem label="Refresh"> REFRESH</menuitem> <menuitem label="Twitter">TWITTER</menuitem>
will be nested fine.

From looking at some resources online, this element is aparently an empty element that has no permited content between it's opening and closing tags
Also most examples I've found don't bother having any text between the tags.
However, from playing around with the element it seems that browsers will use the text between the tags as a fallback if there is no label attribute specified.
Ideally it'd be nice if the sanitizer could handle both ways

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants