-
Notifications
You must be signed in to change notification settings - Fork 61
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
Update tests for relaxed <select> parser #178
base: master
Are you sure you want to change the base?
Conversation
This PR updates the tree-construction dat files for the HTML change which will allow additional tags within <select>: whatwg/html#10557
I'm not sure what the best practice is for rebaselining errors, but for now I removed all errors from affected tests. There are probably errors in tests I didn't change which may need to be rebaselined as well. |
Will there be a separate PR for new tests? |
FWIW when CI workflows are enabled, Nokogiri (downstream) tests will fail. I've started working on a branch with the proposed changes from whatwg/html#10557 |
I added new test cases to webkit02 including:
|
Nokogiri work-in-progress at sparklemotion/nokogiri#3317 |
@josepharhar I've got a question about two tests that are very similar. Zooming in on this one from
Nokogiri is constructing a different tree:
and I wanted to ask for a double-check that the test's assertion is correct, before I dive into Nokogiri's parser. Thank you! |
Thanks for asking! It looks like Nokogiri is nesting one Here's the relevant part of the spec PR: https://whatpr.org/html/10557/parsing.html#:~:text=A%20start%20tag%20whose%20tag%20name%20is%20%22select%22 As for the I'll take a closer look at which we should do and get back to you on that. Thanks! |
Thanks for replying so quickly.
No, sorry, unless I'm misunderstanding your comment, this is not a correct description of what Nokogiri's parser is doing. Here's a more graphical representation of the tree from my previous comment:
i.e. The select tags are not nested. Just wanted to clarify. (And if it's helpful context, Nokogiri is maintaining a fork of libgumbo.) |
Ah whoops, I failed to read the tree properly 😅 I looked into why chromium is putting the b inside the select instead of the other way around, and i found that the This is happening due to this call to the adoption agency algorithm when I verified that chromium does the same thing as Nokogiri when I comment out that call to the adoption agency algorithm. There's a lot of steps in that algorithm and I'm having a hard time wrapping my head around it, but does Nokogiri have that call to the adoption agency algorithm too? Or perhaps the implementations of the algorithm are different? |
@josepharhar Thanks again for your kind reply! Yes, Nokogiri's libgumbo has implemented the adoption agency algorithm, and I have confirmed that in these tests we are invoking it. It's helpful to know this is likely the source of the behavior difference, so I'll focus my efforts on making sure it matches the current spec (though I'll note it passes every other test in this suite ... 🤷). |
OK, I think I know what's going on here. I think Chromium has missed this change: If
will not trigger a parse-error-and-return, and the algorithm will continue. But If I remove the Can you check to see if my hunch is right? |
Thanks so much for figuring this out! Yeah I totally missed that in the chromium implementation but I just added it and updated the tests here. |
@josepharhar That's great! Thank you! I've got a patch to get the error messages to a point where libgumbo is passing, would you mind taking a look and potentially applying to this PR? (Renamed to |
Looks good, thanks! I applied it. Sometimes I wonder why chromium throws away parse errors. |
This change was included in the parser spec changes but I forgot to add it to the implementation. It was identified here: html5lib/html5lib-tests#178 Change-Id: I13f7ba11dc2dda814e488829a05fe4ee7c670d52 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5948083 Commit-Queue: Joey Arhar <[email protected]> Reviewed-by: David Baron <[email protected]> Cr-Commit-Position: refs/heads/main@{#1375607}
Neither the proposal nor the test changes are merged yet. Also, the tests are still failing. html5lib/html5lib-tests#178 whatwg/html#10557
the changes to |
html5lib/html5lib-tests#178 The proposal isn't merged yet, and the error codes are off. The forked html5lib-tests makes it more complicated. I recommend to ditch the fork of html5lib-tests and give up on standardizing errors.
Co-authored-by: Markus Unterwaditzer <[email protected]>
| <select> | ||
| <option> | ||
| "B" | ||
| <select> | ||
| <option> | ||
| "C" | ||
| <select> | ||
| <option> | ||
| "D" | ||
| <select> | ||
| <option> | ||
| "E" | ||
| <select> | ||
| <option> | ||
| "F" | ||
| <select> | ||
| <option> | ||
| "G" | ||
| <select> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test expectation should be reverted per whatwg/html#10557 (comment)
@@ -438,34 +439,34 @@ eof-in-math | |||
| <select> | |||
| <optgroup> | |||
| <option> | |||
| <hr> | |||
| <hr> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be reverted per whatwg/html#10557 (comment)
| <option> | ||
| <i> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<i>
should be the parent per whatwg/html#10557 (comment)
This PR updates the tree-construction dat files for the HTML change which will allow additional tags within
<select>
:whatwg/html#10557