Skip to content

<button> inside <select> closes the select (customizable select) #2579

Open

Description

@voischev

The HTML spec now allows <button> (with <selectedcontent>) as the first child of <select> for customizable select (whatwg/html#10548, whatwg/html#10310). htmlparser2 closes the <select> as soon as <button> opens.

import { parseDocument } from "htmlparser2";
import render from "dom-serializer";

render(parseDocument(
  "<select><button><selectedcontent></selectedcontent></button><option>A</option></select>"
));
// actual:   <select></select><button><selectedcontent></selectedcontent></button><option>A</option>
// expected: <select><button><selectedcontent></selectedcontent></button><option>A</option></select>

Cause: in openImpliesClose, button maps to formTags, which contains select.

Reproduced with htmlparser2 12.0.0 and current master. With xmlMode: true the structure is preserved.

Originally reported downstream in posthtml/posthtml#408.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions