-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
HTML API: Use full parser for html5lib tests #7117
Conversation
4a97cab
to
1c834ba
Compare
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
Previously, the fragment parser in WP_HTML_Processor has only allowed creating a fragment with the `<body>` context. In this patch, any context node is allowed.
strlen( $this->sought_tag_name ) !== $this->tag_name_length || | ||
0 !== substr_compare( $this->html, $this->sought_tag_name, $this->tag_name_starts_at, $this->tag_name_length, true ) | ||
) | ||
) { |
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.
we need this. next_tag( 'PLAINTEXT' )
stopped on P
@sirreal I've added active format reconstruction to the |
Leaving a note for posterity's sake: adding active format reconstruction to PLAINTEXT is wrong. Adding PLAINTEXT is more complicated than it originally seemed, because even though every remaining token is a character token, if there are any character tokens left, they may trigger active format reconstruction. This is something I'll try and fix |
adfe657
to
a385685
Compare
Fragment support extracted into #7141 where I thought I had already done so, sorry! |
Thanks, I'll revert the changes to support arbitrary fragments here and continue to only support |
This reverts commit a385685.
This is no longer required. The full or fragment parser will be used as necessary.
The "</#" HTML test demonstrates a bug that must be fixed.
A state change was missing when the input is too short to find a comment closer in an opened funky comment. This fixes a issue where `</#` does not correctly report incomplete input, but `</# ` does.
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Core Committers: Use this line as a base for the props when committing in SVN:
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
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 is a nice improvement in how many tests run, and it's not trivial to fix the test runner. Thanks again @sirreal!
This is a tests-only change.
Previously the `html5lib` tests have only run in the fragment parser mode, assuming IN BODY context. This limited the number of tests which could run and was a result of the HTML Processor only supporting the IN BODY fragment parser. In [58836], however, a full parser was added to the HTML Processor. In this patch the full parser is utilized in order to run more of the previously-skipped tests, asserting more behaviors in the HTML parsing. Developed in #7117 Discussed in https://core.trac.wordpress.org/ticket/61646 Props: dmsnell, jonsurrell. See #61646. git-svn-id: https://develop.svn.wordpress.org/trunk@58859 602fd350-edb4-49c9-b593-d223f7449a82
Previously the `html5lib` tests have only run in the fragment parser mode, assuming IN BODY context. This limited the number of tests which could run and was a result of the HTML Processor only supporting the IN BODY fragment parser. In [58836], however, a full parser was added to the HTML Processor. In this patch the full parser is utilized in order to run more of the previously-skipped tests, asserting more behaviors in the HTML parsing. Developed in WordPress/wordpress-develop#7117 Discussed in https://core.trac.wordpress.org/ticket/61646 Props: dmsnell, jonsurrell. See #61646. Built from https://develop.svn.wordpress.org/trunk@58859 git-svn-id: http://core.svn.wordpress.org/trunk@58255 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Previously the `html5lib` tests have only run in the fragment parser mode, assuming IN BODY context. This limited the number of tests which could run and was a result of the HTML Processor only supporting the IN BODY fragment parser. In [58836], however, a full parser was added to the HTML Processor. In this patch the full parser is utilized in order to run more of the previously-skipped tests, asserting more behaviors in the HTML parsing. Developed in WordPress/wordpress-develop#7117 Discussed in https://core.trac.wordpress.org/ticket/61646 Props: dmsnell, jonsurrell. See #61646. Built from https://develop.svn.wordpress.org/trunk@58859 git-svn-id: https://core.svn.wordpress.org/trunk@58255 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Previously the `html5lib` tests have only run in the fragment parser mode, assuming IN BODY context. This limited the number of tests which could run and was a result of the HTML Processor only supporting the IN BODY fragment parser. In [58836], however, a full parser was added to the HTML Processor. In this patch the full parser is utilized in order to run more of the previously-skipped tests, asserting more behaviors in the HTML parsing. Developed in WordPress#7117 Discussed in https://core.trac.wordpress.org/ticket/61646 Props: dmsnell, jonsurrell. See #61646. git-svn-id: https://develop.svn.wordpress.org/trunk@58859 602fd350-edb4-49c9-b593-d223f7449a82
Trac ticket: Core-61646
Previously, the html5lib tests have only run in the fragment parser mode, but in #6977 a full parser was introduced to the HTML API. In this patch, the html5lib tests are running in the full parser mode where applicable.
#7146 is merged here and should be landed first.
This vastly increases the tests that are used from HTML5lib-tests from 609 to 1498! It's helped to discover two issues: