DOM
addClass(ele, cls) ⇒ void
Add a classname to the Element's list of classnames.
Param | Type | Description |
---|---|---|
ele | element | The Element to which the new class will be added |
cls | String | The class to add to the Element |
Example
pendo.dom.addClass(elem, 'foo')
dom(cssSelector) ⇒ DomQuery
Find all Elements that match the CSS Selector.
Returns: DomQuery
- array with the matching elements
Param | Type | Description |
---|---|---|
cssSelector | string | CSS 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.
Returns: DomQuery
- array with the matching elements
Param | Type | Description |
---|---|---|
htmlString | string | HTML 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.
Param | Type | Description |
---|---|---|
ele | element | The Element referenced for the classname. |
Example
var elemClass = pendo.dom.getClass(elem);
hasClass(elem, class) ⇒ Boolean
Check if the Element has this classname.
Param | Type | Description |
---|---|---|
elem | element | The Element to test for the classname |
class | String | The 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.
Param | Type | Description |
---|---|---|
ele | element | The Element from which the class will be removed |
cls | String | The class to be removed |
Example
pendo.dom.removeClass(elem, 'foo')
setClass(ele, cls) ⇒ void
Sets the classname from an Element.
Param | Type | Description |
---|---|---|
ele | element | The Element that will get the new classlist. |
cls | String | The classname that will be set. |
Example
pendo.dom.setClass(elem, 'foo bar baz')