Make WordPress Core

Changes between Initial Version and Version 1 of Ticket #47514, comment 4


Ignore:
Timestamp:
09/22/2024 05:58:57 AM (20 months ago)
Author:
dmsnell
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #47514, comment 4

    initial v1  
    2222We can see from the invalid behaviors that a link is generated with the wrong URL. It's "invalid" to open a new `A` when one is already open, but the result is that it automatically closes any previously-open `A` elements.
    2323
    24 It seems like the real culprit is `make_clickable()`, which isn't aware of when it's already inside a link. `wpautop()` doesn't help (it's what creates the invalid HTML in your examples), but maybe this would help if we simply prevented `make_clickable()` from creating a link _from_ existing link content. It //tries// to do this, but in the same naive way it tries to parse HTML.
     24[[Image(https://cldup.com/qZC2M44t2X.png)]]
     25
     26It seems like the real culprit is `make_clickable()`, which isn't aware of when it's already inside a link. `wpautop()` doesn't help (it's what creates the invalid HTML in your examples and what cuts the existing `A` element in two), but maybe this would help if we simply prevented `make_clickable()` from creating a link _from_ existing link content. It //tries// to do this, but in the same naive way it tries to parse HTML.
    2527
    2628I was exploring code impacted by a refactor in `force_balance_tags()` to use the HTML API, but in this case we need to address several of these functions. I believe that the performance issues will be addressed though, because the HTML API was built for cases like these.