Skip to content

Interactivity API: Remove directive bind directives during server processing - #15501

Open
sirreal wants to merge 3 commits into
WordPress:trunkfrom
sirreal:interactivity-api/remove-directive-bind-directives
Open

sirreal wants to merge 3 commits into
WordPress:trunkfrom
sirreal:interactivity-api/remove-directive-bind-directives

Conversation

@sirreal

@sirreal sirreal commented Nov 5, 2026 •

Copy link
Copy Markdown
Member

Remove directive bind directives, data-wp-bind--data-wp-*, during server processing. A binding cannot set, another Interactivity API directive attribute, so the server now removes such bindings instead of evaluating them.

This is a follow-up to r65228, which gave event handler bindings the same treatment.

Trac ticket: https://core.trac.wordpress.org/ticket/66452

Use of AI Tools

AI assistance: Yes
Tools: Claude Code
Models: Claude Fable 5.1


This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.

…cessing.

Server processing now removes `data-wp-bind--data-wp-*` directives from output and reports incorrect usage. A binding must not set, replace or remove another Interactivity API directive attribute. The check runs on the attribute name before the suffix and unique ID checks, so bindings with a unique ID are removed as well.

Follows r65228, which gave event handler bindings the same treatment.

See #66452.
@github-actions

github-actions Bot commented Nov 5, 2026

Copy link
Copy Markdown

Test using WordPress Playground

The changes in this pull request can previewed and tested using a WordPress Playground instance.

WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser.

Some things to be aware of

  • All changes will be lost when closing a tab with a Playground instance.
  • All changes will be lost when refreshing the page.
  • A fresh instance is created each time the link below is clicked.
  • Every time this pull request is updated, a new ZIP file containing all changes is created. If changes are not reflected in the Playground instance,
    it's possible that the most recent build failed, or has not completed. Check the list of workflow runs to be sure.

For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation.

Test this pull request with WordPress Playground.

@sirreal
sirreal marked this pull request as ready for review November 5, 2026 10:00
@sirreal
sirreal requested a review from luisherranz November 5, 2026 10:00
@github-actions

github-actions Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs.

Core Committers: Use this line as a base for the props when committing in SVN:

Props jonsurrell.

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.


Props Bot commands

You can trigger Props Bot actions by commenting on this PR:

  • @propsbot add <username> to give props to a GitHub or WordPress.org user. Requires write access.
  • @propsbot remove <username> to leave a user out of the props. Requires write access.
  • @propsbot refresh to refresh this list. Adding the props-bot label works too.

@peterwilsoncc peterwilsoncc left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A note inline about naming conventions in tests. Happy with the src changes.

*
* @return array<non-empty-string, array{ attribute: non-empty-string }> Data provider.
*/
public static function data_directive_bindings(): array {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
public static function data_directive_bindings(): array {
public static function data_wp_bind_removes_directive_bindings(): array {

Per handbook, single use data providers ought to be named for the their test with a modified prefix.

🔢 This will require a change in the docblock too.

  1. Also, the data provider ought to sit immediately below the test, rather than above. This will look a bit messy as an inline suggestion, so I'll leave it for you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants