Total error otimization in nav-menu.js
-
Мое количество элементов в меню ~800 элементов. Обнаружил грубую ошибку в версии начиная 6.7 версии — скрипт nav-menu.js приводит к полному зависанию страницы редактирования списка элементов меню.
В ходе решения проблемы обнаружил — 800 элементов меню перемножались и в итоге получилось 800*800=640000 элементов в node.
initAccessibility : function() {
var menu = $( '#menu-to-edit' );
api.refreshKeyboardAccessibility();
api.refreshAdvancedAccessibility();
// Refresh the accessibility when the user comes close to the item in any way.
menu.on( 'mouseenter.refreshAccessibility focus.refreshAccessibility touchstart.refreshAccessibility' , '.menu-item' , function(){
api.refreshAdvancedAccessibilityOfItem( $( this ).find( 'a.item-edit' ) );
} );
// We have to update on click as well because we might hover first, change the item, and then click.
menu.on( 'click', 'a.item-edit', function() {
api.refreshAdvancedAccessibilityOfItem( $( this ) );
} );
// Links for moving items.
menu.on( 'click', '.menus-move', function () {
var $this = $( this ),
dir = $this.data( 'dir' );
if ( 'undefined' !== typeof dir ) {
api.moveMenuItem( $( this ).parents( 'li.menu-item' ).find( 'a.item-edit' ), dir );
}
});
(далее виновный код, из-за которого все ломается)
// Set menu parents data for all menu items.
menu.updateParentDropdown();
// Set menu order data for all menu items.
menu.updateOrderDropdown();
// Update menu item parent when value is changed.
menu.on( 'change', '.edit-menu-item-parent', function() {
api.changeMenuParent( $( this ) );
});
// Update menu item order when value is changed.
menu.on( 'change', '.edit-menu-item-order', function() {
api.changeMenuOrder( $( this ) );
});
},
Просмотр 6 ответов — с 1 по 6 (всего 6)
Просмотр 6 ответов — с 1 по 6 (всего 6)
- Для ответа на тему необходимо авторизоваться.