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

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

Closed
rhdunn opened this issue Feb 4, 2020 · 1 comment
Closed
Labels
bug Confirmed bug that we should fix
Milestone

Comments

@rhdunn
Copy link

rhdunn commented Feb 4, 2020

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).

@jhy jhy added the bug Confirmed bug that we should fix label Feb 9, 2020
@jhy jhy closed this as completed in fbc7e76 Feb 9, 2020
@jhy jhy added this to the 1.13.1 milestone Feb 9, 2020
@jhy
Copy link
Owner

jhy commented Feb 9, 2020

Thanks, fixed!

This was referenced Feb 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Confirmed bug that we should fix
Projects
None yet
Development

No branches or pull requests

2 participants