CtxMenu-Javascript
CtxMenu-Javascript copied to clipboard
SVG images cause error
It looks like the _ctxMenusHas function needs tweaked to accommodate SVG images returning something besides the class names. Here's what I tried to fix the issue.
if (element.className != undefined && element.hasAttribute("class")){ //Added this second condition
//const classNames = element.className.split(" "); //Original that seemed to be broken with SVGs
const classNames = element.getAttribute("class").split(" ");
for(var i = 0; i < classNames.length; i++) {
if(this._ctxMenus.has("."+classNames[i])){
return this._ctxMenus.get("."+classNames[i]);
}
}
}