You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xap-commits@incubator.apache.org by jm...@apache.org on 2007/07/23 23:03:31 UTC
svn commit: r558891 -
/incubator/xap/trunk/codebase/src/xap/bridges/dojo/MenuItemBridge.js
Author: jmargaris
Date: Mon Jul 23 16:03:27 2007
New Revision: 558891
URL: http://svn.apache.org/viewvc?view=rev&rev=558891
Log:
https://issues.apache.org/jira/browse/XAP-500
Modified:
incubator/xap/trunk/codebase/src/xap/bridges/dojo/MenuItemBridge.js
Modified: incubator/xap/trunk/codebase/src/xap/bridges/dojo/MenuItemBridge.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/codebase/src/xap/bridges/dojo/MenuItemBridge.js?view=diff&rev=558891&r1=558890&r2=558891
==============================================================================
--- incubator/xap/trunk/codebase/src/xap/bridges/dojo/MenuItemBridge.js (original)
+++ incubator/xap/trunk/codebase/src/xap/bridges/dojo/MenuItemBridge.js Mon Jul 23 16:03:27 2007
@@ -115,23 +115,28 @@
//get the cached event that made the popup appear, this will deal with nested popups
if (parent.getTopOpenEvent) {
var contextEvent = parent.getTopOpenEvent();
- var topLevelInvokingNode = contextEvent.target;
- //search for the first parent node with an "id" set
- var invokerId = null;
- while (!invokerId && topLevelInvokingNode) {
- invokerId = topLevelInvokingNode.id;
- topLevelInvokingNode = topLevelInvokingNode.parentNode;
- }
-
- // add in the invoker related information
- if (invokerId) {
- var invokingElement = this.getSession().getDocumentContainer().getUiDocument().getElementById(invokerId);
- clientEvent.invoker = invokerId;
- if (invokingElement) {
- clientEvent.invokerName = invokingElement.getAttribute('name');
- }
- }
+ //only a context event if it was shown by right click
+ //a normal menu thing won't have a parent topOpenEvent
+ if (contextEvent){
+ var topLevelInvokingNode = contextEvent.target;
+
+ //search for the first parent node with an "id" set
+ var invokerId = null;
+ while (!invokerId && topLevelInvokingNode) {
+ invokerId = topLevelInvokingNode.id;
+ topLevelInvokingNode = topLevelInvokingNode.parentNode;
+ }
+
+ // add in the invoker related information
+ if (invokerId) {
+ var invokingElement = this.getSession().getDocumentContainer().getUiDocument().getElementById(invokerId);
+ clientEvent.invoker = invokerId;
+ if (invokingElement) {
+ clientEvent.invokerName = invokingElement.getAttribute('name');
+ }
+ }
+ }
}
this.fireEvent("onCommand",null,null,clientEvent);