summaryrefslogtreecommitdiff
path: root/js/dojo/dijit/_base
diff options
context:
space:
mode:
Diffstat (limited to 'js/dojo/dijit/_base')
-rw-r--r--js/dojo/dijit/_base/focus.js320
-rw-r--r--js/dojo/dijit/_base/manager.js77
-rw-r--r--js/dojo/dijit/_base/place.js138
-rw-r--r--js/dojo/dijit/_base/popup.js51
-rw-r--r--js/dojo/dijit/_base/scroll.js18
-rw-r--r--js/dojo/dijit/_base/sniff.js7
-rw-r--r--js/dojo/dijit/_base/typematic.js4
-rw-r--r--js/dojo/dijit/_base/wai.js106
-rw-r--r--js/dojo/dijit/_base/window.js14
9 files changed, 735 insertions, 0 deletions
diff --git a/js/dojo/dijit/_base/focus.js b/js/dojo/dijit/_base/focus.js
new file mode 100644
index 0000000..cdfe1d9
--- /dev/null
+++ b/js/dojo/dijit/_base/focus.js
@@ -0,0 +1,320 @@
+//>>built
+define("dijit/_base/focus", [
+ "dojo/_base/array", // array.forEach
+ "dojo/dom", // dom.isDescendant
+ "dojo/_base/lang", // lang.isArray
+ "dojo/topic", // publish
+ "dojo/_base/window", // win.doc win.doc.selection win.global win.global.getSelection win.withGlobal
+ "../focus",
+ ".." // for exporting symbols to dijit
+], function(array, dom, lang, topic, win, focus, dijit){
+
+ // module:
+ // dijit/_base/focus
+ // summary:
+ // Deprecated module to monitor currently focused node and stack of currently focused widgets.
+ // New code should access dijit/focus directly.
+
+ lang.mixin(dijit, {
+ // _curFocus: DomNode
+ // Currently focused item on screen
+ _curFocus: null,
+
+ // _prevFocus: DomNode
+ // Previously focused item on screen
+ _prevFocus: null,
+
+ isCollapsed: function(){
+ // summary:
+ // Returns true if there is no text selected
+ return dijit.getBookmark().isCollapsed;
+ },
+
+ getBookmark: function(){
+ // summary:
+ // Retrieves a bookmark that can be used with moveToBookmark to return to the same range
+ var bm, rg, tg, sel = win.doc.selection, cf = focus.curNode;
+
+ if(win.global.getSelection){
+ //W3C Range API for selections.
+ sel = win.global.getSelection();
+ if(sel){
+ if(sel.isCollapsed){
+ tg = cf? cf.tagName : "";
+ if(tg){
+ //Create a fake rangelike item to restore selections.
+ tg = tg.toLowerCase();
+ if(tg == "textarea" ||
+ (tg == "input" && (!cf.type || cf.type.toLowerCase() == "text"))){
+ sel = {
+ start: cf.selectionStart,
+ end: cf.selectionEnd,
+ node: cf,
+ pRange: true
+ };
+ return {isCollapsed: (sel.end <= sel.start), mark: sel}; //Object.
+ }
+ }
+ bm = {isCollapsed:true};
+ if(sel.rangeCount){
+ bm.mark = sel.getRangeAt(0).cloneRange();
+ }
+ }else{
+ rg = sel.getRangeAt(0);
+ bm = {isCollapsed: false, mark: rg.cloneRange()};
+ }
+ }
+ }else if(sel){
+ // If the current focus was a input of some sort and no selection, don't bother saving
+ // a native bookmark. This is because it causes issues with dialog/page selection restore.
+ // So, we need to create psuedo bookmarks to work with.
+ tg = cf ? cf.tagName : "";
+ tg = tg.toLowerCase();
+ if(cf && tg && (tg == "button" || tg == "textarea" || tg == "input")){
+ if(sel.type && sel.type.toLowerCase() == "none"){
+ return {
+ isCollapsed: true,
+ mark: null
+ }
+ }else{
+ rg = sel.createRange();
+ return {
+ isCollapsed: rg.text && rg.text.length?false:true,
+ mark: {
+ range: rg,
+ pRange: true
+ }
+ };
+ }
+ }
+ bm = {};
+
+ //'IE' way for selections.
+ try{
+ // createRange() throws exception when dojo in iframe
+ //and nothing selected, see #9632
+ rg = sel.createRange();
+ bm.isCollapsed = !(sel.type == 'Text' ? rg.htmlText.length : rg.length);
+ }catch(e){
+ bm.isCollapsed = true;
+ return bm;
+ }
+ if(sel.type.toUpperCase() == 'CONTROL'){
+ if(rg.length){
+ bm.mark=[];
+ var i=0,len=rg.length;
+ while(i<len){
+ bm.mark.push(rg.item(i++));
+ }
+ }else{
+ bm.isCollapsed = true;
+ bm.mark = null;
+ }
+ }else{
+ bm.mark = rg.getBookmark();
+ }
+ }else{
+ console.warn("No idea how to store the current selection for this browser!");
+ }
+ return bm; // Object
+ },
+
+ moveToBookmark: function(/*Object*/ bookmark){
+ // summary:
+ // Moves current selection to a bookmark
+ // bookmark:
+ // This should be a returned object from dijit.getBookmark()
+
+ var _doc = win.doc,
+ mark = bookmark.mark;
+ if(mark){
+ if(win.global.getSelection){
+ //W3C Rangi API (FF, WebKit, Opera, etc)
+ var sel = win.global.getSelection();
+ if(sel && sel.removeAllRanges){
+ if(mark.pRange){
+ var n = mark.node;
+ n.selectionStart = mark.start;
+ n.selectionEnd = mark.end;
+ }else{
+ sel.removeAllRanges();
+ sel.addRange(mark);
+ }
+ }else{
+ console.warn("No idea how to restore selection for this browser!");
+ }
+ }else if(_doc.selection && mark){
+ //'IE' way.
+ var rg;
+ if(mark.pRange){
+ rg = mark.range;
+ }else if(lang.isArray(mark)){
+ rg = _doc.body.createControlRange();
+ //rg.addElement does not have call/apply method, so can not call it directly
+ //rg is not available in "range.addElement(item)", so can't use that either
+ array.forEach(mark, function(n){
+ rg.addElement(n);
+ });
+ }else{
+ rg = _doc.body.createTextRange();
+ rg.moveToBookmark(mark);
+ }
+ rg.select();
+ }
+ }
+ },
+
+ getFocus: function(/*Widget?*/ menu, /*Window?*/ openedForWindow){
+ // summary:
+ // Called as getFocus(), this returns an Object showing the current focus
+ // and selected text.
+ //
+ // Called as getFocus(widget), where widget is a (widget representing) a button
+ // that was just pressed, it returns where focus was before that button
+ // was pressed. (Pressing the button may have either shifted focus to the button,
+ // or removed focus altogether.) In this case the selected text is not returned,
+ // since it can't be accurately determined.
+ //
+ // menu: dijit._Widget or {domNode: DomNode} structure
+ // The button that was just pressed. If focus has disappeared or moved
+ // to this button, returns the previous focus. In this case the bookmark
+ // information is already lost, and null is returned.
+ //
+ // openedForWindow:
+ // iframe in which menu was opened
+ //
+ // returns:
+ // A handle to restore focus/selection, to be passed to `dijit.focus`
+ var node = !focus.curNode || (menu && dom.isDescendant(focus.curNode, menu.domNode)) ? dijit._prevFocus : focus.curNode;
+ return {
+ node: node,
+ bookmark: node && (node == focus.curNode) && win.withGlobal(openedForWindow || win.global, dijit.getBookmark),
+ openedForWindow: openedForWindow
+ }; // Object
+ },
+
+ // _activeStack: dijit._Widget[]
+ // List of currently active widgets (focused widget and it's ancestors)
+ _activeStack: [],
+
+ registerIframe: function(/*DomNode*/ iframe){
+ // summary:
+ // Registers listeners on the specified iframe so that any click
+ // or focus event on that iframe (or anything in it) is reported
+ // as a focus/click event on the <iframe> itself.
+ // description:
+ // Currently only used by editor.
+ // returns:
+ // Handle to pass to unregisterIframe()
+ return focus.registerIframe(iframe);
+ },
+
+ unregisterIframe: function(/*Object*/ handle){
+ // summary:
+ // Unregisters listeners on the specified iframe created by registerIframe.
+ // After calling be sure to delete or null out the handle itself.
+ // handle:
+ // Handle returned by registerIframe()
+
+ handle && handle.remove();
+ },
+
+ registerWin: function(/*Window?*/targetWindow, /*DomNode?*/ effectiveNode){
+ // summary:
+ // Registers listeners on the specified window (either the main
+ // window or an iframe's window) to detect when the user has clicked somewhere
+ // or focused somewhere.
+ // description:
+ // Users should call registerIframe() instead of this method.
+ // targetWindow:
+ // If specified this is the window associated with the iframe,
+ // i.e. iframe.contentWindow.
+ // effectiveNode:
+ // If specified, report any focus events inside targetWindow as
+ // an event on effectiveNode, rather than on evt.target.
+ // returns:
+ // Handle to pass to unregisterWin()
+
+ return focus.registerWin(targetWindow, effectiveNode);
+ },
+
+ unregisterWin: function(/*Handle*/ handle){
+ // summary:
+ // Unregisters listeners on the specified window (either the main
+ // window or an iframe's window) according to handle returned from registerWin().
+ // After calling be sure to delete or null out the handle itself.
+
+ handle && handle.remove();
+ }
+ });
+
+ // Override focus singleton's focus function so that dijit.focus()
+ // has backwards compatible behavior of restoring selection (although
+ // probably no one is using that).
+ focus.focus = function(/*Object || DomNode */ handle){
+ // summary:
+ // Sets the focused node and the selection according to argument.
+ // To set focus to an iframe's content, pass in the iframe itself.
+ // handle:
+ // object returned by get(), or a DomNode
+
+ if(!handle){ return; }
+
+ var node = "node" in handle ? handle.node : handle, // because handle is either DomNode or a composite object
+ bookmark = handle.bookmark,
+ openedForWindow = handle.openedForWindow,
+ collapsed = bookmark ? bookmark.isCollapsed : false;
+
+ // Set the focus
+ // Note that for iframe's we need to use the <iframe> to follow the parentNode chain,
+ // but we need to set focus to iframe.contentWindow
+ if(node){
+ var focusNode = (node.tagName.toLowerCase() == "iframe") ? node.contentWindow : node;
+ if(focusNode && focusNode.focus){
+ try{
+ // Gecko throws sometimes if setting focus is impossible,
+ // node not displayed or something like that
+ focusNode.focus();
+ }catch(e){/*quiet*/}
+ }
+ focus._onFocusNode(node);
+ }
+
+ // set the selection
+ // do not need to restore if current selection is not empty
+ // (use keyboard to select a menu item) or if previous selection was collapsed
+ // as it may cause focus shift (Esp in IE).
+ if(bookmark && win.withGlobal(openedForWindow || win.global, dijit.isCollapsed) && !collapsed){
+ if(openedForWindow){
+ openedForWindow.focus();
+ }
+ try{
+ win.withGlobal(openedForWindow || win.global, dijit.moveToBookmark, null, [bookmark]);
+ }catch(e2){
+ /*squelch IE internal error, see http://trac.dojotoolkit.org/ticket/1984 */
+ }
+ }
+ };
+
+ // For back compatibility, monitor changes to focused node and active widget stack,
+ // publishing events and copying changes from focus manager variables into dijit (top level) variables
+ focus.watch("curNode", function(name, oldVal, newVal){
+ dijit._curFocus = newVal;
+ dijit._prevFocus = oldVal;
+ if(newVal){
+ topic.publish("focusNode", newVal); // publish
+ }
+ });
+ focus.watch("activeStack", function(name, oldVal, newVal){
+ dijit._activeStack = newVal;
+ });
+
+ focus.on("widget-blur", function(widget, by){
+ topic.publish("widgetBlur", widget, by); // publish
+ });
+ focus.on("widget-focus", function(widget, by){
+ topic.publish("widgetFocus", widget, by); // publish
+ });
+
+ return dijit;
+});
diff --git a/js/dojo/dijit/_base/manager.js b/js/dojo/dijit/_base/manager.js
new file mode 100644
index 0000000..2892d70
--- /dev/null
+++ b/js/dojo/dijit/_base/manager.js
@@ -0,0 +1,77 @@
+//>>built
+define("dijit/_base/manager", [
+ "dojo/_base/array",
+ "dojo/_base/config", // defaultDuration
+ "../registry",
+ ".." // for setting exports to dijit namespace
+], function(array, config, registry, dijit){
+
+ // module:
+ // dijit/_base/manager
+ // summary:
+ // Shim to methods on registry, plus a few other declarations.
+ // New code should access dijit/registry directly when possible.
+
+ /*=====
+ dijit.byId = function(id){
+ // summary:
+ // Returns a widget by it's id, or if passed a widget, no-op (like dom.byId())
+ // id: String|dijit._Widget
+ return registry.byId(id); // dijit._Widget
+ };
+
+ dijit.getUniqueId = function(widgetType){
+ // summary:
+ // Generates a unique id for a given widgetType
+ // widgetType: String
+ return registry.getUniqueId(widgetType); // String
+ };
+
+ dijit.findWidgets = function(root){
+ // summary:
+ // Search subtree under root returning widgets found.
+ // Doesn't search for nested widgets (ie, widgets inside other widgets).
+ // root: DOMNode
+ return registry.findWidgets(root);
+ };
+
+ dijit._destroyAll = function(){
+ // summary:
+ // Code to destroy all widgets and do other cleanup on page unload
+
+ return registry._destroyAll();
+ };
+
+ dijit.byNode = function(node){
+ // summary:
+ // Returns the widget corresponding to the given DOMNode
+ // node: DOMNode
+ return registry.byNode(node); // dijit._Widget
+ };
+
+ dijit.getEnclosingWidget = function(node){
+ // summary:
+ // Returns the widget whose DOM tree contains the specified DOMNode, or null if
+ // the node is not contained within the DOM tree of any widget
+ // node: DOMNode
+ return registry.getEnclosingWidget(node);
+ };
+ =====*/
+ array.forEach(["byId", "getUniqueId", "findWidgets", "_destroyAll", "byNode", "getEnclosingWidget"], function(name){
+ dijit[name] = registry[name];
+ });
+
+ /*=====
+ dojo.mixin(dijit, {
+ // defaultDuration: Integer
+ // The default fx.animation speed (in ms) to use for all Dijit
+ // transitional fx.animations, unless otherwise specified
+ // on a per-instance basis. Defaults to 200, overrided by
+ // `djConfig.defaultDuration`
+ defaultDuration: 200
+ });
+ =====*/
+ dijit.defaultDuration = config["defaultDuration"] || 200;
+
+ return dijit;
+});
diff --git a/js/dojo/dijit/_base/place.js b/js/dojo/dijit/_base/place.js
new file mode 100644
index 0000000..b6ee415
--- /dev/null
+++ b/js/dojo/dijit/_base/place.js
@@ -0,0 +1,138 @@
+//>>built
+define("dijit/_base/place", [
+ "dojo/_base/array", // array.forEach
+ "dojo/_base/lang", // lang.isArray
+ "dojo/window", // windowUtils.getBox
+ "../place",
+ ".." // export to dijit namespace
+], function(array, lang, windowUtils, place, dijit){
+
+ // module:
+ // dijit/_base/place
+ // summary:
+ // Back compatibility module, new code should use dijit/place directly instead of using this module.
+
+ dijit.getViewport = function(){
+ // summary:
+ // Deprecated method to return the dimensions and scroll position of the viewable area of a browser window.
+ // New code should use windowUtils.getBox()
+
+ return windowUtils.getBox();
+ };
+
+ /*=====
+ dijit.placeOnScreen = function(node, pos, corners, padding){
+ // summary:
+ // Positions one of the node's corners at specified position
+ // such that node is fully visible in viewport.
+ // Deprecated, new code should use dijit.place.at() instead.
+ };
+ =====*/
+ dijit.placeOnScreen = place.at;
+
+ /*=====
+ dijit.placeOnScreenAroundElement = function(node, aroundElement, aroundCorners, layoutNode){
+ // summary:
+ // Like dijit.placeOnScreenAroundNode(), except it accepts an arbitrary object
+ // for the "around" argument and finds a proper processor to place a node.
+ // Deprecated, new code should use dijit.place.around() instead.
+ };
+ ====*/
+ dijit.placeOnScreenAroundElement = function(node, aroundNode, aroundCorners, layoutNode){
+ // Convert old style {"BL": "TL", "BR": "TR"} type argument
+ // to style needed by dijit.place code:
+ // [
+ // {aroundCorner: "BL", corner: "TL" },
+ // {aroundCorner: "BR", corner: "TR" }
+ // ]
+ var positions;
+ if(lang.isArray(aroundCorners)){
+ positions = aroundCorners;
+ }else{
+ positions = [];
+ for(var key in aroundCorners){
+ positions.push({aroundCorner: key, corner: aroundCorners[key]});
+ }
+ }
+
+ return place.around(node, aroundNode, positions, true, layoutNode);
+ };
+
+ /*=====
+ dijit.placeOnScreenAroundNode = function(node, aroundNode, aroundCorners, layoutNode){
+ // summary:
+ // Position node adjacent or kitty-corner to aroundNode
+ // such that it's fully visible in viewport.
+ // Deprecated, new code should use dijit.place.around() instead.
+ };
+ =====*/
+ dijit.placeOnScreenAroundNode = dijit.placeOnScreenAroundElement;
+
+ /*=====
+ dijit.placeOnScreenAroundRectangle = function(node, aroundRect, aroundCorners, layoutNode){
+ // summary:
+ // Like dijit.placeOnScreenAroundNode(), except that the "around"
+ // parameter is an arbitrary rectangle on the screen (x, y, width, height)
+ // instead of a dom node.
+ // Deprecated, new code should use dijit.place.around() instead.
+ };
+ =====*/
+ dijit.placeOnScreenAroundRectangle = dijit.placeOnScreenAroundElement;
+
+ dijit.getPopupAroundAlignment = function(/*Array*/ position, /*Boolean*/ leftToRight){
+ // summary:
+ // Deprecated method, unneeded when using dijit/place directly.
+ // Transforms the passed array of preferred positions into a format suitable for
+ // passing as the aroundCorners argument to dijit.placeOnScreenAroundElement.
+ //
+ // position: String[]
+ // This variable controls the position of the drop down.
+ // It's an array of strings with the following values:
+ //
+ // * before: places drop down to the left of the target node/widget, or to the right in
+ // the case of RTL scripts like Hebrew and Arabic
+ // * after: places drop down to the right of the target node/widget, or to the left in
+ // the case of RTL scripts like Hebrew and Arabic
+ // * above: drop down goes above target node
+ // * below: drop down goes below target node
+ //
+ // The list is positions is tried, in order, until a position is found where the drop down fits
+ // within the viewport.
+ //
+ // leftToRight: Boolean
+ // Whether the popup will be displaying in leftToRight mode.
+ //
+ var align = {};
+ array.forEach(position, function(pos){
+ var ltr = leftToRight;
+ switch(pos){
+ case "after":
+ align[leftToRight ? "BR" : "BL"] = leftToRight ? "BL" : "BR";
+ break;
+ case "before":
+ align[leftToRight ? "BL" : "BR"] = leftToRight ? "BR" : "BL";
+ break;
+ case "below-alt":
+ ltr = !ltr;
+ // fall through
+ case "below":
+ // first try to align left borders, next try to align right borders (or reverse for RTL mode)
+ align[ltr ? "BL" : "BR"] = ltr ? "TL" : "TR";
+ align[ltr ? "BR" : "BL"] = ltr ? "TR" : "TL";
+ break;
+ case "above-alt":
+ ltr = !ltr;
+ // fall through
+ case "above":
+ default:
+ // first try to align left borders, next try to align right borders (or reverse for RTL mode)
+ align[ltr ? "TL" : "TR"] = ltr ? "BL" : "BR";
+ align[ltr ? "TR" : "TL"] = ltr ? "BR" : "BL";
+ break;
+ }
+ });
+ return align;
+ };
+
+ return dijit;
+});
diff --git a/js/dojo/dijit/_base/popup.js b/js/dojo/dijit/_base/popup.js
new file mode 100644
index 0000000..4991f49
--- /dev/null
+++ b/js/dojo/dijit/_base/popup.js
@@ -0,0 +1,51 @@
+//>>built
+define("dijit/_base/popup", [
+ "dojo/dom-class", // domClass.contains
+ "../popup",
+ "../BackgroundIframe" // just loading for back-compat, in case client code is referencing it
+], function(domClass, popup){
+
+// module:
+// dijit/_base/popup
+// summary:
+// Old module for popups, new code should use dijit/popup directly
+
+
+// Hack support for old API passing in node instead of a widget (to various methods)
+var origCreateWrapper = popup._createWrapper;
+popup._createWrapper = function(widget){
+ if(!widget.declaredClass){
+ // make fake widget to pass to new API
+ widget = {
+ _popupWrapper: (widget.parentNode && domClass.contains(widget.parentNode, "dijitPopup")) ?
+ widget.parentNode : null,
+ domNode: widget,
+ destroy: function(){}
+ };
+ }
+ return origCreateWrapper.call(this, widget);
+};
+
+// Support old format of orient parameter
+var origOpen = popup.open;
+popup.open = function(/*dijit.popup.__OpenArgs*/ args){
+ // Convert old hash structure (ex: {"BL": "TL", ...}) of orient to format compatible w/new popup.open() API.
+ // Don't do conversion for:
+ // - null parameter (that means to use the default positioning)
+ // - "R" or "L" strings used to indicate positioning for context menus (when there is no around node)
+ // - new format, ex: ["below", "above"]
+ // - return value from deprecated dijit.getPopupAroundAlignment() method,
+ // ex: ["below", "above"]
+ if(args.orient && typeof args.orient != "string" && !("length" in args.orient)){
+ var ary = [];
+ for(var key in args.orient){
+ ary.push({aroundCorner: key, corner: args.orient[key]});
+ }
+ args.orient = ary;
+ }
+
+ return origOpen.call(this, args);
+};
+
+return popup;
+});
diff --git a/js/dojo/dijit/_base/scroll.js b/js/dojo/dijit/_base/scroll.js
new file mode 100644
index 0000000..d9f407a
--- /dev/null
+++ b/js/dojo/dijit/_base/scroll.js
@@ -0,0 +1,18 @@
+//>>built
+define("dijit/_base/scroll", [
+ "dojo/window", // windowUtils.scrollIntoView
+ ".." // export symbol to dijit
+], function(windowUtils, dijit){
+ // module:
+ // dijit/_base/scroll
+ // summary:
+ // Back compatibility module, new code should use windowUtils directly instead of using this module.
+
+ dijit.scrollIntoView = function(/*DomNode*/ node, /*Object?*/ pos){
+ // summary:
+ // Scroll the passed node into view, if it is not already.
+ // Deprecated, use `windowUtils.scrollIntoView` instead.
+
+ windowUtils.scrollIntoView(node, pos);
+ };
+});
diff --git a/js/dojo/dijit/_base/sniff.js b/js/dojo/dijit/_base/sniff.js
new file mode 100644
index 0000000..5d501f6
--- /dev/null
+++ b/js/dojo/dijit/_base/sniff.js
@@ -0,0 +1,7 @@
+//>>built
+define("dijit/_base/sniff", [ "dojo/uacss" ], function(){
+ // module:
+ // dijit/_base/sniff
+ // summary:
+ // Back compatibility module, new code should require dojo/uacss directly instead of this module.
+});
diff --git a/js/dojo/dijit/_base/typematic.js b/js/dojo/dijit/_base/typematic.js
new file mode 100644
index 0000000..ba3ec02
--- /dev/null
+++ b/js/dojo/dijit/_base/typematic.js
@@ -0,0 +1,4 @@
+//>>built
+define("dijit/_base/typematic", ["../typematic"], function(){
+ // for back-compat, just loads top level module
+});
diff --git a/js/dojo/dijit/_base/wai.js b/js/dojo/dijit/_base/wai.js
new file mode 100644
index 0000000..35f6c7e
--- /dev/null
+++ b/js/dojo/dijit/_base/wai.js
@@ -0,0 +1,106 @@
+//>>built
+define("dijit/_base/wai", [
+ "dojo/dom-attr", // domAttr.attr
+ "dojo/_base/lang", // lang.mixin
+ "..", // export symbols to dijit
+ "../hccss" // not using this module directly, but loading it sets CSS flag on <html>
+], function(domAttr, lang, dijit){
+
+ // module:
+ // dijit/_base/wai
+ // summary:
+ // Deprecated methods for setting/getting wai roles and states.
+ // New code should call setAttribute()/getAttribute() directly.
+ //
+ // Also loads hccss to apply dijit_a11y class to root node if machine is in high-contrast mode.
+
+ lang.mixin(dijit, {
+ hasWaiRole: function(/*Element*/ elem, /*String?*/ role){
+ // summary:
+ // Determines if an element has a particular role.
+ // returns:
+ // True if elem has the specific role attribute and false if not.
+ // For backwards compatibility if role parameter not provided,
+ // returns true if has a role
+ var waiRole = this.getWaiRole(elem);
+ return role ? (waiRole.indexOf(role) > -1) : (waiRole.length > 0);
+ },
+
+ getWaiRole: function(/*Element*/ elem){
+ // summary:
+ // Gets the role for an element (which should be a wai role).
+ // returns:
+ // The role of elem or an empty string if elem
+ // does not have a role.
+ return lang.trim((domAttr.get(elem, "role") || "").replace("wairole:",""));
+ },
+
+ setWaiRole: function(/*Element*/ elem, /*String*/ role){
+ // summary:
+ // Sets the role on an element.
+ // description:
+ // Replace existing role attribute with new role.
+
+ domAttr.set(elem, "role", role);
+ },
+
+ removeWaiRole: function(/*Element*/ elem, /*String*/ role){
+ // summary:
+ // Removes the specified role from an element.
+ // Removes role attribute if no specific role provided (for backwards compat.)
+
+ var roleValue = domAttr.get(elem, "role");
+ if(!roleValue){ return; }
+ if(role){
+ var t = lang.trim((" " + roleValue + " ").replace(" " + role + " ", " "));
+ domAttr.set(elem, "role", t);
+ }else{
+ elem.removeAttribute("role");
+ }
+ },
+
+ hasWaiState: function(/*Element*/ elem, /*String*/ state){
+ // summary:
+ // Determines if an element has a given state.
+ // description:
+ // Checks for an attribute called "aria-"+state.
+ // returns:
+ // true if elem has a value for the given state and
+ // false if it does not.
+
+ return elem.hasAttribute ? elem.hasAttribute("aria-"+state) : !!elem.getAttribute("aria-"+state);
+ },
+
+ getWaiState: function(/*Element*/ elem, /*String*/ state){
+ // summary:
+ // Gets the value of a state on an element.
+ // description:
+ // Checks for an attribute called "aria-"+state.
+ // returns:
+ // The value of the requested state on elem
+ // or an empty string if elem has no value for state.
+
+ return elem.getAttribute("aria-"+state) || "";
+ },
+
+ setWaiState: function(/*Element*/ elem, /*String*/ state, /*String*/ value){
+ // summary:
+ // Sets a state on an element.
+ // description:
+ // Sets an attribute called "aria-"+state.
+
+ elem.setAttribute("aria-"+state, value);
+ },
+
+ removeWaiState: function(/*Element*/ elem, /*String*/ state){
+ // summary:
+ // Removes a state from an element.
+ // description:
+ // Sets an attribute called "aria-"+state.
+
+ elem.removeAttribute("aria-"+state);
+ }
+ });
+
+ return dijit;
+});
diff --git a/js/dojo/dijit/_base/window.js b/js/dojo/dijit/_base/window.js
new file mode 100644
index 0000000..37302d6
--- /dev/null
+++ b/js/dojo/dijit/_base/window.js
@@ -0,0 +1,14 @@
+//>>built
+define("dijit/_base/window", [
+ "dojo/window", // windowUtils.get
+ ".." // export symbol to dijit
+], function(windowUtils, dijit){
+ // module:
+ // dijit/_base/window
+ // summary:
+ // Back compatibility module, new code should use windowUtils directly instead of using this module.
+
+ dijit.getDocumentWindow = function(doc){
+ return windowUtils.get(doc);
+ };
+});