#41: ContextMenu needs a way to set for a single element not just a group of elements (Open)

May 27 2009 * 20:12
Reported by:   Assigned to:  
Priority: Enhancement  Milestone:  

Sure you can do some :first-child magic to set a single element with the context menu; however, here is a quick edit to allow one to pass a single element object into the context menu. Of course, you can always make a unique id attribute but that might be wrong for some use cases.

Code change //Added a another way to attach context menu behavior: 2 lines changed

var group = this.options.singleElement ? [this.options.singleElement] : $$(this.options.selector); group.invoke(‘observe’, contextEvent, function(e) {

// Usage new_row.down().next(2).down(4).observe(‘click’,function(){ new UI.ContextMenu( { singleElement: this, .....etc.