domanip
v1.0.9
Published
Utility functions for manipulating the DOM
Downloads
3
Maintainers
Readme
Functions
addClass(c, e) ⇒ boolean
Kind: global function
Summary: add a CSS class to an HTML element
Returns: boolean - - whether the className has been added or not (returns false if className was already present)
ascendUntil(e, c) ⇒ object | undefined
Kind: global function
Summary: traverses the DOM by traveling up parentNodes until the provided condition returns true
Returns: object | undefined - node where condition is true, otherwise undefined
descendUntil(e, c) ⇒ object | undefined
Kind: global function
Summary: traverses the DOM by traveling down childNodes, iteratively, until the provided condition returns true
Returns: object | undefined - node where condition is true, otherwise undefined
removeClass(c, e) ⇒ boolean
Kind: global function
Summary: remove a CSS class from an HTMl element
Returns: boolean - - whether the className has been removed or not (returns false if className wasn't present)
toggleClass(c1, e, [c2]) ⇒ boolean
Kind: global function
Summary: Toggles the provided className based on following conditions:
if className present on element, replace it with second provided className, otherwise remove it.
if className not present on element, add it.
if second className present on element, replace it with first className.
Returns: boolean - - success of operation