• Dojo MenuItem problem with OneUI3.02 and Mozilla

    By Serdar Basegmez 9 years ago

    There is a problem with Dojo menu items in Mozilla. The problem is easy to repeat.

        <xe:linksList id="linksList1">
            <xe:this.treeNodes>
                <xe:basicContainerNode label="Test Menu" href="#">
                    <xe:this.children>
                        <xe:basicLeafNode label="Reload App Setup" onClick="alert('clicked')"><span style="line-height: 1.42857143;"></xe:basicLeafNode></span>
                    </xe:this.children>
                </xe:basicContainerNode>
            </xe:this.treeNodes>
        </xe:linksList>
    

    The problem is for Mozilla and if the theme is OneUI 3.0.2. When you open the Test menu and click “Reload App Setup” option, dojo throws “TypeError: node.getAttribute is not a function” in byNode function from dijit.registy:

        byNode: function $DC7I_(/*DOMNode*/ node){
           // summary:
           //      Returns the widget corresponding to the given DOMNode
            return hash[node.getAttribute("widgetId")];// dijit/_WidgetBase
        },~~~
    When debugging, the node seems to be a TextNode object and specific to Mozilla. It seems like Mozilla inserts text node into the menu item and click event tries to identify which widget it belongs to. We can click a narrow band around the text but not on the label.
    When switching back to OneUI v2.1, problem will be gone mysteriously... Tested on Mozilla firefox 24 and 35. 
    I thought it's a dojo problem as I saw [this post](http://dojo-toolkit.33424.n3.nabble.com/Dojo-1-9-in-Firefox-inserts-a-text-empty-node-above-a-DOM-node-td3998952.html). But it's interesting that it works for the OneUI v2.1. 
    
    • By Serdar Basegmez 9 years ago

      I should have used wrong markups. Sorry about the mess :)

      • By B Gleeson 9 years ago

        Hi Serdar, thanks for reporting the issue.

        We had already logged the issue as SPR# BGLN9PXG53, but a fix has not yet been identified. The extra info you've added above may prove helpful though, so thanks for that.

        • By Serdar Basegmez 9 years ago

          Thank you.

          I have added the following JS into a CSJS library as a workaround for the issue, it might help if anyone needs.

          if(dojo.isMozilla) dojo.addOnLoad(function() {
              dijit.registry.backupByNode=dijit.registry.byNode;
              dijit.registry.byNode=function(node) {
                  if(node.getAttribute) {
                      return dijit.registry.backupByNode(node);
                  } else {
                      return dijit.registry.backupByNode(node.parentNode);
                  }
              }
          });
          
          • By Cameron Gregor 9 years ago

            Thanks Serdar this worked for me