[wp-trac] [WordPress Trac] #46886: wp_targeted_link_rel adds the rel attribute when the link has data-target=""
WordPress Trac
noreply at wordpress.org
Sat Apr 13 13:58:32 UTC 2019
#46886: wp_targeted_link_rel adds the rel attribute when the link has data-
target=""
----------------------------+------------------------------
Reporter: jakeparis | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Formatting | Version: 5.1
Severity: normal | Resolution:
Keywords: has-unit-tests | Focuses:
----------------------------+------------------------------
Comment (by birgire):
I noticed a shortcoming in [attachment:"46886-2.diff"] that the pre-check
of {{{' target'}}} will not pick up tabs and other non-space whitespaces
in front of the {{{target}}} attribute.
The current pre-check of {{{'<a '}}} has similar shortcomings, as it only
assumes a space after the {{{<a}}} part.
A workaround for that could be to precheck {{{'target'}}} and {{{'<a'}}}
and capture the first whitespace group with:
{{{
|<a(\s+)((?:[^>]*?\s+)?target\s*=[^>]*)>|i
}}}
and adjust the regex callback accordingly.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/46886#comment:6>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list