Element

Document Object Model extensions.

Credits

Partially based on MooTools, My Object Oriented Javascript Tools.  Copyright © 2006-2007 Valerio Proietti, http://mad4milk.net, MIT Style License.  Partially based on Prototype JavaScript framework, version 1.6.0 © 2005-2007 Sam Stephenson.  Prototype is freely distributable under the terms of an MIT-style license.  For details, see the Prototype web site: http://www.prototypejs.org/

Summary
ElementDocument Object Model extensions.
Content manipulation methods
addContent
setTextSets the inner text of the Element.
appendTextAdds a new text node at the end of the element’s existing content
setHTMLSets the innerHTML of the Element.
Class manipulation methods
hasClassNameChecks whether element has the given CSS className.
addClassNameAdds a CSS class to element.
removeClassNameRemoves element’s CSS className and returns element.
DOM manipulation methods
getParentreturn a reference to the element’s parent node
getChildrenreturn a collection of the element’s child nodes
emptyEmpty an element of all its children.
hideHides and returns element.
showDisplays and returns element.
toggleToggles the visibility of element.
removeCompletely removes element from the document and returns it.
getDimensionsFinds the computed width and height of element and returns them as key/value pairs of an object.
setStyleModifies element’s CSS style properties.
injectInsert the Element inside the passed element
Events manipulation methods

Content manipulation methods

addContent

addContent: function(content)

Status

Documented in UWA 1.0to be deprecated

setText

setText: function(text)

Sets the inner text of the Element.

From MooTools

Status

Documented in UWA 1.0

appendText

appendText: function(text)

Adds a new text node at the end of the element’s existing content

Status

Documented in UWA 1.0

setHTML

setHTML: function(html)

Sets the innerHTML of the Element.

In MooTools

Status

Documented in UWA 1.0

Class manipulation methods

hasClassName

hasClassName: function(className)

Checks whether element has the given CSS className.

  • From Prototype, code derived from MooTools

Status

Documented in UWA 1.0

addClassName

addClassName: function(className)

Adds a CSS class to element.

  • From Prototype, code derived from MooTools

Status

Documented in UWA 1.0

removeClassName

removeClassName: function(className)

Removes element’s CSS className and returns element.

  • From Prototype, code derived from MooTools

Status

Documented in UWA 1.0

DOM manipulation methods

getParent

getParent: function()

return a reference to the element’s parent node

  • In Mootools

Status

Documented in UWA 1.0

getChildren

getChildren: function()

return a collection of the element’s child nodes

  • In Mootools

Status

Documented in UWA 1.0

empty

empty: function()

Empty an element of all its children.

  • From MooTools

Status

Documented in UWA 1.0

hide

hide: function()

Hides and returns element.

  • From Prototype

Status

Documented in UWA 1.0

show

show: function()

Displays and returns element.

  • From Prototype

Status

Documented in UWA 1.0

toggle

toggle: function()

Toggles the visibility of element.

  • From Prototype

Status

Documented in UWA 1.0to deprecate

remove

remove: function()

Completely removes element from the document and returns it.

  • From Prototype, code from MooTools (dispose)

Status

Documented in UWA 1.0

getDimensions

getDimensions: function()

Finds the computed width and height of element and returns them as key/value pairs of an object.

  • From Prototype

Status

Documented in UWA 1.0

setStyle

setStyle: function(style)

Modifies element’s CSS style properties.  Styles are passed as either a hash or a name/value pair.

Status

Documented in UWA 1.0

inject

inject: function(el,
where)

Insert the Element inside the passed element

  • From MooTools
  • also in Prototype : insert

Status

Introduced in UWA 1.2 (ginger)

Events manipulation methods

addContent: function(content)
setText: function(text)
Sets the inner text of the Element.
appendText: function(text)
Adds a new text node at the end of the element’s existing content
setHTML: function(html)
Sets the innerHTML of the Element.
hasClassName: function(className)
Checks whether element has the given CSS className.
addClassName: function(className)
Adds a CSS class to element.
removeClassName: function(className)
Removes element’s CSS className and returns element.
getParent: function()
return a reference to the element’s parent node
getChildren: function()
return a collection of the element’s child nodes
empty: function()
Empty an element of all its children.
hide: function()
Hides and returns element.
show: function()
Displays and returns element.
toggle: function()
Toggles the visibility of element.
remove: function()
Completely removes element from the document and returns it.
getDimensions: function()
Finds the computed width and height of element and returns them as key/value pairs of an object.
setStyle: function(style)
Modifies element’s CSS style properties.
inject: function(el,
where)
Insert the Element inside the passed element