More concise use of selectors, so we only do one lookup

Co-authored-by: Dan Q <dan@danq.me>
This commit is contained in:
And Finally 2023-08-16 08:49:01 +01:00 committed by GitHub
parent 368abf3fd4
commit 732e5bd91b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 7 deletions

View File

@ -1,12 +1,8 @@
document.addEventListener( 'DOMContentLoaded', () => {
const adminMenu = document.getElementById( 'adminmenu' );
if ( ! adminMenu ) {
return;
}
const addonsSubMenuLinks = adminMenu.querySelectorAll(
'#toplevel_page_woocommerce' +
const addonsSubMenuLinks = document.querySelectorAll(
'#adminmenu' +
' #toplevel_page_woocommerce' +
' .wp-submenu' +
' li a[href="admin.php?page=wc-addons"]'
);