]>
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 "dojo/_base/window", // win.body
6 "./registry", // registry.byNode
9 ], function(declare
, domStyle
, query
, win
, registry
, MenuItem
){
12 var MenuItem = dijit.MenuItem;
16 // dijit/PopupMenuItem
18 // An item in a Menu that spawn a drop down (usually a drop down menu)
20 return declare("dijit.PopupMenuItem", MenuItem
, {
22 // An item in a Menu that spawn a drop down (usually a drop down menu)
24 _fillContent: function(){
26 // When Menu is declared in markup, this code gets the menu label and
27 // the popup widget from the srcNodeRef.
29 // srcNodeRefinnerHTML contains both the menu item text and a popup widget
30 // The first part holds the menu item text and the second part is the popup
32 // | <div data-dojo-type="dijit.PopupMenuItem">
33 // | <span>pick me</span>
34 // | <popup> ... </popup>
40 var nodes
= query("*", this.srcNodeRef
);
41 this.inherited(arguments
, [nodes
[0]]);
43 // save pointer to srcNode so we can grab the drop down widget after it's instantiated
44 this.dropDownContainer
= this.srcNodeRef
;
49 if(this._started
){ return; }
50 this.inherited(arguments
);
52 // we didn't copy the dropdown widget from the this.srcNodeRef, so it's in no-man's
53 // land now. move it to win.doc.body.
55 var node
= query("[widgetId]", this.dropDownContainer
)[0];
56 this.popup
= registry
.byNode(node
);
58 win
.body().appendChild(this.popup
.domNode
);
61 this.popup
.domNode
.style
.display
="none";
62 if(this.arrowWrapper
){
63 domStyle
.set(this.arrowWrapper
, "visibility", "");
65 this.focusNode
.setAttribute("aria-haspopup", "true");
68 destroyDescendants: function(/*Boolean*/ preserveDom
){
70 // Destroy the popup, unless it's already been destroyed. This can happen because
71 // the popup is a direct child of <body> even though it's logically my child.
72 if(!this.popup
._destroyed
){
73 this.popup
.destroyRecursive(preserveDom
);
77 this.inherited(arguments
);