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>
}}}

Reviewed by cbravobernal.
Merges [59398] to the 6.7 branch.

Props jonsurrell, luisherranz.
Fixes #62374.

Built from https://develop.svn.wordpress.org/branches/6.7@59404


git-svn-id: http://core.svn.wordpress.org/branches/6.7@58790 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
cbravobernal 2024-11-14 11:55:18 +00:00
parent 7d29e45bbe
commit 664c3049d1
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 ) ) {
$current = $current->$path_segment;
} else {
return null;
$current = null;
break;
}
if ( $current instanceof Closure ) {

View File

@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '6.7.1-alpha-59401';
$wp_version = '6.7.1-alpha-59404';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.