At https://github.com/medialize/jQuery-contextMenu/blob/master/src/jquery.contextMenu.js#L47 you are trying to guess when you should override original $.cleanData like jQuery UI does.
But at least with jQuery UI 1.10.X check if (!$.ui || !$.ui.widget) does not work - there is no $.ui.widget, only $.widget at https://github.com/jquery/jquery-ui/blob/master/ui/jquery.ui.widget.js#L28.
As a result, with jQuery UI 1.10 I have 3 implementations of $.cleanData:
- From jQuery (original)
- From jQuery UI
- From contextMenu, the same as in 2.
This has some performance impact when deleting/replacing large DOM subtrees.