Class Element
Defined in: element.js.
| Constructor Attributes | Constructor Name and Description |
|---|---|
|
Element()
The Element prototype
|
| Field Attributes | Field Name and Description |
|---|---|
| <private> |
| Method Attributes | Method Name and Description |
|---|---|
| <private> |
__getitem__(k)
Get node attribute
|
| <private> |
__setitem__(k, v)
Set node attribute
|
|
addClass(str)
Add a class to an element
|
|
|
attr(attribute, value)
Get or set node attribute
|
|
|
connect(event_name, scope, func)
connect a function to an element's event
|
|
|
contains(n)
Check if an element is parent of another node
|
|
|
fire(name, properties)
Fire an arbitrary event
|
|
|
Get computed styles
|
|
|
getStyle(property)
Get Computed style
|
|
|
getStyles(styles)
Get multiples styles
|
|
|
hasClass(str)
Return true if the element has the class
|
|
|
isIn(n)
Check in an element is child of another node
|
|
|
query(selectors)
Select an array of nodes with CSS2 selector inside the element
|
|
|
setStyle(property, value)
Set style
|
|
|
setStyles(styles)
Set multiples styles
|
Field Detail
<private>
__name__
Method Detail
<private>
__getitem__(k)
Get node attribute
- Parameters:
- {String} k
- attribute name
- Returns:
- attribute value
<private>
__setitem__(k, v)
Set node attribute
- Parameters:
- {String} k
- attribute name
- v
- attribute value
addClass(str)
Add a class to an element
- Parameters:
- {String} str
- Class name to add
attr(attribute, value)
Get or set node attribute
- Parameters:
- {String} attribute
- attribute name
- value Optional
- attribute value
- Returns:
- attribute value or undefined
{py.event.Handler}
connect(event_name, scope, func)
connect a function to an element's event
- Parameters:
- {String} event_name
- The event name, NOT starting with 'on'
- {Object|Function} scope
- Scope object or function to execute
- {Function|String} func Optional
- the function to execute
- Returns:
- {py.event.Handler} Handler, needed to disconnect
{Boolean}
contains(n)
Check if an element is parent of another node
- Returns:
- {Boolean}
fire(name, properties)
Fire an arbitrary event
- Parameters:
- {String} name
- The event name, NOT starting with 'on'
- {Object} properties Optional
- Properties of the event
{Object}
getComputedStyle()
Get computed styles
- Returns:
- {Object} Computed styles
{String}
getStyle(property)
Get Computed style
- Parameters:
- {String} property
- to get (no camel case)
- Returns:
- {String} Css property
getStyles(styles)
Get multiples styles
- Parameters:
- {String[]} styles
- styles to get
- See:
- Element.getStyle
{Boolean}
hasClass(str)
Return true if the element has the class
- Parameters:
- {String} str
- Class name to test
- Returns:
- {Boolean}
{Boolean}
isIn(n)
Check in an element is child of another node
- Returns:
- {Boolean}
{Element[]}
query(selectors)
Select an array of nodes with CSS2 selector inside the element
- Parameters:
- {String} selectors
- CSS2 selectors (separated by comma)
- Returns:
- {Element[]} Array of nodes (possibly empty)
setStyle(property, value)
Set style
setStyles(styles)
Set multiples styles
- Parameters:
- {Object} styles
- Styles to apply
- See:
- Element.setStyle