Skip to content

Latest commit

 

History

History
332 lines (229 loc) · 11.1 KB

docs.md

File metadata and controls

332 lines (229 loc) · 11.1 KB

Quantdom

Kind: global class

quantdom.each(handler)

executes a function on each iteration on the list of elements.

Kind: instance method of Quantdom

Param Type Description
handler function A function to run on each iteration

quantdom.exists() ⇒ boolean

checks if element exists by checking the elements nodelist length & is an alias for exists i.e. $('.selector').exists

Kind: instance method of Quantdom
Returns: boolean - returns true if element exists

quantdom.parent() ⇒ Quantdom

returns the parent of the first element that matches the selector

Kind: instance method of Quantdom
Returns: Quantdom - Returns parent of first element that matches the selector

quantdom.siblings() ⇒ Quantdom

returns the siblings of the first element that matches the selector

Kind: instance method of Quantdom
Returns: Quantdom - Returns siblings of first element that matches the selector

quantdom.children() ⇒ Quantdom

returns the children of the first element that matches the selector

Kind: instance method of Quantdom
Returns: Quantdom - Returns children of first element that matches the selector

quantdom.find([selector]) ⇒ Quantdom

returns the first element that matches the selector in children of the selected node

Kind: instance method of Quantdom
Returns: Quantdom - returns first element that matches the selector

Param Type Description
[selector] string query selector to search for

quantdom.findEl([selector]) ⇒ HTMLElement

returns first element that matches the selector in children of the selected node

Kind: instance method of Quantdom
Returns: HTMLElement - returns first element that matches the selector

Param Type Description
[selector] string query selector to search for

quantdom.findEls([selector]) ⇒ Nodelist

returns elements that matches the selector in children of the selected node

Kind: instance method of Quantdom
Returns: Nodelist - returns nodelist of that matches the selector

Param Type Description
[selector] string query selector to search for

quantdom.el([index]) ⇒ HTMLElement

returns first element in an array of elements with same selector, acts like document.querySelector

Kind: instance method of Quantdom
Returns: HTMLElement - an element in the array of elements you want to use

Param Type Description
[index] integer index of element to return

quantdom.lastEl() ⇒ HTMLElement

returns last element in an array of elements with same selector

Kind: instance method of Quantdom
Returns: HTMLElement - last element in array of elements you want to use

quantdom.els() ⇒ Nodelist

returns all matching elements, alias for querySelectorAll

Kind: instance method of Quantdom
Returns: Nodelist - a nodelists

quantdom.on(event, listener)

adds an event on an element(s)

Kind: instance method of Quantdom

Param Type Description
event string type of event to add to element
listener function event listener function to execute on event

quantdom.off(event, listener)

removes an event on an element(s)

Kind: instance method of Quantdom

Param Type Description
event string type of event to add to element
listener function event listener function to remove

quantdom.append(html)

Appends an html string to a dom element(s)

Kind: instance method of Quantdom

Param Type Description
html string html string to append to DOM

quantdom.prepend(html)

prepends a html string to a dom element(s)

Kind: instance method of Quantdom

Param Type Description
html string string of html to prepend

quantdom.before(html)

inserts a html string to dom right before element(s)

Kind: instance method of Quantdom

Param Type Description
html string string of html to prepend

quantdom.after(html)

inserts a html string to dom right after element(s)

Kind: instance method of Quantdom

Param Type Description
html string string of html to prepend

quantdom.attr(attr, value) ⇒ string

sets an element(s) attribute or returns first element attribute value

Kind: instance method of Quantdom
Returns: string - value of first occurrence of element attribute

Param Type Description
attr string an attribute
value any a value to set attribute

quantdom.hide([aria])

adds display none from css inline styles

Kind: instance method of Quantdom

Param Type Description
[aria] boolean if true sets ara-hidden to true instead of setting inline display style to none

quantdom.show([aria])

removes display none from and element(s) css inline styles

Kind: instance method of Quantdom

Param Type Description
[aria] boolean if true sets ara-hidden to false instead of removing inline display style

quantdom.html([html]) ⇒ string

inserts/replaces html or returns html of an element(s)

Kind: instance method of Quantdom
Returns: string - html of first occurrence of element

Param Type Description
[html] string html to insert into dom

quantdom.text([newValue]) ⇒ string

inserts/replaces text or returns text of an element(s)

Kind: instance method of Quantdom
Returns: string - text of first occurrence of element

Param Type Description
[newValue] string text to insert into dom

quantdom.val([newValue]) ⇒ *

gets a value of first html element or sets a new value of all HTML Element(s)

Kind: instance method of Quantdom
Returns: * - value of first occurrence of element

Param Type Description
[newValue] * a new value to set

quantdom.addClass(className)

adds a class to the selected element(s)

Kind: instance method of Quantdom

Param Type
className string

quantdom.removeClass(className)

removes a class from the selected element(s)

Kind: instance method of Quantdom

Param Type
className string

quantdom.toggleClass(className)

toggles a class on selected element(s)

Kind: instance method of Quantdom

Param Type
className string

quantdom.css(prop, [value]) ⇒

sets a style on element(s) or returns the style property value

Kind: instance method of Quantdom
Returns: computed style of element

Param Type Description
prop string css property to get or set
[value] * value to set styles

quantdom.docReady(cb)

wrapper to run code that needs to wait for DOM to be fully loaded

Kind: instance method of Quantdom

Param Type Description
cb callback a callback to run once the DOM is ready