swisnl / jQuery-contextMenu

jQuery contextMenu plugin & polyfill
https://swisnl.github.io/jQuery-contextMenu/
MIT License
2.25k stars 744 forks source link

Bug in dataAttr? #712

Open sophanox opened 4 years ago

sophanox commented 4 years ago

I believe this bit of code:

                if(opt.dataAttr){
                    $.each(opt.dataAttr, function (key, item) {
                        opt.$menu.attr('data-' + opt.key, item);
                    });
                }

Should in fact be:

                if(opt.dataAttr){
                    $.each(opt.dataAttr, function (key, item) {
                        opt.$menu.attr('data-' + key, item);
                    });
                }

I.e., it should reference the key in the loop not the (non-existent) key property of opt? This at least makes it work for me

Cheers

bbrala commented 4 years ago

You are right, thanks!