Omit element node index in XPaths up to children of BODY#1790
Omit element node index in XPaths up to children of BODY#1790westonruter merged 6 commits intotrunkfrom
BODY#1790Conversation
d7d0ae8 to
e840bdd
Compare
| foreach ( $this->get_indexed_breadcrumbs() as $i => list( $tag_name, $index ) ) { | ||
| if ( $i < 2 || ( 2 === $i && '/HTML/BODY' === $this->current_xpath ) ) { | ||
| $this->current_xpath .= "/$tag_name"; | ||
| } else { | ||
| $this->current_xpath .= sprintf( '/*[%d][self::%s]', $index + 1, $tag_name ); | ||
| } |
There was a problem hiding this comment.
All of the changes in this PR are a consequence of this change here.
|
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 If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## trunk #1790 +/- ##
==========================================
- Coverage 57.43% 57.38% -0.05%
==========================================
Files 84 84
Lines 6508 6517 +9
==========================================
+ Hits 3738 3740 +2
- Misses 2770 2777 +7
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
felixarntz
left a comment
There was a problem hiding this comment.
@westonruter Overall looks good to me, just one thought.
felixarntz
left a comment
There was a problem hiding this comment.
@westonruter Approving, pending your code suggestion to expand the comment.
BODY
Summary
This is the last PR to address #1787.
Instead of an XPath like:
This PR now results in the first three levels of XPaths for elements in the body to not have the node index specified:
This will allow for variation in the content printed at
wp_body_openfrom impacting the XPaths for the rest of the document.Note that nodes inside the
HEADwill retain node indexes since there is no singular wrapper element inHEAD.The changes located in
testsdirectories are almost all attributable to a simple search-and-replace.Fixes #1787.