From 73b0636c78448fd8a1d8179c131226734819cb12 Mon Sep 17 00:00:00 2001 From: Jerome B Date: Tue, 15 Nov 2022 17:17:23 +0100 Subject: [PATCH 1/4] Support additional link related pseudo classes in theme.json --- src/wp-includes/class-wp-theme-json.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/wp-includes/class-wp-theme-json.php b/src/wp-includes/class-wp-theme-json.php index 8f93f5cda9f05..725442c8c2074 100644 --- a/src/wp-includes/class-wp-theme-json.php +++ b/src/wp-includes/class-wp-theme-json.php @@ -404,8 +404,8 @@ class WP_Theme_JSON { * @since 6.1.0 */ 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' ), ); /** From 56b013e245995e733ab8dde551c0c36e28d1d4a1 Mon Sep 17 00:00:00 2001 From: Jb Audras Date: Thu, 17 Nov 2022 22:15:15 +0100 Subject: [PATCH 2/4] docblock update --- src/wp-includes/class-wp-theme-json.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/wp-includes/class-wp-theme-json.php b/src/wp-includes/class-wp-theme-json.php index 725442c8c2074..6a881e28dddee 100644 --- a/src/wp-includes/class-wp-theme-json.php +++ b/src/wp-includes/class-wp-theme-json.php @@ -394,14 +394,15 @@ 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 that 'visited' has the lowest specificity and the other selectors + * can always overwrite it. * * 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( ':link', ':any-link', ':visited', ':hover', ':focus', ':active' ), From 074cbfd9d018b65e70824608a6841bf69fe8ebd0 Mon Sep 17 00:00:00 2001 From: Jb Audras Date: Sun, 22 Jan 2023 11:17:56 +0100 Subject: [PATCH 3/4] Update src/wp-includes/class-wp-theme-json.php Co-authored-by: Peter Wilson <519727+peterwilsoncc@users.noreply.github.com> --- src/wp-includes/class-wp-theme-json.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/wp-includes/class-wp-theme-json.php b/src/wp-includes/class-wp-theme-json.php index 6a881e28dddee..0b6887e0f5898 100644 --- a/src/wp-includes/class-wp-theme-json.php +++ b/src/wp-includes/class-wp-theme-json.php @@ -395,8 +395,9 @@ class WP_Theme_JSON { * Defines which pseudo selectors are enabled for which elements. * * The order of the selectors should be: link, any-link, visited, hover, focus, active. - * This is to ensure that 'visited' has the lowest specificity and the other selectors - * can always overwrite it. + * 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. From 27e475cd341383bc76f2b1772decbca9276dfe46 Mon Sep 17 00:00:00 2001 From: Jb Audras Date: Sun, 22 Jan 2023 11:21:53 +0100 Subject: [PATCH 4/4] Remove unwanted whitespace --- src/wp-includes/class-wp-theme-json.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wp-includes/class-wp-theme-json.php b/src/wp-includes/class-wp-theme-json.php index 0b6887e0f5898..c1ae6d7e9c15c 100644 --- a/src/wp-includes/class-wp-theme-json.php +++ b/src/wp-includes/class-wp-theme-json.php @@ -396,7 +396,7 @@ class WP_Theme_JSON { * * 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 + * 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.