|
PHP2Go Javascript Framework | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
Object | +--Element
Element
Defined in dom.js
| Field Summary | |
<private> Object |
elm
|
<static> Number |
BORDER_BOX
Border box |
<static> Number |
CONTENT_BOX
Content box |
<static> Number |
MARGIN_BOX
Margin box |
<static> Number |
PADDING_BOX
Padding box |
| Constructor Summary | |
Element
(name, parent, style, html, attrs)
The Element class contains methods that can be applied to any DOM element through the $ and $E functions |
|
| Method Summary | |
Object
|
addClass(<String> cl)
Adds a CSS class on the element |
Object
|
clear(<Boolean> useDom)
Remove all HTML contents from the element |
Boolean
|
empty()
Verify if the element is empty |
Number
|
getBorder(<String> side)
Get the element's border value for a given side |
Object
|
getBorderBox()
Get the element's border box |
Array
|
getChildNodes()
Collects the element's child nodes, skipping all text nodes. |
String
|
getComputedStyle(<String> prop)
Retrieves the computed value of a given style property |
Object
|
getComputedStyles()
Gets all computed styles of the element |
Object
|
getDimensions()
Get the dimensions of the element. |
Array
|
getElementsByClassName(clsNames)
Search for all elements that match the given set of class names |
String
|
getInnerText()
Collects the contents of all text nodes inside the element |
Array
|
getNextSiblings()
Get the element's next siblings |
Number
|
getOpacity()
Gets the element's opacity level. |
Object
|
getPaddingBox()
Get the element's padding box |
Object
|
getParentByTagName(<String> tag)
Finds an element's ancestor by tag name |
Array
|
getParentNodes()
Collects the ancestor nodes of the element |
Object
|
getPosition(<Number> tbt)
Retrieve the absolute position of the element. |
Array
|
getPreviousSiblings()
Get the element's previous siblings |
Array
|
getSiblings()
Get all element's siblings |
Object
|
getStyle(<String> prop)
Reads a style property of the element. |
String
|
getTag()
Get the element's tag |
Boolean
|
hasAttribute(<String> attr)
Checks if the element has a given attribute. |
Boolean
|
hasClass(<String> cl)
Checks if the element contains a given CSS class |
Object
|
hide()
Hides the element |
Object
|
insert(<String> ins, position, <Boolean> evalScripts)
Inserts HTML code inside the element. |
Object
|
insertAfter(ref)
Insert the node after a given reference node. |
Boolean
|
isChildOf(<Object> anc)
Checks if the element is child of a given element |
Boolean
|
isVisible()
Verify if the element is visible |
Object
|
isWithin(<Object> p1, <Object> p2)
Checks if the element is within a given pair of coordinates. |
Object
|
moveTo(<Number> x, <Number> y)
Moves the element to the given x and y coordinates |
Object
|
readAttribute(<String> attr)
Reads the value of an element's attribute |
Array
|
recursivelyCollect(<String> prop)
Recursively collects elements associated by the 'prop' property |
Number
|
recursivelySum(<String> prop)
Recursively sums the values of a given property on all ancestors of the element |
Object
|
remove()
Remove the element from its parent node |
Object
|
removeClass(<String> cl)
Removes a CSS class from the element |
Object
|
replace(<Object> rep, evalScripts)
Replaces the element with the given HTML code |
Object
|
resizeTo(<Number> w, <Number> h)
Resizes the element to the given width and height values |
Object
|
scrollTo()
Scrolls the window to the element's position |
Object
|
setInnerText(<String> text)
Defines the text content of the element |
Object
|
setOpacity(<Number> op)
Sets the element's opacity level. |
Object
|
setParentNode(<Object> p)
Sets the element's parent node. |
Object
|
setStyle(<Object> prop, <Object> value)
Set one or more style properties of the element |
Object
|
show()
Shows the element |
Object
|
swapStyles(<Object> props, <Function> func)
Swaps in/out style properties in order to call a given function |
Object
|
toggleClass(<String> cl)
Adds/removes a CSS class on the element |
Object
|
toggleDisplay()
Toggles the element's visibility |
Object
|
update(<Object> upd, <Boolean> evalScripts, <Boolean> useDom)
Set the HTML contents of the element. |
Object
|
writeAttribute(<Object> attr, <Object> value)
Writes one or more element's attributes |
<static> void
|
extend(<Object> props)
Adds a list of methods to the element extensions. |
| Field Detail |
<private> Object elm
<static> Number BORDER_BOX
<static> Number CONTENT_BOX
<static> Number MARGIN_BOX
<static> Number PADDING_BOX
| Constructor Detail |
Element(name, parent, style, html, attrs)
| Method Detail |
Object addClass(<String> cl)
cl - CSS class
Object clear(<Boolean> useDom)
useDom - Whether to use DOM or not
Boolean empty()
Number getBorder(<String> side)
side - Border side (top, right, bottom or left)
Object getBorderBox()
Array getChildNodes()
String getComputedStyle(<String> prop)
prop - Property name
Object getComputedStyles()
Object getDimensions()
Array getElementsByClassName(clsNames)
clsName - CSS class names (one or more, space separated)
String getInnerText()
Array getNextSiblings()
Number getOpacity()
Object getPaddingBox()
Object getParentByTagName(<String> tag)
tag - Tag to be searched
Array getParentNodes()
Object getPosition(<Number> tbt)
tbt - Box type (0, 1, 2 or 3)
Array getPreviousSiblings()
Array getSiblings()
Object getStyle(<String> prop)
prop - Property name
String getTag()
Boolean hasAttribute(<String> attr)
attr - Attribute name
Boolean hasClass(<String> cl)
cl - CSS class
Object hide()
Object insert(<String> ins, position, <Boolean> evalScripts)
ins - HTML or element to insert
evalScripts - Whether to eval scripts. Defaults to false
pos - Insertion position. Defaults to "bottom"
Object insertAfter(ref)
Object - ] ref Reference node
Boolean isChildOf(<Object> anc)
anc - Ancestor element
Boolean isVisible()
Object isWithin(<Object> p1, <Object> p2)
p1 - Top-left coordinate
p2 - Bottom-right coordinate
Object moveTo(<Number> x, <Number> y)
x - X coordinate
y - Y coordinate
Object readAttribute(<String> attr)
attr - Attribute name
Array recursivelyCollect(<String> prop)
prop - Property
Number recursivelySum(<String> prop)
prop - Property name
Object remove()
Object removeClass(<String> cl)
cl - CSS class
Object replace(<Object> rep, evalScripts)
rep - Replacement code or element
eval - Whether to eval scripts. Defaults to false
Object resizeTo(<Number> w, <Number> h)
w - Width
h - Height
Object scrollTo()
Object setInnerText(<String> text)
text - Text content
Object setOpacity(<Number> op)
op - Opacity level
Object setParentNode(<Object> p)
p - New parent
Object setStyle(<Object> prop, <Object> value)
prop - Hash of properties or property name
value - Property value
Object show()
Object swapStyles(<Object> props, <Function> func)
props - Style properties
func - Function to be called
Object toggleClass(<String> cl)
cl - CSS class
Object toggleDisplay()
Object update(<Object> upd, <Boolean> evalScripts, <Boolean> useDom)
upd - HTML or element to update with
evalScripts - Whether to eval scripts. Defaults to false
useDom - Whether to use DOM. Defaults to false
Object writeAttribute(<Object> attr, <Object> value)
attr - Attribute name or attributes hash
value - Attribute value
<static> void extend(<Object> props)
props - New methods
|
PHP2Go Javascript Framework | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||