This module defines the core dojo DOM geometry API.
See the dojo/dom-geometry reference documentation for more information.
Returns an object with {node, x, y} with corresponding offsets.
Parameter | Type | Description |
---|---|---|
doc | Document |
Optional Optional document to query. If unspecified, use win.doc. |
In RTL direction, scrollLeft should be a negative value, but IE returns a positive one. All codes using documentElement.scrollLeft must call this function to fix this error, otherwise the position will offset to right when there is a horizontal scrollbar.
Parameter | Type | Description |
---|---|---|
scrollLeft | Number | |
doc | Document |
Optional Optional document to query. If unspecified, use win.doc. |
returns an object with properties useful for noting the border dimensions.
The w/h are used for calculating boxes. Normally application code will not need to invoke this directly, and will use the ...box... functions instead.
Parameter | Type | Description |
---|---|---|
node | DOMNode | |
computedStyle | Object |
Optional This parameter accepts computed styles object. If this parameter is omitted, the functions will call dojo/dom-style.getComputedStyle to get one. It is a better way, calling dojo/dom-style.getComputedStyle once, and then pass the reference to this computedStyle parameter. Wherever possible, reuse the returned object of dojo/dom-style.getComputedStyle(). |
Returns an object that encodes the width, height, left and top positions of the node's content box, irrespective of the current box model.
Parameter | Type | Description |
---|---|---|
node | DOMNode | |
computedStyle | Object |
Optional This parameter accepts computed styles object. If this parameter is omitted, the functions will call dojo/dom-style.getComputedStyle to get one. It is a better way, calling dojo/dom-style.getComputedStyle once, and then pass the reference to this computedStyle parameter. Wherever possible, reuse the returned object of dojo/dom-style.getComputedStyle(). |
returns the offset in x and y from the document body to the visual edge of the page for IE
The following values in IE contain an offset:
event.clientX event.clientY node.getBoundingClientRect().left node.getBoundingClientRect().top
But other position related values do not contain this offset,
such as node.offsetLeft, node.offsetTop, node.style.left and node.style.top. The offset is always (2, 2) in LTR direction. When the body is in RTL direction, the offset counts the width of left scroll bar's width. This function computes the actual offset.
Parameter | Type | Description |
---|---|---|
doc | Document |
Optional Optional document to query. If unspecified, use win.doc. |
returns an object that encodes the width, height, left and top positions of the node's margin box.
Parameter | Type | Description |
---|---|---|
node | DOMNode | |
computedStyle | Object |
Optional This parameter accepts computed styles object. If this parameter is omitted, the functions will call dojo/dom-style.getComputedStyle to get one. It is a better way, calling dojo/dom-style.getComputedStyle once, and then pass the reference to this computedStyle parameter. Wherever possible, reuse the returned object of dojo/dom-style.getComputedStyle(). |
returns object with properties useful for box fitting with regards to box margins (i.e., the outer-box).
The w/h are used for calculating boxes. Normally application code will not need to invoke this directly, and will use the ...box... functions instead.
Parameter | Type | Description |
---|---|---|
node | DOMNode | |
computedStyle | Object |
Optional This parameter accepts computed styles object. If this parameter is omitted, the functions will call dojo/dom-style.getComputedStyle to get one. It is a better way, calling dojo/dom-style.getComputedStyle once, and then pass the reference to this computedStyle parameter. Wherever possible, reuse the returned object of dojo/dom-style.getComputedStyle(). |
returns an object that encodes the width and height of the node's margin box
Parameter | Type | Description |
---|---|---|
node | DOMNode | String | |
computedStyle | Object |
Optional This parameter accepts computed styles object. If this parameter is omitted, the functions will call dojo/dom-style.getComputedStyle to get one. It is a better way, calling dojo/dom-style.getComputedStyle once, and then pass the reference to this computedStyle parameter. Wherever possible, reuse the returned object of dojo/dom-style.getComputedStyle(). |
Returns object with properties useful for box fitting with regards to padding.
The w/h are used for calculating boxes. Normally application code will not need to invoke this directly, and will use the ...box... functions instead.
Parameter | Type | Description |
---|---|---|
node | DOMNode | |
computedStyle | Object |
Optional This parameter accepts computed styles object. If this parameter is omitted, the functions will call dojo/dom-style.getComputedStyle to get one. It is a better way, calling dojo/dom-style.getComputedStyle once, and then pass the reference to this computedStyle parameter. Wherever possible, reuse the returned object of dojo/dom-style.getComputedStyle(). |
Returns object with special values specifically useful for node fitting.
Returns an object with w
, h
, l
, t
properties:
l/t/r/b = left/top/right/bottom padding (respectively) w = the total of the left and right padding h = the total of the top and bottom padding
If 'node' has position, l/t forms the origin for child nodes.
The w/h are used for calculating boxes. Normally application code will not need to invoke this directly, and will use the ...box... functions instead.
Parameter | Type | Description |
---|---|---|
node | DOMNode | |
computedStyle | Object |
Optional This parameter accepts computed styles object. If this parameter is omitted, the functions will call dojo/dom-style.getComputedStyle to get one. It is a better way, calling dojo/dom-style.getComputedStyle once, and then pass the reference to this computedStyle parameter. Wherever possible, reuse the returned object of dojo/dom-style.getComputedStyle(). |
Returns true if the current language is left-to-right, and false otherwise.
Parameter | Type | Description |
---|---|---|
doc | Document |
Optional Optional document to query. If unspecified, use win.doc. |
Normalizes the geometry of a DOM event, normalizing the pageX, pageY, offsetX, offsetY, layerX, and layerX properties
Parameter | Type | Description |
---|---|---|
event | Object |
Gets the position and size of the passed element relative to the viewport (if includeScroll==false), or relative to the document root (if includeScroll==true).
Returns an object of the form:
{ x: 100, y: 300, w: 20, h: 15 }
.
If includeScroll==true, the x and y values will include any
document offsets that may affect the position relative to the
viewport.
Uses the border-box model (inclusive of border and padding but
not margin). Does not act as a setter.
Parameter | Type | Description |
---|---|---|
node | DOMNode | String | |
includeScroll | Boolean |
Optional
|
Sets the size of the node's contents, irrespective of margins, padding, or borders.
Parameter | Type | Description |
---|---|---|
node | DOMNode | |
box | Object | hash with optional "w", and "h" properties for "width", and "height" respectively. All specified properties should have numeric values in whole pixels. |
computedStyle | Object |
Optional This parameter accepts computed styles object. If this parameter is omitted, the functions will call dojo/dom-style.getComputedStyle to get one. It is a better way, calling dojo/dom-style.getComputedStyle once, and then pass the reference to this computedStyle parameter. Wherever possible, reuse the returned object of dojo/dom-style.getComputedStyle(). |
sets the size of the node's margin box and placement (left/top), irrespective of box model. Think of it as a passthrough to setBox that handles box-model vagaries for you.
Parameter | Type | Description |
---|---|---|
node | DOMNode | |
box | Object | hash with optional "l", "t", "w", and "h" properties for "left", "right", "width", and "height" respectively. All specified properties should have numeric values in whole pixels. |
computedStyle | Object |
Optional This parameter accepts computed styles object. If this parameter is omitted, the functions will call dojo/dom-style.getComputedStyle to get one. It is a better way, calling dojo/dom-style.getComputedStyle once, and then pass the reference to this computedStyle parameter. Wherever possible, reuse the returned object of dojo/dom-style.getComputedStyle(). |