Is there a way of receiving all elements which have a oncontextmenu event assigned for dijit.Menu? Or is there any event when an new dijit.Menu is assinged to a HTML element?
I think this will work:
var contextMap = {}
dojo.provide('menu');
dojo.declare('menu', [dijit.Menu] , {
bindDomNode : function(a,b,c){
this.inherited(arguments);
contextMap[a] = this;
console.log(contextMap)
}
})
Updated Solution by powtac:
This works! I run this before the menus are instantiated. The trick is to use the same superClass as className, in this case 'dijit.Menu'
as string.
dojo.ready(function() {
dojo.declare('dijit.Menu', [dijit.Menu], {
bindDomNode: function(a,b,c) {
this.inherited(arguments);
console.log(a);
},
})
})
// ...
menu = new dijit.Menu( ... ); // when called the the event is caught
// and runs into the console.log(a);