mirror of
https://github.com/WordPress/WordPress.git
synced 2026-06-19 07:37:07 +00:00
Toolbar: Improvements to changes in [62282].
This updates the JavaScript based regular expression to be case-insensitive, which matches the corresponding PHP pattern. A defensive check has alos been added to avoid a `TypeError` if the admin bar is manipulated in a way that changes the path of the targeted element. Follow up to [62282]. Props westonruter. Fixes #65121. Built from https://develop.svn.wordpress.org/trunk@62320 git-svn-id: http://core.svn.wordpress.org/trunk@61600 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
@@ -971,8 +971,12 @@ function wp_admin_bar_command_palette_menu( WP_Admin_Bar $wp_admin_bar ): void {
|
||||
*/
|
||||
$function = <<<'JS'
|
||||
( applePattern, appleOSLabel ) => {
|
||||
if ( ( new RegExp( applePattern ) ).test( navigator.userAgent ) ) {
|
||||
document.querySelector( '#wp-admin-bar-command-palette .ab-label kbd' ).textContent = appleOSLabel;
|
||||
if ( ! ( new RegExp( applePattern, 'i' ) ).test( navigator.userAgent ) ) {
|
||||
return;
|
||||
}
|
||||
const kbd = document.querySelector( '#wp-admin-bar-command-palette .ab-label kbd' );
|
||||
if ( kbd ) {
|
||||
kbd.textContent = appleOSLabel;
|
||||
}
|
||||
}
|
||||
JS;
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '7.1-alpha-62317';
|
||||
$wp_version = '7.1-alpha-62320';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
||||
Reference in New Issue
Block a user