Make WordPress Core


Ignore:
Timestamp:
11/12/2024 10:30:26 AM (15 months ago)
Author:
Bernhard Reiter
Message:

HTML API: Ensure that full processor can seek to earlier bookmarks.

When the HTML Processor seeks to an earlier place, it returns the the beginning of the document and proceeds forward until it reaches the appropriate location. This requires resetting internal state so that the processor can correctly proceed from the beginning of the document.

The seeking reset logic was not adapted to account for the full processor (i.e. when created via WP_HTML_Processor::create_full_parser()). This change updates the seek logic to account for the full and fragment parsers as well as other state that has been introduced in the interim and should be reset.

Props jonsurrell, dmsnell, westonruter, mi5t4n.
Fixes #62290.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/html-api/wpHtmlProcessor.php

    r59364 r59391  
    134134            // Create a bookmark inside of that stack.
    135135            if ( null !== $processor->get_attribute( 'two' ) ) {
    136                 $processor->set_bookmark( 'two' );
     136                $this->assertTrue( $processor->set_bookmark( 'two' ) );
    137137                break;
    138138            }
Note: See TracChangeset for help on using the changeset viewer.