Make WordPress Core

Changeset 61896


Ignore:
Timestamp:
03/10/2026 02:01:02 PM (6 months ago)
Author:
audrasjb
Message:

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.

Location:
branches/6.9
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/6.9

  • branches/6.9/src/wp-includes/interactivity-api/class-wp-interactivity-api.php

    r61197 r61896  
    10311031                                if ( empty( $entry['suffix'] ) || null !== $entry['unique_id'] ) {
    10321032                                                return;
     1033                                }
     1034
     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;
    10331047                                }
    10341048
Note: See TracChangeset for help on using the changeset viewer.