Skip to content

Conversation

@dmsnell
Copy link
Member

@dmsnell dmsnell commented Aug 22, 2023

This work is still at an early stage. It will change, possibly substantially, before it's ready for full review.

Description

In some situations it may be useful to process an HTML document as it's being generated. This requires the ability to add chunks of text to the end of the input HTML.

In this patch the WP_HTML_Tag_Processor::extend_input( $html ) method is providing this ability. It is designed to allow for splitting an HTML at arbitrary boundaries.

$p = WP_HTML_Processor::createFragment( '<div><p><em>This</em> is <str' );
while ( $p->next_tag() ) {
	// Process everything up to this point.
}

$p->extend_input( 'ong>incomplete.</strong></p><img></div>' );
while ( $p->next_tag() ) {
	// Continue processing with the full contents.
}

In some situations it may be useful to process an HTML document as it's being
generated. This requires the ability to add chunks of text to the end of the
input HTML.

In this patch the `WP_HTML_Tag_Processor::extend_input( $html )` method is
providing this ability. It is designed to allow for splitting an HTML at
arbitrary boundaries.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant