Skip to content

SebastienDaniel/domanip

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Functions

addClass(c, e)boolean
ascendUntil(e, c)object | undefined
descendUntil(e, c)object | undefined
removeClass(c, e)boolean
toggleClass(c1, e, [c2])boolean

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)

ParamTypeDescription
cstring

className to add

eobject

HTML element to affect

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

ParamTypeDescription
eobject

HTML element to start with

cfunction

condition test function which will recursively be called with an HTML element argument

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

ParamTypeDescription
eobject

HTML element to start with

cfunction

condition test function which will recursively be called with an HTML element argument

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)

ParamTypeDescription
cstring

className to add

eobject

HTML element to affect

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
ParamTypeDescription
c1string

first className to toggle (add, remove or replace if c2 provided)

eElement

HTML element to affect

[c2]string

second className to use in replacement of c1 or to be replaced by c1

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages