From 1913b4c665daaf45d454f4a740112abab14a28c8 Mon Sep 17 00:00:00 2001 From: Andrew Nacin Date: Wed, 4 Dec 2013 17:09:20 +0000 Subject: [PATCH] Nav Menus: Delegate click events for move links. props ankit.gade. fixes #25594. git-svn-id: https://develop.svn.wordpress.org/trunk@26613 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/js/nav-menu.js | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/wp-admin/js/nav-menu.js b/src/wp-admin/js/nav-menu.js index 750fd0ab23..485fcc79de 100644 --- a/src/wp-admin/js/nav-menu.js +++ b/src/wp-admin/js/nav-menu.js @@ -379,27 +379,29 @@ var wpNavMenu; }, initAccessibility : function() { + var menu = $( '#menu-to-edit' ); + api.refreshKeyboardAccessibility(); api.refreshAdvancedAccessibility(); // Events - $( '.menus-move-up' ).on( 'click', function ( e ) { + menu.on( 'click', '.menus-move-up', function ( e ) { api.moveMenuItem( $( this ).parents( 'li.menu-item' ).find( 'a.item-edit' ), 'up' ); e.preventDefault(); - }); - $( '.menus-move-down' ).on( 'click', function ( e ) { + }) + menu.on( 'click', '.menus-move-down', function ( e ) { api.moveMenuItem( $( this ).parents( 'li.menu-item' ).find( 'a.item-edit' ), 'down' ); e.preventDefault(); - }); - $( '.menus-move-top' ).on( 'click', function ( e ) { + }) + menu.on( 'click', '.menus-move-top', function ( e ) { api.moveMenuItem( $( this ).parents( 'li.menu-item' ).find( 'a.item-edit' ), 'top' ); e.preventDefault(); - }); - $( '.menus-move-left' ).on( 'click', function ( e ) { + }) + menu.on( 'click', '.menus-move-left', function ( e ) { api.moveMenuItem( $( this ).parents( 'li.menu-item' ).find( 'a.item-edit' ), 'left' ); e.preventDefault(); }); - $( '.menus-move-right' ).on( 'click', function ( e ) { + menu.on( 'click', '.menus-move-right', function ( e ) { api.moveMenuItem( $( this ).parents( 'li.menu-item' ).find( 'a.item-edit' ), 'right' ); e.preventDefault(); });