HTML API: Close all elements at the end of a document.#7085
HTML API: Close all elements at the end of a document.#7085dmsnell wants to merge 4 commits intoWordPress:trunkfrom
Conversation
When the model of breadcrumb generation in the HTML Processor and node traversal was simplified, the change introduced a bug whereby unclosed nodes at the end of a document would remain unvisited and unclosed. In this patch, a fix is applied to ensure that all open elements close while traversing a document. A couple of minor documentation typos are fixed in the patch as well. Follow-up to [58713]. See #61576.
Trac Ticket MissingThis pull request is missing a link to a Trac ticket. For a contribution to be considered, there must be a corresponding ticket in Trac. To attach a pull request to a Trac ticket, please include the ticket's full URL in your pull request description. More information about contributing to WordPress on GitHub can be found in the Core Handbook. |
|
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. |
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. |
|
It would be helpful to add test coverage for this case. Something simple and similar to the existing tests here: |
Your wish is my command! @gziolo I confirmed that the new test fails in |
| while ( $this->state->stack_of_open_elements->pop() ) { | ||
| continue; | ||
| } |
There was a problem hiding this comment.
Minor, but something I've wondered about. the continue doesn't do anything here. Is there a reason to include it?
| while ( $this->state->stack_of_open_elements->pop() ) { | |
| continue; | |
| } | |
| while ( $this->state->stack_of_open_elements->pop() ) {} |
There was a problem hiding this comment.
I think you would have to put a code comment inside to document the intent otherwise.
There was a problem hiding this comment.
originally I had a comment inside these loops but WPCS thought it was bad so required the introduction of continue, which surprisingly, introduces actual executable code and slows down the runtime
There was a problem hiding this comment.
How strict WPCS is for while ( $this->state->stack_of_open_elements->pop() ) {} in a single line?
There was a problem hiding this comment.
hmm. I might not have tried that, but I'm personally not a fan because of unexplained empty body. we can prep a PR and see if it complains. do you consider that better?
There was a problem hiding this comment.
It was only thought exercise as it might go against a linting rule if the new line after an opening curly bracket is enforced.
There was a problem hiding this comment.
All good with the code that landed 👍
When the model of breadcrumb generation in the HTML Processor and node traversal was simplified, the change introduced a bug whereby unclosed nodes at the end of a document would remain unvisited and unclosed. In this patch, a fix is applied to ensure that all open elements close while traversing a document. A couple of minor documentation typos are fixed in the patch as well. Developed in #7085 Discussed in https://core.trac.wordpress.org/ticket/61576 Follow-up to [58713]. Props: dmsnell, gziolo, jonsurrell. See #61576. git-svn-id: https://develop.svn.wordpress.org/trunk@58828 602fd350-edb4-49c9-b593-d223f7449a82
When the model of breadcrumb generation in the HTML Processor and node traversal was simplified, the change introduced a bug whereby unclosed nodes at the end of a document would remain unvisited and unclosed. In this patch, a fix is applied to ensure that all open elements close while traversing a document. A couple of minor documentation typos are fixed in the patch as well. Developed in WordPress/wordpress-develop#7085 Discussed in https://core.trac.wordpress.org/ticket/61576 Follow-up to [58713]. Props: dmsnell, gziolo, jonsurrell. See #61576. Built from https://develop.svn.wordpress.org/trunk@58828 git-svn-id: http://core.svn.wordpress.org/trunk@58224 1a063a9b-81f0-0310-95a4-ce76da25c4cd
When the model of breadcrumb generation in the HTML Processor and node traversal was simplified, the change introduced a bug whereby unclosed nodes at the end of a document would remain unvisited and unclosed. In this patch, a fix is applied to ensure that all open elements close while traversing a document. A couple of minor documentation typos are fixed in the patch as well. Developed in WordPress/wordpress-develop#7085 Discussed in https://core.trac.wordpress.org/ticket/61576 Follow-up to [58713]. Props: dmsnell, gziolo, jonsurrell. See #61576. Built from https://develop.svn.wordpress.org/trunk@58828 git-svn-id: https://core.svn.wordpress.org/trunk@58224 1a063a9b-81f0-0310-95a4-ce76da25c4cd
When the model of breadcrumb generation in the HTML Processor and node traversal was simplified, the change introduced a bug whereby unclosed nodes at the end of a document would remain unvisited and unclosed. In this patch, a fix is applied to ensure that all open elements close while traversing a document. A couple of minor documentation typos are fixed in the patch as well. Developed in WordPress#7085 Discussed in https://core.trac.wordpress.org/ticket/61576 Follow-up to [58713]. Props: dmsnell, gziolo, jonsurrell. See #61576. git-svn-id: https://develop.svn.wordpress.org/trunk@58828 602fd350-edb4-49c9-b593-d223f7449a82
Trac ticket: Core-61576
When the model of breadcrumb generation in the HTML Processor and node traversal was simplified, the change introduced a bug whereby unclosed nodes at the end of a document would remain unvisited and unclosed.
In this patch, a fix is applied to ensure that all open elements close while traversing a document. A couple of minor documentation typos are fixed in the patch as well.
Follow-up to [58713].
See #61576.