Namespace py.dom
Defined in: dom.js.
| Constructor Attributes | Constructor Name and Description |
|---|---|
|
Dom utilities
|
| Method Attributes | Method Name and Description |
|---|---|
| <private> <static> |
py.dom._getOffsets(el)
return real position on the screen
|
| <static> |
py.dom.attr(el, attr, val)
Set or get attribute(s) of an elements
|
| <static> |
py.dom.byId(id)
Get element by ID
|
| <static> |
py.dom.byName(name)
Returns elements by name (fixed version)
|
| <static> |
py.dom.create(tag, obj)
Create an Element
|
| <static> |
py.dom.destroyElement(node)
Destroy a node (remove it completely from the DOM)
|
| <static> |
py.dom.getInnerLayout(element, cs)
Get box layout (inner size without padding and borders)
|
| <static> |
py.dom.getOuterLayout(element, cs)
Get box layout including padding, borders, and margins
|
| <static> |
py.dom.layout(el, method, set_values)
Get or set size of a node
|
| <static> |
py.dom.setInnerLayout(element, values, cs)
Set box layout excluding padding, borders and margin
|
| <static> |
py.dom.setOuterLayout(element, values, cs)
Set box layout including padding, borders and margin
|
| <static> |
py.dom.style(el, if, val)
Set or get style(s) from an element
|
Method Detail
<private> <static>
{Int[]}
py.dom._getOffsets(el)
return real position on the screen
- Parameters:
- {Element} el
- Returns:
- {Int[]} left and top offset
- See:
- http://www.quirksmode.org/js/findpos.html
<static>
py.dom.attr(el, attr, val)
Set or get attribute(s) of an elements
- Parameters:
- {String|Element} el
- the node or node id
- {Object|Array|String} attr
- If it's an object, it will set all pairs to the node. If it's an array, it will return an object of attributes values. if it's a string, it will return the value or set the new one if last param val is specified
- val Optional
- used when set one attribute
<static>
{Element}
py.dom.byId(id)
Get element by ID
- Returns:
- {Element} node found or Null
<static>
{Element[]}
py.dom.byName(name)
Returns elements by name (fixed version)
Defined in: document.js.
Defined in: document.js.
- Parameters:
- {String} name
- Node name
- Returns:
- {Element[]} Array of nodes
<static>
{Element}
py.dom.create(tag, obj)
Create an Element
- Parameters:
- {String} tag
- Tag name
- {Object|String} obj Optional
- attributes of the node, or a string for content of the node
- Returns:
- {Element} created element
<static>
py.dom.destroyElement(node)
Destroy a node (remove it completely from the DOM)
<static>
py.dom.getInnerLayout(element, cs)
Get box layout (inner size without padding and borders)
<static>
py.dom.getOuterLayout(element, cs)
Get box layout including padding, borders, and margins
<static>
py.dom.layout(el, method, set_values)
Get or set size of a node
- Parameters:
- {String|Element} el
- The node
- {String} method Optional, Default: 'outer'
- The type of size, can be 'inner' or 'outer'
- {Object} set_values Optional
- Use this method as a setter, give sizes as an object
<static>
py.dom.setInnerLayout(element, values, cs)
Set box layout excluding padding, borders and margin
- Parameters:
- {Element} element
- {Object} values
- {Integer} values.w Optional
- width
- {Integer} values.h Optional
- height
- {Integer} values.l Optional
- left position relative to screen
- {Integer} values.t Optional
- top position relative to screen
- {Object} cs Optional
- Computed styles
<static>
py.dom.setOuterLayout(element, values, cs)
Set box layout including padding, borders and margin
- Parameters:
- {Element} element
- {Object} values
- {Integer} values.w Optional
- width
- {Integer} values.h Optional
- height
- {Integer} values.l Optional
- left position relative to screen
- {Integer} values.t Optional
- top position relative to screen
- {Object} cs Optional
- Computed styles
<static>
py.dom.style(el, if, val)
Set or get style(s) from an element
- Parameters:
- {String|Element} el
- The node
- {Object|Array|String} if
- it's an object, it will set all pairs to the node style. If it's an array, it will return an object of styles values. if it's a string, it will return the value or set the new one if last param val is specified
- val Optional
- used when set one style