From 0939d89ded150c975fbd504aebbc13d384e25806 Mon Sep 17 00:00:00 2001 From: audrasjb Date: Tue, 24 Jan 2023 08:11:15 +0000 Subject: [PATCH] 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. Built from https://develop.svn.wordpress.org/trunk@55121 git-svn-id: http://core.svn.wordpress.org/trunk@54654 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/class-wp-theme-json.php | 12 +++++++----- wp-includes/version.php | 2 +- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/wp-includes/class-wp-theme-json.php b/wp-includes/class-wp-theme-json.php index f9e8e371c5..af63f4bb0d 100644 --- a/wp-includes/class-wp-theme-json.php +++ b/wp-includes/class-wp-theme-json.php @@ -408,18 +408,20 @@ class WP_Theme_JSON { /** * Defines which pseudo selectors are enabled for which elements. * - * The order of the selectors should be: visited, hover, focus, active. - * This is to ensure that 'visited' has the lowest specificity - * and the other selectors can always overwrite it. + * The order of the selectors should be: link, any-link, visited, hover, focus, active. + * This is to ensure the user action (hover, focus and active) styles have a higher + * specificity than the visited styles, which in turn have a higher specificity than + * the unvisited styles. * * See https://core.trac.wordpress.org/ticket/56928. * Note: this will affect both top-level and block-level elements. * * @since 6.1.0 + * @since 6.2.0 Added support for ':link' and ':any-link'. */ const VALID_ELEMENT_PSEUDO_SELECTORS = array( - 'link' => array( ':visited', ':hover', ':focus', ':active' ), - 'button' => array( ':visited', ':hover', ':focus', ':active' ), + 'link' => array( ':link', ':any-link', ':visited', ':hover', ':focus', ':active' ), + 'button' => array( ':link', ':any-link', ':visited', ':hover', ':focus', ':active' ), ); /** diff --git a/wp-includes/version.php b/wp-includes/version.php index 15f9220c39..09b7959ae0 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.2-alpha-55120'; +$wp_version = '6.2-alpha-55121'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.