Skip to content

Commit 5065bee

Browse files
committed
Update comment on HTML Processor and test for seeking.
1 parent 54d644f commit 5065bee

2 files changed

Lines changed: 11 additions & 2 deletions

File tree

src/wp-includes/html-api/class-wp-html-processor.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,12 @@ public function next_tag( $query = null ) {
416416
/**
417417
* Steps through the HTML document and stop at the next token, if any.
418418
*
419-
* Currently only supports stepping through tags.
419+
* Currently only supports stepping through tags; do not use until this
420+
* supports visiting text nodes. This is necessary for now to ensure that
421+
* the Tag Processor doesn't bypass the HTML semantic rules in this class
422+
* when seeking to a bookmark.
423+
*
424+
* @access private
420425
*
421426
* @return bool
422427
*/

tests/phpunit/tests/html-api/wpHtmlProcessorBreadcrumbs.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,11 @@ public function test_can_query_an_element_by_tag_name() {
515515
* @covers WP_HTML_Processor::seek
516516
*/
517517
public function test_can_seek_back_and_forth() {
518-
$p = WP_HTML_Processor::create_fragment( '<div><p one><div><p><div two><p><div><p><div><p three>' );
518+
$p = WP_HTML_Processor::create_fragment(
519+
<<<'HTML'
520+
<div>text<p one>more stuff<div><![CDATA[this is not real CDATA]]><p><!-- hi --><div two><p><div><p>three comes soon<div><p three>' );
521+
HTML
522+
);
519523

520524
// Find first tag of interest.
521525
while ( $p->next_tag() && null === $p->get_attribute( 'one' ) ) {

0 commit comments

Comments
 (0)