mirror of
https://github.com/WordPress/WordPress.git
synced 2025-02-06 15:41:35 +01:00
Interactivity API: Do not process directives when there aren't any.
Short-circuits directive processing when the markup does not actually contain any `data-wp-*` attributes. This reduces function calls and memory usage for the best case scenario due to not involving `WP_HTML_Tag_Processor`. Reviewed by gziolo, swissspidy. Merges [57824] to the to the 6.5 branch. Props joemcgill, swissspidy, gziolo, cbravobernal, flixos90. Fixes #60749. Built from https://develop.svn.wordpress.org/branches/6.5@57825 git-svn-id: http://core.svn.wordpress.org/branches/6.5@57326 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
100e435853
commit
412b7647c4
@ -204,6 +204,10 @@ final class WP_Interactivity_API {
|
|||||||
* @return string The processed HTML content. It returns the original content when the HTML contains unbalanced tags.
|
* @return string The processed HTML content. It returns the original content when the HTML contains unbalanced tags.
|
||||||
*/
|
*/
|
||||||
public function process_directives( string $html ): string {
|
public function process_directives( string $html ): string {
|
||||||
|
if ( ! str_contains( $html, 'data-wp-' ) ) {
|
||||||
|
return $html;
|
||||||
|
}
|
||||||
|
|
||||||
$context_stack = array();
|
$context_stack = array();
|
||||||
$namespace_stack = array();
|
$namespace_stack = array();
|
||||||
$result = $this->process_directives_args( $html, $context_stack, $namespace_stack );
|
$result = $this->process_directives_args( $html, $context_stack, $namespace_stack );
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '6.5-RC2-57823';
|
$wp_version = '6.5-RC2-57825';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
Loading…
Reference in New Issue
Block a user