Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTML API: Refactor wp_targeted_link_rel #5590

Draft
wants to merge 3 commits into
base: trunk
Choose a base branch
from

Conversation

dmsnell
Copy link
Contributor

@dmsnell dmsnell commented Oct 30, 2023

See #5143

  • Propose a kind of assertEqualMarkup on WP_UnitTestCase
  • Update all the tests
  • Talk about back-compat issue with filter.

This patch refactors wp_targeted_link_rel to be more reliable and clear by using the HTML API to replace existing PCRE code. It provides backwards compatability for the rel filter by creating a quick HTML string representing the opening A tag for the matched element and providing the href, rel, and target attributes on that tag.

@dmsnell dmsnell force-pushed the html-api/refactor-wp-targeted-link-rel-fake-html branch 2 times, most recently from 1c67c99 to e7a8457 Compare October 30, 2023 12:37
See WordPress#5143

This patch refactors `wp_targeted_link_rel` to be more reliable and clear by
using the HTML API to replace existing PCRE code. It provides backwards
compatability for the `rel` filter by creating a quick HTML string representing
the opening A tag for the matched element and providing the `href`, `rel`, and
`target` attributes on that tag.
Assert equivalent markup in existing Core tests.

The Tag Processor may rearrange the attribute updates in relation to what the
old code did, but the semantic output should be same.
@dmsnell dmsnell force-pushed the html-api/refactor-wp-targeted-link-rel-fake-html branch from dc75d0e to ad96a5e Compare October 30, 2023 23:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant