[wp-trac] [WordPress Trac] #63032: Adjust speculative loading selector exclusions to allow for classes to apply on parent element
WordPress Trac
noreply at wordpress.org
Thu Feb 27 21:21:13 UTC 2025
#63032: Adjust speculative loading selector exclusions to allow for classes to
apply on parent element
-------------------------+------------------------------------------
Reporter: flixos90 | Owner: flixos90
Type: enhancement | Status: assigned
Priority: normal | Milestone: 6.8
Component: General | Version:
Severity: normal | Keywords: needs-patch needs-unit-tests
Focuses: performance |
-------------------------+------------------------------------------
The speculative loading implementation in Core, as one of the lesser
discussed features, currently excludes any links from prerendering that
use a `no-prerender` class on them, and it excludes any links from
prefetching that use either a `no-prefetch` or a `no-prerender` class on
them.
In the current implementation, this may be beneficial for some plugins or
classic themes, but it misses out on another valuable opportunity, which
is block themes. Many blocks allow adding a custom class to the block
wrapper element itself, and this would be a perfect candidate to allow
advanced end user customization of speculative loading. But there is no UI
to add a class to a link (`a`) specifically.
While WordPress Core's philosophy is "decisions, not options", the UI to
add a class is in itself already considered advanced, so allowing it to
control this kind of exclusion would make sense.
And it's an easy win: All we need to do is to also allow the exclusion for
`.no-prefetch a` and `.no-prerender a`, instead of just `.no-prefetch` and
`.no-prerender`.
Also see the related discussion in
https://github.com/WordPress/performance/issues/1156#issuecomment-2616505930.
It includes additional classes, but those are out of scope for this ticket
as they require more discussion. This ticket is merely about "fixing" the
current exclusions to be controllable via the block class UI.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/63032>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list