]> git.wh0rd.org - tt-rss.git/blob - lib/dijit/PopupMenuItem.js.uncompressed.js
update dojo to 1.7.3
[tt-rss.git] / lib / dijit / PopupMenuItem.js.uncompressed.js
1 define("dijit/PopupMenuItem", [
2 "dojo/_base/declare", // declare
3 "dojo/dom-style", // domStyle.set
4 "dojo/query", // query
5 "dojo/_base/window", // win.body
6 "./registry", // registry.byNode
7 "./MenuItem",
8 "./hccss"
9 ], function(declare, domStyle, query, win, registry, MenuItem){
10
11 /*=====
12 var MenuItem = dijit.MenuItem;
13 =====*/
14
15 // module:
16 // dijit/PopupMenuItem
17 // summary:
18 // An item in a Menu that spawn a drop down (usually a drop down menu)
19
20 return declare("dijit.PopupMenuItem", MenuItem, {
21 // summary:
22 // An item in a Menu that spawn a drop down (usually a drop down menu)
23
24 _fillContent: function(){
25 // summary:
26 // When Menu is declared in markup, this code gets the menu label and
27 // the popup widget from the srcNodeRef.
28 // description:
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
31 // example:
32 // | <div data-dojo-type="dijit.PopupMenuItem">
33 // | <span>pick me</span>
34 // | <popup> ... </popup>
35 // | </div>
36 // tags:
37 // protected
38
39 if(this.srcNodeRef){
40 var nodes = query("*", this.srcNodeRef);
41 this.inherited(arguments, [nodes[0]]);
42
43 // save pointer to srcNode so we can grab the drop down widget after it's instantiated
44 this.dropDownContainer = this.srcNodeRef;
45 }
46 },
47
48 startup: function(){
49 if(this._started){ return; }
50 this.inherited(arguments);
51
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.
54 if(!this.popup){
55 var node = query("[widgetId]", this.dropDownContainer)[0];
56 this.popup = registry.byNode(node);
57 }
58 win.body().appendChild(this.popup.domNode);
59 this.popup.startup();
60
61 this.popup.domNode.style.display="none";
62 if(this.arrowWrapper){
63 domStyle.set(this.arrowWrapper, "visibility", "");
64 }
65 this.focusNode.setAttribute("aria-haspopup", "true");
66 },
67
68 destroyDescendants: function(/*Boolean*/ preserveDom){
69 if(this.popup){
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);
74 }
75 delete this.popup;
76 }
77 this.inherited(arguments);
78 }
79 });
80 });