theyak / contextmenu

A very basic JavaScript implementation of a context menu

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Issue if the container has HTML

giosifelis opened this issue · comments

If the container that I am attaching the menu has HTML, it doesn't work (it works only with plain text) because there are more elements a e.target does not have the selector

to fix this i made the following changes

  1. at the top of the script declare a
    var theMenu;
  2. On ContectMenu.attach after the for loop (line 532) i added:
    theMenu = selector;
  3. On onContextMenu change
    target = e.target to target = theMenu;

if you like the changes feel free to adapt them