Oh dear!!!
I’ve looked for this for so long, thanks a lot. I’ve even tried to understand how WordPress’ Walker class generates its menus ids, but I just got as far as seeing that each $item has a weird ‘db_id’ property — something which I couldn’t understand, all I got of it was that it, further down, translates (is used) as $element->ID, which is really confusing since one might think that is the same as $post->ID, while it isn’t! This is really confusing when trying to get the current item’s (page, post, etc) CSS class or id’s current-menu-id since it does not match the current item’s proper ->ID variable…
Some of the things I searched for before finally getting here:
menu id number
menuid number
menu-item id number
menu-item id walker corresponding number
menu-item walker corresponding number
menu-item corresponding number
menu item corresponding number
menu item number
display_element
walk
nav-menu
nav-menu-template
start_el
current-menu-item
current-menu-item-id
current-menu-item-id-number
Maybe these will help people searching on Google and whatnot.
Cheers!