Namespace: Element

jMod. Element

Since:
  • 0.0.15

Methods

staticjMod.Element.addClass(el, className){Element}

F:/Projects/jMod/main/bin/jMod.full.js, line 2431
Add a class to a DOM Element
Name Type Description
el Element DOM Element
className string Class name to add
Returns:
Type Description
Element The input element

staticjMod.Element.addClasses(el, classNames){Element}

F:/Projects/jMod/main/bin/jMod.full.js, line 2445
Add multiple classes to a DOM Element
Name Type Description
el Element DOM Element
classNames Array.<string> | string Class names to add
Returns:
Type Description
Element The input element

staticjMod.Element.appendChild(el, data){Element}

F:/Projects/jMod/main/bin/jMod.full.js, line 2506
Append a child to a DOM Element. The input can be an a simple element or string. It can be an object containing Element information createNewElement. Additionally, it can be an array of any of the preciously mentioned types.
Name Type Description
el Element DOM Element
data Element | object | string | * Child
See:
  • createNewElement
Returns:
Type Description
Element The input element

staticjMod.Element.createNewElement(data){Element}

F:/Projects/jMod/main/bin/jMod.full.js, line 2597
Create a new DOM element
Name Type Description
data jMod.Element.NewElementData Element information
Returns:
Type Description
Element The newly created element

staticjMod.Element.hasClass(el, className){boolean}

F:/Projects/jMod/main/bin/jMod.full.js, line 2391
Check if a DOM element has a particular class
Name Type Description
el Element DOM Element
className string Class to check for
Returns:
Type Description
boolean

staticjMod.Element.hasClasses(el, classNames){Array.<string>}

F:/Projects/jMod/main/bin/jMod.full.js, line 2403
Check if a DOM element has one or more of the class names given as the second parameter
Name Type Description
el Element DOM Element
classNames Array.<string> | string Class names to check for
Returns:
Type Description
Array.<string> Array of strings containing the matching classes

staticjMod.Element.isElement(obj){boolean}

F:/Projects/jMod/main/bin/jMod.full.js, line 623
Check if input is a DOM element
Name Type Description
obj * Input to be checked
Returns:
Type Description
boolean

staticjMod.Element.missingClasses(el, classNames){Array.<string>}

F:/Projects/jMod/main/bin/jMod.full.js, line 2417
Check if a DOM element is missing one or more of the class names given as the second parameter
Name Type Description
el Element DOM Element
classNames Array.<string> | string Class names to check for
Returns:
Type Description
Array.<string> Array of strings containing the missing class names

staticjMod.Element.removeClass(el, className){Element}

F:/Projects/jMod/main/bin/jMod.full.js, line 2458
Remove a class from a DOM Element
Name Type Description
el Element DOM Element
className string Class name to remove
Returns:
Type Description
Element The input element

staticjMod.Element.removeClasses(el, classNames){Element}

F:/Projects/jMod/main/bin/jMod.full.js, line 2470
Remove multiple classes from a DOM Element
Name Type Description
el Element DOM Element
classNames Array.<string> | string Class names to remove
Returns:
Type Description
Element The input element

Type Definitions

jMod.Element.NewElementCallbackDataObject

Data for event listeners when creating new elements
Properties:
Name Type Argument Default Description
callback function Callback function
capture boolean <optional>
false Use capture
See:
  • createNewElement

jMod.Element.NewElementDataObject

Data for creating a new element
Properties:
Name Type Argument Description
type string The element type to be created (ex. div, h1, etc...)
id string <optional>
Element id
className string <optional>
Class name(s)
class string <optional>
Synonym for className
style string <optional>
Style to be applied to the new element
innerHTML Element | Array.<Element> | string | Array.<string> | object | Array.<object> <optional>
Child element(s) to append to the new element
text Element | Array.<Element> | string | Array.<string> | object | Array.<object> <optional>
Synonym for innerHTML
attributes object <optional>
Key-value list of attributes to be added to the new element
EventListeners object.<string, jMod.Element.NewElementCallbackData> <optional>
Key-value list of Events Names and Callback information to be added to the new element
eventListeners object <optional>
Synonym for EventListeners
Events object <optional>
Synonym for EventListeners
events object <optional>
Synonym for EventListeners
Listeners object <optional>
Synonym for EventListeners
listeners object <optional>
Synonym for EventListeners
See:
  • createNewElement