jakiestfu/Context.js — pull request #1 by rovolution (2013-09-27 19:56:53+00:00)
Title: removing destroyed context menu's from the DOM

hey jakiestfu,

Thanks for this awesome plugin btw! Hands down the best bootstrap context menu plugin I've worked with.

This pull request is to fix an issue I had with it in one of the applications I am working on.

In my use case, I have a graph consisting of nodes and edges, where each node has its own context menu. A user is constantly loading different graphs, which requires the frequent removal/addition of nodes.

I noticed that whenever I destroyed a context menu on a node, it was not actually removing it from the DOM. Consequently my DOM would become populated with these 'ghost' context menus. This fix removes the context menu from the DOM when the destroy call is made.

Let me know what you think and if I should change anything.

Thanks!