dijit/main (version 1.10)

Summary

The dijit package main module. Deprecated. Users should access individual modules (ex: dijit/registry) directly.

Property Summary

  • _activeStackList of currently active widgets (focused widget and it's ancestors)
  • _curFocusCurrently focused item on screen
  • _masterTT
  • _prevFocusPreviously focused item on screen
  • _underlay
  • defaultDurationThe default fx.animation speed (in ms) to use for all Dijit transitional fx.animations, unless otherwise specified on a per-instance basis.
  • placeCode to place a DOMNode relative to another DOMNode.
  • popup
  • registryRegistry of existing widget on page, plus some utility methods.
  • typematicThese functions are used to repetitively call a user specified callback method when a specific key or mouse click over a specific DOM node is held down for a specific amount of time.

Method Summary

  • _Calendar()
  • _getTabNavigable(root) Finds descendants of the specified root node.
  • _isElementShown(elem)
  • _setSelectionRange(element,start,stop)
  • BackgroundIframe(node) For IE/FF z-index shenanigans. id attribute is required.
  • effectiveTabIndex(elem) Returns effective tabIndex of an element, either a number, or undefined if element isn't focusable.
  • focus(node)
  • getBookmark() Retrieves a bookmark that can be used with moveToBookmark to return to the same range
  • getDocumentWindow(doc)
  • getFirstInTabbingOrder(root,doc) Finds the descendant of the specified root node that is first in the tabbing order
  • getFocus(menu,openedForWindow) Called as getFocus(), this returns an Object showing the current focus and selected text.
  • getLastInTabbingOrder(root,doc) Finds the descendant of the specified root node that is last in the tabbing order
  • getPopupAroundAlignment(position,leftToRight) Deprecated method, unneeded when using dijit/place directly.
  • getViewport() Deprecated method to return the dimensions and scroll position of the viewable area of a browser window.
  • getWaiRole(elem) Gets the role for an element (which should be a wai role).
  • getWaiState(elem,state) Gets the value of a state on an element.
  • hasDefaultTabStop(elem) Tests if element is tab-navigable even without an explicit tabIndex setting
  • hasWaiRole(elem,role) Determines if an element has a particular role.
  • hasWaiState(elem,state) Determines if an element has a given state.
  • hideTooltip(aroundNode) Static method to hide the tooltip displayed via showTooltip()
  • isCollapsed() Returns true if there is no text selected
  • isFocusable(elem) Tests if an element is focusable by tabbing to it, or clicking it with the mouse.
  • isTabNavigable(elem) Tests if an element is tab-navigable
  • moveToBookmark(bookmark) Moves current selection to a bookmark
  • placeOnScreen(node,pos,corners,padding,layoutNode) Positions node kitty-corner to the rectangle centered at (pos.x, pos.y) with width and height of padding.x 2 and padding.y 2, or zero if padding not specified.
  • placeOnScreenAroundElement(node,aroundNode,aroundCorners,layoutNode) Like dijit.placeOnScreenAroundNode(), except it accepts an arbitrary object for the "around" argument and finds a proper processor to place a node.
  • placeOnScreenAroundNode(node,aroundNode,aroundCorners,layoutNode) Position node adjacent or kitty-corner to aroundNode such that it's fully visible in viewport.
  • placeOnScreenAroundRectangle(node,aroundRect,aroundCorners,layoutNode) Like dijit.placeOnScreenAroundNode(), except that the "around" parameter is an arbitrary rectangle on the screen (x, y, width, height) instead of a dom node.
  • registerIframe(iframe) 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.
  • registerWin(targetWindow,effectiveNode) 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.
  • removeWaiRole(elem,role) Removes the specified role from an element.
  • removeWaiState(elem,state) Removes a state from an element.
  • scrollIntoView(node,pos) Scroll the passed node into view, if it is not already.
  • selectInputText(element,start,stop) Select text in the input element argument, from start (default 0), to stop (default end).
  • setWaiRole(elem,role) Sets the role on an element.
  • setWaiState(elem,state,value) Sets a state on an element.
  • showTooltip(innerHTML,aroundNode,position,rtl,textDir,onMouseEnter,onMouseLeave) Static method to display tooltip w/specified contents in specified position.
  • unregisterIframe(handle) Unregisters listeners on the specified iframe created by registerIframe.
  • unregisterWin(handle) Unregisters listeners on the specified window (either the main window or an iframe's window) according to handle returned from registerWin().

Properties

_activeStack
Defined by: dijit/_base/focus

List of currently active widgets (focused widget and it's ancestors)

_curFocus
Defined by: dijit/_base/focus

Currently focused item on screen

_masterTT
_prevFocus
Defined by: dijit/_base/focus

Previously focused item on screen

_underlay
Defined by: dijit/Dialog
defaultDuration
Defined by: dijit/_base/manager

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

place
Defined by: dijit/place

Code to place a DOMNode relative to another DOMNode. Load using require(["dijit/place"], function(place){ ... }).

popup
Defined by: dijit/popup
registry
Defined by: dijit/registry

Registry of existing widget on page, plus some utility methods.

typematic
Defined by: dijit/typematic

These functions are used to repetitively call a user specified callback method when a specific key or mouse click over a specific DOM node is held down for a specific amount of time. Only 1 such event is allowed to occur on the browser page at 1 time.

Methods

_Calendar()
Defined by dijit/Calendar
_getTabNavigable(root)
Defined by dijit/a11y

Finds descendants of the specified root node.

Finds the following descendants of the specified root node:

  • the first tab-navigable element in document order without a tabIndex or with tabIndex="0"
  • the last tab-navigable element in document order without a tabIndex or with tabIndex="0"
  • the first element in document order with the lowest positive tabIndex value
  • the last element in document order with the highest positive tabIndex value
Parameter Type Description
root DOMNode
Returns:object
_isElementShown(elem)
Defined by dijit/a11y
Parameter Type Description
elem Element
Returns:boolean
_setSelectionRange(element,start,stop)
Defined by dijit/form/TextBox
Parameter Type Description
element DomNode
start Number
Optional
stop Number
Optional
BackgroundIframe(node)

For IE/FF z-index shenanigans. id attribute is required.

new dijit.BackgroundIframe(node).

Makes a background iframe as a child of node, that fills area (and position) of node

Parameter Type Description
node DomNode
effectiveTabIndex(elem)
Defined by dijit/a11y

Returns effective tabIndex of an element, either a number, or undefined if element isn't focusable.

Parameter Type Description
elem Element
Returns:undefined | number
focus(node)
Defined by dijit/focus
Parameter Type Description
node undefined
getBookmark()
Defined by dijit/_base/focus

Retrieves a bookmark that can be used with moveToBookmark to return to the same range

Returns:undefined
getDocumentWindow(doc)
Defined by dijit/_base/window
Parameter Type Description
doc undefined
getFirstInTabbingOrder(root,doc)
Defined by dijit/a11y

Finds the descendant of the specified root node that is first in the tabbing order

Parameter Type Description
root String | DOMNode
doc Document
Optional
Returns:undefined
getFocus(menu,openedForWindow)
Defined by dijit/_base/focus

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.

Parameter Type Description
menu Widget
Optional

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 Window
Optional

iframe in which menu was opened

Returns:any | object

A handle to restore focus/selection, to be passed to dijit.focus

getLastInTabbingOrder(root,doc)
Defined by dijit/a11y

Finds the descendant of the specified root node that is last in the tabbing order

Parameter Type Description
root String | DOMNode
doc Document
Optional
Returns:undefined
getPopupAroundAlignment(position,leftToRight)
Defined by dijit/_base/place

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/place.placeOnScreenAroundElement.

Parameter Type Description
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.

getViewport()
Defined by dijit/_base/place

Deprecated method to return the dimensions and scroll position of the viewable area of a browser window. New code should use windowUtils.getBox()

getWaiRole(elem)
Defined by dijit/_base/wai

Gets the role for an element (which should be a wai role).

Parameter Type Description
elem Element
Returns:any | undefined

The role of elem or an empty string if elem does not have a role.

getWaiState(elem,state)
Defined by dijit/_base/wai

Gets the value of a state on an element.

Checks for an attribute called "aria-"+state.

Parameter Type Description
elem Element
state String
Returns:any | string

The value of the requested state on elem or an empty string if elem has no value for state.

hasDefaultTabStop(elem)
Defined by dijit/a11y

Tests if element is tab-navigable even without an explicit tabIndex setting

Parameter Type Description
elem Element
Returns:undefined | boolean
hasWaiRole(elem,role)
Defined by dijit/_base/wai

Determines if an element has a particular role.

Parameter Type Description
elem Element
role String
Optional
Returns:any | boolean

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

hasWaiState(elem,state)
Defined by dijit/_base/wai

Determines if an element has a given state.

Checks for an attribute called "aria-"+state.

Parameter Type Description
elem Element
state String
Returns:any | boolean

true if elem has a value for the given state and false if it does not.

hideTooltip(aroundNode)
Defined by dijit/Tooltip

Static method to hide the tooltip displayed via showTooltip()

Parameter Type Description
aroundNode undefined
Returns:undefined
isCollapsed()
Defined by dijit/_base/focus

Returns true if there is no text selected

Returns:undefined
isFocusable(elem)
Defined by dijit/a11y

Tests if an element is focusable by tabbing to it, or clicking it with the mouse.

Parameter Type Description
elem Element
Returns:boolean
isTabNavigable(elem)
Defined by dijit/a11y

Tests if an element is tab-navigable

Parameter Type Description
elem Element
Returns:boolean
moveToBookmark(bookmark)
Defined by dijit/_base/focus

Moves current selection to a bookmark

Parameter Type Description
bookmark Object

This should be a returned object from dijit.getBookmark()

Returns:undefined
placeOnScreen(node,pos,corners,padding,layoutNode)
Defined by dijit/place

Positions node kitty-corner to the rectangle centered at (pos.x, pos.y) with width and height of padding.x 2 and padding.y 2, or zero if padding not specified. Picks first corner in corners[] where node is fully visible, or the corner where it's most visible.

Node is assumed to be absolutely or relatively positioned.

Parameter Type Description
node DOMNode

The node to position

pos dijit/place.__Position

Object like {x: 10, y: 20}

corners String[]

Array of Strings representing order to try corners of the node in, like ["TR", "BL"]. Possible values are:

  • "BL" - bottom left
  • "BR" - bottom right
  • "TL" - top left
  • "TR" - top right
padding dijit/place.__Position
Optional

Optional param to set padding, to put some buffer around the element you want to position. Defaults to zero.

layoutNode undefined

For things like tooltip, they are displayed differently (and have different dimensions) based on their orientation relative to the parent. This adjusts the popup based on orientation.

Returns:undefined

Examples

Example 1

Try to place node's top right corner at (10,20). If that makes node go (partially) off screen, then try placing bottom left corner at (10,20).

place(node, {x: 10, y: 20}, ["TR", "BL"])
placeOnScreenAroundElement(node,aroundNode,aroundCorners,layoutNode)
Defined by dijit/_base/place

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.

Parameter Type Description
node undefined
aroundNode undefined
aroundCorners undefined
layoutNode undefined
placeOnScreenAroundNode(node,aroundNode,aroundCorners,layoutNode)
Defined by dijit/_base/place

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.

Parameter Type Description
node undefined
aroundNode undefined
aroundCorners undefined
layoutNode undefined
placeOnScreenAroundRectangle(node,aroundRect,aroundCorners,layoutNode)
Defined by dijit/_base/place

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.

Parameter Type Description
node undefined
aroundRect undefined
aroundCorners undefined
layoutNode undefined
registerIframe(iframe)
Defined by dijit/_base/focus

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.

Currently only used by editor.

Parameter Type Description
iframe DomNode
Returns:any | undefined

Handle to pass to unregisterIframe()

registerWin(targetWindow,effectiveNode)
Defined by dijit/_base/focus

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.

Users should call registerIframe() instead of this method.

Parameter Type Description
targetWindow Window
Optional

If specified this is the window associated with the iframe, i.e. iframe.contentWindow.

effectiveNode DomNode
Optional

If specified, report any focus events inside targetWindow as an event on effectiveNode, rather than on evt.target.

Returns:any | undefined

Handle to pass to unregisterWin()

removeWaiRole(elem,role)
Defined by dijit/_base/wai

Removes the specified role from an element. Removes role attribute if no specific role provided (for backwards compat.)

Parameter Type Description
elem Element
role String
removeWaiState(elem,state)
Defined by dijit/_base/wai

Removes a state from an element.

Sets an attribute called "aria-"+state.

Parameter Type Description
elem Element
state String
scrollIntoView(node,pos)
Defined by dijit/_base/scroll

Scroll the passed node into view, if it is not already. Deprecated, use windowUtils.scrollIntoView instead.

Parameter Type Description
node DomNode
pos Object
Optional
selectInputText(element,start,stop)

Select text in the input element argument, from start (default 0), to stop (default end).

Parameter Type Description
element DomNode
start Number
Optional
stop Number
Optional
setWaiRole(elem,role)
Defined by dijit/_base/wai

Sets the role on an element.

Replace existing role attribute with new role.

Parameter Type Description
elem Element
role String
setWaiState(elem,state,value)
Defined by dijit/_base/wai

Sets a state on an element.

Sets an attribute called "aria-"+state.

Parameter Type Description
elem Element
state String
value String
showTooltip(innerHTML,aroundNode,position,rtl,textDir,onMouseEnter,onMouseLeave)
Defined by dijit/Tooltip

Static method to display tooltip w/specified contents in specified position. See description of dijit/Tooltip.defaultPosition for details on position parameter. If position is not specified then dijit/Tooltip.defaultPosition is used.

Parameter Type Description
innerHTML String

Contents of the tooltip

aroundNode Object

Specifies that tooltip should be next to this node / area

position String[]
Optional

List of positions to try to position tooltip (ex: ["right", "above"])

rtl Boolean
Optional

Corresponds to WidgetBase.dir attribute, where false means "ltr" and true means "rtl"; specifies GUI direction, not text direction.

textDir String
Optional

Corresponds to WidgetBase.textdir attribute; specifies direction of text.

onMouseEnter Function
Optional

Callback function for mouse over on tooltip

onMouseLeave Function
Optional

Callback function for mouse leave on tooltip

Returns:undefined
unregisterIframe(handle)
Defined by dijit/_base/focus

Unregisters listeners on the specified iframe created by registerIframe. After calling be sure to delete or null out the handle itself.

Parameter Type Description
handle Object

Handle returned by registerIframe()

unregisterWin(handle)
Defined by dijit/_base/focus

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.

Parameter Type Description
handle Handle
Error in the documentation? Can’t find what you are looking for? Let us know!