Skip to main content

DOM

Functions

addClass(ele, cls)void

Add a classname to the Element's list of classnames.

dom(cssSelector)DomQuery

Find all Elements that match the CSS Selector.

dom(htmlString)DomQuery

Creates new DOM elements from HTML text.

getClass(ele)String

Get the classname for the Element.

hasClass(elem, class)Boolean

Check if the Element has this classname.

removeClass(ele, cls)void

Remove a classname from an Elements classlist.

setClass(ele, cls)void

Sets the classname from an Element.

addClass(ele, cls) ⇒ void

Add a classname to the Element's list of classnames.

Kind: global function
Category: DOM
Access: public

ParamTypeDescription
eleelementThe Element to which the new class will be added
clsStringThe class to add to the Element

Example

pendo.dom.addClass(elem, 'foo')

dom(cssSelector) ⇒ DomQuery

Find all Elements that match the CSS Selector.

Kind: global function
Returns: DomQuery - array with the matching elements
Category: DOM
Access: public

ParamTypeDescription
cssSelectorstringCSS selector used to search DOM

Example

pendo.dom('h1')[0].remove()

Example

pendo.dom('.left').css({ 'text-align': 'center' })

dom(htmlString) ⇒ DomQuery

Creates new DOM elements from HTML text.

Kind: global function
Returns: DomQuery - array with the matching elements
Category: DOM
Access: public

ParamTypeDescription
htmlStringstringHTML syntax used to produce new DOM elements

Example

pendo.dom('<div><span>this should create an unattached DOM node</span></div>');

getClass(ele) ⇒ String

Get the classname for the Element.

Kind: global function
Category: DOM
Access: public

ParamTypeDescription
eleelementThe Element referenced for the classname.

Example

var elemClass = pendo.dom.getClass(elem);

hasClass(elem, class) ⇒ Boolean

Check if the Element has this classname.

Kind: global function
Category: DOM
Access: public

ParamTypeDescription
elemelementThe Element to test for the classname
classStringThe classname to look for on the element

Example

var hasFooClass = pendo.dom.hasClass(elem, 'foo');

removeClass(ele, cls) ⇒ void

Remove a classname from an Elements classlist.

Kind: global function
Category: DOM
Access: public

ParamTypeDescription
eleelementThe Element from which the class will be removed
clsStringThe class to be removed

Example

pendo.dom.removeClass(elem, 'foo')

setClass(ele, cls) ⇒ void

Sets the classname from an Element.

Kind: global function
Category: DOM
Access: public

ParamTypeDescription
eleelementThe Element that will get the new classlist.
clsStringThe classname that will be set.

Example

pendo.dom.setClass(elem, 'foo bar baz')