#60746 closed defect (bug) (fixed)
Interactivity API - Directives in tags with closing tag that is not visit by the tag processor don't work
Reported by: | santosguillamot | Owned by: | dmsnell |
---|---|---|---|
Milestone: | 6.6 | Priority: | normal |
Severity: | normal | Version: | |
Component: | General | Keywords: | has-patch has-unit-tests |
Focuses: | Cc: |
Description
Right now, if I add directives to tags with closing tag that is not visited by the tag processor, it breaks the whole server-side rendering processing.
This is the list of those tags: https://github.com/WordPress/wordpress-develop/blob/186eeafb6888431fdf445b2abf2036f0606edcd5/src/wp-includes/interactivity-api/class-wp-interactivity-api-directives-processor.php#L25-L34
For example, if I try to add a directive to an iframe, it breaks the processing.
Co-authored by @cbravobernal
Change History (11)
This ticket was mentioned in PR #6247 on WordPress/wordpress-develop by @santosguillamot.
7 months ago
#2
- Keywords has-patch has-unit-tests added
@swissspidy commented on PR #6247:
7 months ago
#3
cc for review: @luisherranz, maybe @westonruter too
7 months ago
#4
please ignore my last comment: I finally reproduced this and I think I can say that it's fixed already in #6120, which is supposed to go in to 6.5 anyway, and this gives it even more reason to do so.
what's happening?
once the attribute was updated and next_tag()
is called, the Tag Processor applies the changes and then re-parses content. it wasn't doing that properly once it started scanning all tokens, because it was short-circuiting some logic to avoid sub-class methods from being called (e.g. you don't want WP_HTML_Processor::next_token()
to be called and then mess with the HTML stack of open elements).
unfortunately this short-circuit was programmed with the old assumption that everything is a tag, and we missed updating it earlier in the cycle for all tokens, including the handling of special tokens.
in #6120 the Tag Processor creates its own internal base_class_next_token()
that it calls so that all of the logic is repeated after applying updates and seeking. this resolves the issue here because it then is able to trap the start and end of the iframe
tag as one token.
7 months ago
#5
This branch, without the proposed fix, but with the deferred updates PR passes the tests.
https://github.com/WordPress/wordpress-develop/pull/6250
@santosguillamot commented on PR #6247:
7 months ago
#6
Thanks a lot for taking a deeper look at it, @dmsnell ☺️
I've rebased trunk
and reverted the proposed fix and I can confirm that the test passes now. I'll leave this pull request only with the new test to ensure it keeps working as expected in the future.
#7
@
7 months ago
- Owner set to dmsnell
- Resolution set to fixed
- Status changed from new to closed
In 57822:
#9
@
7 months ago
This ticket is fixed in trunk but not 6.5. Should the ticket be reopened for backport or milestoned in 6.6?
Could you clarify @dmsnell ? Thanks!
Trac ticket: https://core.trac.wordpress.org/ticket/60746
Right now, if I add directives to tags with closing tag that is not visited by the tag processor, it breaks the whole server-side rendering processing.
This is the list of those tags: https://github.com/WordPress/wordpress-develop/blob/186eeafb6888431fdf445b2abf2036f0606edcd5/src/wp-includes/interactivity-api/class-wp-interactivity-api-directives-processor.php#L25-L34
For example, if I try to add a directive to an iframe, it breaks the processing.
Co-authored by @cbravobernal