summaryrefslogtreecommitdiff
path: root/lib/dijit/PopupMenuItem.js.uncompressed.js
diff options
context:
space:
mode:
authorRichard Beales <[email protected]>2013-03-18 07:32:01 +0000
committerRichard Beales <[email protected]>2013-03-18 07:32:01 +0000
commit7c97d17aaf373339a8bcd917ad59ca6018148f0d (patch)
tree5a3c04f0f9529be392c1263d3feb75806eb43797 /lib/dijit/PopupMenuItem.js.uncompressed.js
parent70db7424e7068701e60cc5bcdfe8f858be508179 (diff)
parentc670a80ddd9b03bd4ea6d940a9ed682fd26248d7 (diff)
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'lib/dijit/PopupMenuItem.js.uncompressed.js')
-rw-r--r--lib/dijit/PopupMenuItem.js.uncompressed.js73
1 files changed, 73 insertions, 0 deletions
diff --git a/lib/dijit/PopupMenuItem.js.uncompressed.js b/lib/dijit/PopupMenuItem.js.uncompressed.js
new file mode 100644
index 000000000..d8250152d
--- /dev/null
+++ b/lib/dijit/PopupMenuItem.js.uncompressed.js
@@ -0,0 +1,73 @@
+define("dijit/PopupMenuItem", [
+ "dojo/_base/declare", // declare
+ "dojo/dom-style", // domStyle.set
+ "dojo/query", // query
+ "./registry", // registry.byNode
+ "./MenuItem",
+ "./hccss"
+], function(declare, domStyle, query, registry, MenuItem){
+
+ // module:
+ // dijit/PopupMenuItem
+
+ return declare("dijit.PopupMenuItem", MenuItem, {
+ // summary:
+ // An item in a Menu that spawn a drop down (usually a drop down menu)
+
+ _fillContent: function(){
+ // summary:
+ // When Menu is declared in markup, this code gets the menu label and
+ // the popup widget from the srcNodeRef.
+ // description:
+ // srcNodeRefinnerHTML contains both the menu item text and a popup widget
+ // The first part holds the menu item text and the second part is the popup
+ // example:
+ // | <div data-dojo-type="dijit/PopupMenuItem">
+ // | <span>pick me</span>
+ // | <popup> ... </popup>
+ // | </div>
+ // tags:
+ // protected
+
+ if(this.srcNodeRef){
+ var nodes = query("*", this.srcNodeRef);
+ this.inherited(arguments, [nodes[0]]);
+
+ // save pointer to srcNode so we can grab the drop down widget after it's instantiated
+ this.dropDownContainer = this.srcNodeRef;
+ }
+ },
+
+ startup: function(){
+ if(this._started){ return; }
+ this.inherited(arguments);
+
+ // we didn't copy the dropdown widget from the this.srcNodeRef, so it's in no-man's
+ // land now. move it to win.doc.body.
+ if(!this.popup){
+ var node = query("[widgetId]", this.dropDownContainer)[0];
+ this.popup = registry.byNode(node);
+ }
+ this.ownerDocumentBody.appendChild(this.popup.domNode);
+ this.popup.startup();
+
+ this.popup.domNode.style.display="none";
+ if(this.arrowWrapper){
+ domStyle.set(this.arrowWrapper, "visibility", "");
+ }
+ this.focusNode.setAttribute("aria-haspopup", "true");
+ },
+
+ destroyDescendants: function(/*Boolean*/ preserveDom){
+ if(this.popup){
+ // Destroy the popup, unless it's already been destroyed. This can happen because
+ // the popup is a direct child of <body> even though it's logically my child.
+ if(!this.popup._destroyed){
+ this.popup.destroyRecursive(preserveDom);
+ }
+ delete this.popup;
+ }
+ this.inherited(arguments);
+ }
+ });
+});