Skip to content

Commit 8e5624d

Browse files
committed
Interactivity API: Skip binding event handler attributes. The corresponding data-wp-on-- attribute should be used instead.
Merges [61885] to the 6.9 branch. Props luisherranz, peterwilsoncc, johnbillion, ocean90, jorbin, xknown. git-svn-id: https://develop.svn.wordpress.org/branches/6.9@61896 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 4127661 commit 8e5624d

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

src/wp-includes/interactivity-api/class-wp-interactivity-api.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1032,6 +1032,20 @@ private function data_wp_bind_processor( WP_Interactivity_API_Directives_Process
10321032
return;
10331033
}
10341034

1035+
// Skip if the suffix is an event handler.
1036+
if ( str_starts_with( $entry['suffix'], 'on' ) ) {
1037+
_doing_it_wrong(
1038+
__METHOD__,
1039+
sprintf(
1040+
/* translators: %s: The directive, e.g. data-wp-on--click. */
1041+
__( 'Binding event handler attributes is not supported. Please use "%s" instead.' ),
1042+
esc_attr( 'data-wp-on--' . substr( $entry['suffix'], 2 ) )
1043+
),
1044+
'6.9.2'
1045+
);
1046+
continue;
1047+
}
1048+
10351049
$result = $this->evaluate( $entry );
10361050

10371051
if (

0 commit comments

Comments
 (0)