mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-12 06:20:06 +00:00
HTML API: Fix a case where updates are overlooked when seeking to earlier locations.
This retains the WP_HTML_Tag_Processor attribute updates applied before calling seek() – they were erroneously erased in some cases. Props dmsnell. Fixes #58160. git-svn-id: https://develop.svn.wordpress.org/trunk@55675 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -456,6 +456,26 @@ class Tests_HtmlApi_wpHtmlTagProcessor extends WP_UnitTestCase {
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensures that when seeking to an earlier spot in the document that
|
||||
* all previously-enqueued updates are applied as they ought to be.
|
||||
*
|
||||
* @ticket 58160
|
||||
*/
|
||||
public function test_get_updated_html_applies_updates_to_content_after_seeking_to_before_parsed_bytes() {
|
||||
$p = new WP_HTML_Tag_Processor( '<div><img hidden></div>' );
|
||||
|
||||
$p->next_tag();
|
||||
$p->set_attribute( 'wonky', true );
|
||||
$p->next_tag();
|
||||
$p->set_bookmark( 'here' );
|
||||
|
||||
$p->next_tag( array( 'tag_closers' => 'visit' ) );
|
||||
$p->seek( 'here' );
|
||||
|
||||
$this->assertSame( '<div wonky><img hidden></div>', $p->get_updated_html() );
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 56299
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user