[wp-trac] [WordPress Trac] #62426: Interactivity API directives support invalid data attribute characters on the server
WordPress Trac
noreply at wordpress.org
Thu Nov 14 14:32:57 UTC 2024
#62426: Interactivity API directives support invalid data attribute characters on
the server
-------------------------------+-----------------------------
Reporter: jonsurrell | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Interactivity API | Version: 6.5
Severity: normal | Keywords:
Focuses: |
-------------------------------+-----------------------------
The Interactivity API client filters directive data attributes to ignore
invalid data attributes. The server does not.
This leads to a situation where the server processes directives that the
client does not, when the two implementation should agree.
For example:
{{{
<style>
.be\[red\] {background-color: red;}
.b { border: 3px dotted black;}
</style>
<div data-wp-interactive="example" data-wp-context='{"a":true}'>
<div data-wp-class--be[red]="context.a">Demo Div</div>
</div>
<button data-wp-on--click="toggleCtxA">toggle ctx a</button>
}}}
This produces a red div on the server. The client does not recognize the
`data-wp-class--be[red]` directive. Clicking the button toggles the
context (adding and removing a border) but the class triggering the red
background is ignored by the client and cannot be toggled.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/62426>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list