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).
Given a select element like:
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).