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

feat: gumbo support for hr in select #2872

Merged
merged 3 commits into from
May 6, 2023

Conversation

flavorjones
Copy link
Member

@flavorjones flavorjones commented May 3, 2023

What problem is this PR intended to solve?

feat: gumbo support for <hr> in <select>

The text added to the parser spec, under "in select" insertion mode, is:

A start tag whose tag name is "hr"

If the current node is an option element, pop that node from the stack of open elements.

If the current node is an optgroup element, pop that node from the stack of open elements.

Insert an HTML element for the token. Immediately pop the current node off the stack of open elements.

Acknowledge the token's self-closing flag, if it is set.

Also improve gumbo tree construction test failure messages.

Have you included adequate test coverage?

Yes.

Does this change affect the behavior of either the C or the Java implementations?

The HTML5 parser is only available in CRuby.

@flavorjones flavorjones added topic/HTML5 topic/gumbo Gumbo HTML5 parser labels May 3, 2023
@flavorjones flavorjones added this to the v1.15.0 milestone May 3, 2023
with the hr-in-select tests
where before we saw:

    TestHtml5TreeConstructionWebkit02#test_31 [/home/flavorjones/code/oss/nokogiri/test/html5/test_tree_construction.rb:35]
    Minitest::Assertion: Element <select><option><hr></option></select> has wrong number of children ["option"] in <table><tr><td><select><option><hr>.
    Expected: 2
      Actual: 1

now we'll see:

    TestHtml5TreeConstructionWebkit02#test_31 [/home/flavorjones/code/oss/nokogiri/test/html5/test_tree_construction.rb:35]
    Minitest::Assertion: Element <select> has wrong number of children ["option"]
       Input: <table><tr><td><select><option><hr>
    Expected: | <html>
              |   <head>
              |   <body>
              |     <table>
              |       <tbody>
              |         <tr>
              |           <td>
              |             <select>
              |               <option>
              |               <hr>
      Parsed: <select><option><hr></option></select>.
    Expected: 2
      Actual: 1
@flavorjones flavorjones force-pushed the flavorjones-gumbo-hr-in-select branch from b91078e to 68ededf Compare May 3, 2023 16:38
@flavorjones flavorjones requested a review from stevecheckoway May 3, 2023 17:07
@flavorjones flavorjones merged commit eb6eff8 into main May 6, 2023
@flavorjones flavorjones deleted the flavorjones-gumbo-hr-in-select branch May 6, 2023 15:52
Copy link
Contributor

@stevecheckoway stevecheckoway left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks for keeping on top of HTML changes!

The improved error messages for test failures looks much better too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic/gumbo Gumbo HTML5 parser topic/HTML5
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants