Interactivity API: Allow missing state negation on server

Aligns on the behavior of the negation operator with directives to missing paths in client and in server.

With a directive like the following:
{{{
<div data-wp-bind--hidden="!state.missing.property">
	This should be hidden by the <code>hidden</code> attribute.
</div>
}}}

Both server and client will return with this fix:
{{{
<div data-wp-bind--hidden="!state.missing.property" hidden="">
	This should be hidden by the <code>hidden</code> attribute.
</div>
}}}

Props jonsurrell, luisherranz.
Fixes #62374.


Built from https://develop.svn.wordpress.org/trunk@59398


git-svn-id: http://core.svn.wordpress.org/trunk@58784 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
cbravobernal 2024-11-13 11:19:18 +00:00
parent 3ba197a255
commit 9a99674204
2 changed files with 3 additions and 2 deletions

View File

@ -584,7 +584,8 @@ final class WP_Interactivity_API {
} elseif ( is_object( $current ) && isset( $current->$path_segment ) ) { } elseif ( is_object( $current ) && isset( $current->$path_segment ) ) {
$current = $current->$path_segment; $current = $current->$path_segment;
} else { } else {
return null; $current = null;
break;
} }
if ( $current instanceof Closure ) { if ( $current instanceof Closure ) {

View File

@ -16,7 +16,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '6.8-alpha-59397'; $wp_version = '6.8-alpha-59398';
/** /**
* 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.