Make WordPress Core

Changeset 55121


Ignore:
Timestamp:
01/24/2023 08:09:21 AM (2 years ago)
Author:
audrasjb
Message:

Themes: Support additional link related pseudo classes in theme.json.

This changeset adds support for :link and :any-link in theme.json, using the VALID_ELEMENT_PSEUDO_SELECTORS array. :link can be used to style unvisited links and :any-link can be used to style any link containing an href attribute.

Props peterwilsoncc, whaze, audrasjb, costdev, mukesh27.
Fixes #57053.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-theme-json.php

    r55009 r55121  
    409409     * Defines which pseudo selectors are enabled for which elements.
    410410     *
    411      * The order of the selectors should be: visited, hover, focus, active.
    412      * This is to ensure that 'visited' has the lowest specificity
    413      * and the other selectors can always overwrite it.
     411     * The order of the selectors should be: link, any-link, visited, hover, focus, active.
     412     * This is to ensure the user action (hover, focus and active) styles have a higher
     413     * specificity than the visited styles, which in turn have a higher specificity than
     414     * the unvisited styles.
    414415     *
    415416     * See https://core.trac.wordpress.org/ticket/56928.
     
    417418     *
    418419     * @since 6.1.0
     420     * @since 6.2.0 Added support for ':link' and ':any-link'.
    419421     */
    420422    const VALID_ELEMENT_PSEUDO_SELECTORS = array(
    421         'link'   => array( ':visited', ':hover', ':focus', ':active' ),
    422         'button' => array( ':visited', ':hover', ':focus', ':active' ),
     423        'link'   => array( ':link', ':any-link', ':visited', ':hover', ':focus', ':active' ),
     424        'button' => array( ':link', ':any-link', ':visited', ':hover', ':focus', ':active' ),
    423425    );
    424426
Note: See TracChangeset for help on using the changeset viewer.