/usr/share/javascript/dijit/PopupMenuItem.js is in libjs-dojo-dijit 1.10.2+dfsg-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 | define("dijit/PopupMenuItem", [
"dojo/_base/declare", // declare
"dojo/dom-style", // domStyle.set
"dojo/_base/lang",
"dojo/query", // query
"./popup",
"./registry", // registry.byNode
"./MenuItem",
"./hccss"
], function(declare, domStyle, lang, query, pm, 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)
baseClass: "dijitMenuItem dijitPopupMenuItem",
_fillContent: function(){
// summary:
// When Menu is declared in markup, this code gets the menu label and
// the popup widget from the srcNodeRef.
// description:
// srcNodeRef.innerHTML 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;
}
},
_openPopup: function(/*Object*/ params, /*Boolean*/ focus){
// summary:
// Open the popup to the side of/underneath this MenuItem, and optionally focus first item
// tags:
// protected
var popup = this.popup;
pm.open(lang.delegate(params, {
popup: this.popup,
around: this.domNode
}));
if(focus && popup.focus){
popup.focus();
}
},
_closePopup: function(){
pm.close(this.popup);
this.popup.parentMenu = null;
},
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 <body>.
if(!this.popup){
var node = query("[widgetId]", this.dropDownContainer)[0];
this.popup = registry.byNode(node);
}
this.ownerDocumentBody.appendChild(this.popup.domNode);
this.popup.domNode.setAttribute("aria-labelledby", this.containerNode.id);
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);
}
});
});
|