utils

Methods

(static) _hasClass(element, className) → {boolean}

Source:

Provides an ability to check if a DOM element contains a class string

Parameters:
Name Type Description
element
className
Returns:
Type
boolean

(static) addClass(element, className) → {Object|*}

Source:

App/Append new class string to the provided DOM element

Parameters:
Name Type Description
element
className
Returns:
Type
Object | *

(static) closest(element, selector) → {null|ParentNode}

Source:

Iterate up the tree of DOM elements to find the closes match

Parameters:
Name Type Description
element
selector
Returns:
Type
null | ParentNode

(static) formatNumberLeadingZeros(num, size) → {string}

Source:

Prepends 0 the provided number and returns the formated element as a string

Parameters:
Name Type Description
num
size number
Returns:

1 => 001

Type
string

(static) isElement(o) → {Boolean}

Source:

Returns true if it is a DOM element

Parameters:
Name Type Description
o Object
Returns:
Type
Boolean

(static) objectCount()

Source:

Returns a count of object from a query result

(static) objectIterator(obj, callback)

Source:

Object iterator - best usage is for a list of DOM elements

Parameters:
Name Type Description
obj
callback

(static) query("optional", CSS) → {Object|null|Array}

Source:

Query selector, supports CSS element selection

Supports:

  • Class selection: ".element"
  • ID selection: "#element"
  • Tag selection: "div"
  • Multi depth selection: '.element ul li'
Parameters:
Name Type Description
"optional" Object
CSS String

element selector

Returns:

depending on the provided selector results can vary (null, node, NodeList array)

Type
Object | null | Array

(static) remove()

Source:

Removes an HTML DOM element

(static) removeClass(element, className) → {Object|*}

Source:

Remove class string from provided DOM element

Parameters:
Name Type Description
element
className
Returns:
Type
Object | *

(static) scrollEnabled(doc) → {boolean}

Source:

Check if scrolling is enabled

Parameters:
Name Type Description
doc
Returns:
Type
boolean

(static) sizeof(obj) → {Number}

Source:

returns the size of an Object or array

Parameters:
Name Type Description
obj Object
Returns:
Type
Number

(static) stringContains(str, partial) → {boolean}

Source:

A check if a string contains an entry of searched for term

Parameters:
Name Type Description
str string
partial string
Returns:
Type
boolean

(static) stripHtml(html) → {string|string}

Source:

Removes HTML tags from the provided input and returns only the text

  • this is a very basic implementation and should be used carefully
Parameters:
Name Type Description
html string
Returns:
Type
string | string