From 00a9cbd77ea4cca7f6f2a9270350273823df219b Mon Sep 17 00:00:00 2001 From: luisherranz Date: Fri, 16 Jan 2026 10:02:42 +0100 Subject: [PATCH 1/4] Add failing test for data-wp-bind with empty suffix --- .../wpInteractivityAPI-wp-bind.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/phpunit/tests/interactivity-api/wpInteractivityAPI-wp-bind.php b/tests/phpunit/tests/interactivity-api/wpInteractivityAPI-wp-bind.php index cd3f17c8ae254..6b641236baf97 100644 --- a/tests/phpunit/tests/interactivity-api/wpInteractivityAPI-wp-bind.php +++ b/tests/phpunit/tests/interactivity-api/wpInteractivityAPI-wp-bind.php @@ -134,6 +134,20 @@ public function test_wp_bind_ignores_empty_bound_attribute() { $this->assertSame( $html, $new_html ); } + /** + * Tests that `data-wp-bind` ignores directives with no suffix but still + * processes valid bind directives on the same element. + * + * @ticket XXXX + * + * @covers ::process_directives + */ + public function test_wp_bind_ignores_empty_suffix_but_processes_valid_binds() { + $html = '
Text
'; + list($p) = $this->process_directives( $html ); + $this->assertSame( 'some-id', $p->get_attribute( 'id' ) ); + } + /** * Tests that `data-wp-bind` does nothing when referencing non-existent * references. From 0ff853462016a2dc1846acc00f7d15a6a15f6fb9 Mon Sep 17 00:00:00 2001 From: luisherranz Date: Fri, 16 Jan 2026 10:03:51 +0100 Subject: [PATCH 2/4] Fix data-wp-bind to continue processing valid directives --- .../interactivity-api/class-wp-interactivity-api.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wp-includes/interactivity-api/class-wp-interactivity-api.php b/src/wp-includes/interactivity-api/class-wp-interactivity-api.php index f2c66b07fcbb5..cf931108989a3 100644 --- a/src/wp-includes/interactivity-api/class-wp-interactivity-api.php +++ b/src/wp-includes/interactivity-api/class-wp-interactivity-api.php @@ -1026,7 +1026,7 @@ private function data_wp_bind_processor( WP_Interactivity_API_Directives_Process $entries = $this->get_directive_entries( $p, 'bind' ); foreach ( $entries as $entry ) { if ( empty( $entry['suffix'] ) || null !== $entry['unique_id'] ) { - return; + continue; } $result = $this->evaluate( $entry ); From 182de17112baa86dd41c4a4a456fc145d3c85748 Mon Sep 17 00:00:00 2001 From: luisherranz Date: Fri, 16 Jan 2026 10:17:15 +0100 Subject: [PATCH 3/4] Add test for data-wp-bind with unique ID and valid directive --- .../wpInteractivityAPI-wp-bind.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/phpunit/tests/interactivity-api/wpInteractivityAPI-wp-bind.php b/tests/phpunit/tests/interactivity-api/wpInteractivityAPI-wp-bind.php index 6b641236baf97..37c5049482cf8 100644 --- a/tests/phpunit/tests/interactivity-api/wpInteractivityAPI-wp-bind.php +++ b/tests/phpunit/tests/interactivity-api/wpInteractivityAPI-wp-bind.php @@ -430,4 +430,18 @@ public function test_wp_bind_ignores_unique_ids() { $this->assertNull( $p->get_attribute( 'id' ) ); $this->assertNull( $p->get_attribute( 'id---unique-id' ) ); } + + /** + * Tests that `data-wp-bind` ignores directives with unique IDs but still + * processes valid bind directives on the same element. + * + * @ticket XXXX + * + * @covers ::process_directives + */ + public function test_wp_bind_ignores_unique_id_but_processes_valid_binds() { + $html = '
Text
'; + list($p) = $this->process_directives( $html ); + $this->assertSame( 'some-id', $p->get_attribute( 'id' ) ); + } } From 685bed3b19877a7e3c7f82fc1dc7c0b14f1813f5 Mon Sep 17 00:00:00 2001 From: luisherranz Date: Fri, 16 Jan 2026 10:23:12 +0100 Subject: [PATCH 4/4] Update ticket number to 64518 --- .../tests/interactivity-api/wpInteractivityAPI-wp-bind.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/phpunit/tests/interactivity-api/wpInteractivityAPI-wp-bind.php b/tests/phpunit/tests/interactivity-api/wpInteractivityAPI-wp-bind.php index 37c5049482cf8..02fc0d09293f7 100644 --- a/tests/phpunit/tests/interactivity-api/wpInteractivityAPI-wp-bind.php +++ b/tests/phpunit/tests/interactivity-api/wpInteractivityAPI-wp-bind.php @@ -138,7 +138,7 @@ public function test_wp_bind_ignores_empty_bound_attribute() { * Tests that `data-wp-bind` ignores directives with no suffix but still * processes valid bind directives on the same element. * - * @ticket XXXX + * @ticket 64518 * * @covers ::process_directives */ @@ -435,7 +435,7 @@ public function test_wp_bind_ignores_unique_ids() { * Tests that `data-wp-bind` ignores directives with unique IDs but still * processes valid bind directives on the same element. * - * @ticket XXXX + * @ticket 64518 * * @covers ::process_directives */