Skip to content

multiple optgroups without closing tags are incorrectly formatted as html #1313

@rhdunn

Description

@rhdunn

Given a select element like:

<select>
  <optgroup label="a">
  <option>one
  <option>two
  <option>three
  <optgroup label="b">
  <option>one
  <option>two
  <option>three
</select>

The jsoup parser does not close the 'a' optgroup when it encounters the 'b' optgroup element like is done in web browsers. This results in the 'b' optgroup element being contained within the 'a' optgroup element instead of the select element.

The https://html.spec.whatwg.org/multipage/parsing.html#parsing-main-inselect stage should first pop the option node from the stack (as it is current node), then pop the optgroup element (as that then becomes the current node).

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugA confirmed bug, that we should fix

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions