Changeset 44680
- Timestamp:
- 01/21/2019 10:09:48 PM (6 years ago)
- Location:
- trunk/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/js/_enqueues/lib/nav-menu.js
r44539 r44680 836 836 } 837 837 }); 838 839 $( '#menu-name' ).on( 'input', _.debounce( function () { 840 var menuName = $( document.getElementById( 'menu-name' ) ), 841 menuNameVal = menuName.val(); 842 843 if ( ! menuNameVal || ! menuNameVal.replace( /\s+/, '' ) ) { 844 // Add warning for invalid menu name. 845 menuName.parent().addClass( 'form-invalid' ); 846 } else { 847 // Remove warning for valid menu name. 848 menuName.parent().removeClass( 'form-invalid' ); 849 } 850 }, 500 ) ); 851 838 852 $('#add-custom-links input[type="text"]').keypress(function(e){ 839 853 $('#customlinkdiv').removeClass('form-invalid'); … … 1167 1181 menuNameVal = menuName.val(); 1168 1182 // Cancel and warn if invalid menu name 1169 if ( !menuNameVal || menuNameVal == menuName.attr('title') || !menuNameVal.replace(/\s+/, '') ) {1170 menuName.parent().addClass( 'form-invalid');1183 if ( ! menuNameVal || ! menuNameVal.replace( /\s+/, '' ) ) { 1184 menuName.parent().addClass( 'form-invalid' ); 1171 1185 return false; 1172 1186 } -
trunk/src/wp-includes/script-loader.php
r44651 r44680 1780 1780 ); 1781 1781 1782 // Navigation Menus 1783 $scripts->add( 'nav-menu', "/wp-admin/js/nav-menu$suffix.js", array( 'jquery-ui-sortable', 'jquery-ui-draggable', 'jquery-ui-droppable', 'wp-lists', 'postbox', 'json2' ) ); 1782 /* 1783 * Navigation Menus: Adding underscore as a dependency to utilize _.debounce 1784 * see https://core.trac.wordpress.org/ticket/42321 1785 */ 1786 $scripts->add( 'nav-menu', "/wp-admin/js/nav-menu$suffix.js", array( 'jquery-ui-sortable', 'jquery-ui-draggable', 'jquery-ui-droppable', 'wp-lists', 'postbox', 'json2', 'underscore' ) ); 1784 1787 did_action( 'init' ) && $scripts->localize( 1785 1788 'nav-menu',
Note: See TracChangeset
for help on using the changeset viewer.