]> git.pond.sub.org Git - eow/blob - static/dojo-release-1.1.1/dojo/dnd/common.js
Comment class stub
[eow] / static / dojo-release-1.1.1 / dojo / dnd / common.js
1 if(!dojo._hasResource["dojo.dnd.common"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
2 dojo._hasResource["dojo.dnd.common"] = true;
3 dojo.provide("dojo.dnd.common");
4
5 dojo.dnd._copyKey = navigator.appVersion.indexOf("Macintosh") < 0 ? "ctrlKey" : "metaKey";
6
7 dojo.dnd.getCopyKeyState = function(e) {
8         // summary: abstracts away the difference between selection on Mac and PC,
9         //      and returns the state of the "copy" key to be pressed.
10         // e: Event: mouse event
11         return e[dojo.dnd._copyKey];    // Boolean
12 };
13
14 dojo.dnd._uniqueId = 0;
15 dojo.dnd.getUniqueId = function(){
16         // summary: returns a unique string for use with any DOM element
17         var id;
18         do{
19                 id = dojo._scopeName + "Unique" + (++dojo.dnd._uniqueId);
20         }while(dojo.byId(id));
21         return id;
22 };
23
24 dojo.dnd._empty = {};
25
26 dojo.dnd.isFormElement = function(/*Event*/ e){
27         // summary: returns true, if user clicked on a form element
28         var t = e.target;
29         if(t.nodeType == 3 /*TEXT_NODE*/){
30                 t = t.parentNode;
31         }
32         return " button textarea input select option ".indexOf(" " + t.tagName.toLowerCase() + " ") >= 0;       // Boolean
33 };
34
35 }