]>
git.wh0rd.org - tt-rss.git/blob - lib/dijit/PopupMenuItem.js.uncompressed.js
1 define("dijit/PopupMenuItem", [
2 "dojo/_base/declare", // declare
3 "dojo/dom-style", // domStyle.set
5 "./registry", // registry.byNode
8 ], function(declare
, domStyle
, query
, registry
, MenuItem
){
11 // dijit/PopupMenuItem
13 return declare("dijit.PopupMenuItem", MenuItem
, {
15 // An item in a Menu that spawn a drop down (usually a drop down menu)
17 _fillContent: function(){
19 // When Menu is declared in markup, this code gets the menu label and
20 // the popup widget from the srcNodeRef.
22 // srcNodeRefinnerHTML contains both the menu item text and a popup widget
23 // The first part holds the menu item text and the second part is the popup
25 // | <div data-dojo-type="dijit/PopupMenuItem">
26 // | <span>pick me</span>
27 // | <popup> ... </popup>
33 var nodes
= query("*", this.srcNodeRef
);
34 this.inherited(arguments
, [nodes
[0]]);
36 // save pointer to srcNode so we can grab the drop down widget after it's instantiated
37 this.dropDownContainer
= this.srcNodeRef
;
42 if(this._started
){ return; }
43 this.inherited(arguments
);
45 // we didn't copy the dropdown widget from the this.srcNodeRef, so it's in no-man's
46 // land now. move it to win.doc.body.
48 var node
= query("[widgetId]", this.dropDownContainer
)[0];
49 this.popup
= registry
.byNode(node
);
51 this.ownerDocumentBody
.appendChild(this.popup
.domNode
);
54 this.popup
.domNode
.style
.display
="none";
55 if(this.arrowWrapper
){
56 domStyle
.set(this.arrowWrapper
, "visibility", "");
58 this.focusNode
.setAttribute("aria-haspopup", "true");
61 destroyDescendants: function(/*Boolean*/ preserveDom
){
63 // Destroy the popup, unless it's already been destroyed. This can happen because
64 // the popup is a direct child of <body> even though it's logically my child.
65 if(!this.popup
._destroyed
){
66 this.popup
.destroyRecursive(preserveDom
);
70 this.inherited(arguments
);