close

Make WordPress Core

Changeset 61885


Ignore:
Timestamp:
03/10/2026 12:41:33 PM (3 days ago)
Author:
johnbillion
Message:

Interactivity API: Skip binding event handler attributes. The corresponding data-wp-on-- attribute should be used instead.

Props luisherranz, peterwilsoncc, johnbillion, ocean90, jorbin, xknown.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/interactivity-api/class-wp-interactivity-api.php

    r61659 r61885  
    10281028                if ( empty( $entry['suffix'] ) || null !== $entry['unique_id'] ) {
    10291029                        return;
     1030                }
     1031
     1032                // Skip if the suffix is an event handler.
     1033                if ( str_starts_with( $entry['suffix'], 'on' ) ) {
     1034                    _doing_it_wrong(
     1035                        __METHOD__,
     1036                        sprintf(
     1037                            /* translators: %s: The directive, e.g. data-wp-on--click. */
     1038                            __( 'Binding event handler attributes is not supported. Please use "%s" instead.' ),
     1039                            esc_attr( 'data-wp-on--' . substr( $entry['suffix'], 2 ) )
     1040                        ),
     1041                        '6.9.2'
     1042                    );
     1043                    continue;
    10301044                }
    10311045
Note: See TracChangeset for help on using the changeset viewer.