Reputation: 41050
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?
Upvotes: 0
Views: 194
Reputation: 6944
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);
Upvotes: 1
Reputation: 5428
Why look through the DOM looking for things that have things attached when you could just look through all the dijit.Menu widgets?
You could also easily extend the dijit.Menu widget and add a custom signal as part of the widget create process.
Upvotes: 0