4.5.1 • Published 7 years ago

qoob v4.5.1

Weekly downloads
1
License
MIT
Repository
github
Last release
7 years ago

Examples

CSS manipulation

import Q from 'qoob'

Q.css('p', {
    color: 'red',
    fontWeight: 'bold',
})

Events

import Q from 'qoob'

Q.on('.Button', 'click', (e) => {
    alert('Button was clicked!')
})

Iteration + HTML manipulation

import Q from 'qoob'

Q.each('p', (el, i) => {
    Q.html(el, `I am at index ${i}`)
})

Element creation

import Q from 'qoob'

let p_tag = Q.make('p', 'Hello world!')

Q.append('body', p_tag)

and much more...

Install

NPM

$ npm install --save qoob

Bower

$ bower install qoob

CDN

Development

https://cdn.rawgit.com/enzyme/qoob/master/dist/qoob.js

Production

https://cdn.rawgit.com/enzyme/qoob/master/dist/qoob.min.js

Function reference

NameParametersDescription
addClassselector, class_nameAdd the given class to the element(s) matching the selector.
ancestorselector, ancestor_selectorGet an array of ancestors matching the ancestor_selector for the element(s) matching the selector.
appendselector, child_elementAppend the child element given to the element(s) matching the selector.
attrselector, attribute, value = nullGet or set the given attribute for the element(s) matching the selector.
childrenselector, child_selector = nullGet an array of children for the element(s) matching the selector.
cloneselectorClone the given element(s) matching the selector and return them as an array.
cssselector, properties = {}Set the given css description object on the element(s) matching the selector, or get the value of the css property if properties is a string value. E.g. "padding".
dataselector, name, content = nullGets or sets the data attributes on the element(s) matching the selector.
documentReadyclosureExecutes the given callback function with the document is ready.
eachselector, closureExecute the given callback function for each element in the list provided.
findselectorFind and return any element(s) matching the given selector. If the selector is an array or NodeList, simply return it as is. If the selector is a single object, return it as an array with 1 element.
findAllselectorsFind and return any element(s) matching the given selectors.
firstselectorGet the first element matching the given selector.
firstOffnReturns a function that calls the given function and returns only the first result returned by that function. Eg let firstHtml = Qoob.firstOf(Qoob.html) when called like firstHtml('p') with multiple p tags on the page, will only return the HTML contents of the first p tag.
funcnameReturns a function that takes an object as an argument and returns the value returned by calling the provided function on it.
hasClassselector, class_nameChecks whether the given class exists on the element(s) matching the selector. This will still return true if multiple elements are matched and any one of them has the class applied.
headlistAlias for strip(...).
hideselectorHide the element(s) matching the selector.
htmlselector, content = nullGets or sets the html content on the element(s) matching the selector.
isselector, class_nameWhether the element(s) matching the selector have the given class applied.
maketype, inner_html = nullCreate a new html element of the specified type and optionally fill it with the given html.
onselector, event, closureFire a callback on any element(s) matching the selector when the specified event type occurs.
offselector, event, closureDisable an event for a closure on any element(s) matching the selector when called.
parentselectorGet an array of parents for the element(s) matching the selector.
prependselector, child_elementPrepend the child element given to the element(s) matching the selector.
propnameReturns a function that takes an object as an argument and returns the given property value on it.
removeselectorRemove the element(s) from the DOM.
removeAttrselector, attributeRemove the attribute from the element(s) matching the selector.
removeClassselector, class_nameRemove the given class from the element(s) matching the selector.
showselector, preferred_display = 'block'Show the element(s) matching the selector.
siblingsselectorGet an array of siblings for the element(s) matching the selector.
stateselector, attributeAlias for the setter functionality of attr(...) where the attribute will be set to a value equal to its name. Eg state('input', 'disabled') is equivalent to calling attr('input', 'disabled', 'disabled').
striplistReturns the first value in the array provided, otherwise returns null if the array is empty.
textselector, value = nullGet or set the text for the element(s) matching the selector.
toggleselector, preferred_display = 'block'Toggle the visibility of the element(s) matching the selector.
togglerselector, fn_on, fn_offWhen called on selector, it will either call fn_on or fn_off if the state of the element(s) are transitioning to their on or off states respectively. Element(s) start in an off state.
valselector, value = nullGet or set the value for the element(s) matching the selector.

License

MIT, see LICENSE.

Copyright (c) 2016 Tristan Strathearn <r3oath@gmail.com>

4.5.1

7 years ago

4.5.0

7 years ago

4.4.0

7 years ago

4.3.1

7 years ago

4.3.0

7 years ago

4.2.1

7 years ago

4.2.0

8 years ago

4.1.0

8 years ago

4.0.0

8 years ago

3.3.0

8 years ago

3.2.0

8 years ago

3.1.0

8 years ago

3.0.0

8 years ago

2.0.0

8 years ago

1.0.0

8 years ago

0.0.47

8 years ago

0.0.46

8 years ago

0.0.45

8 years ago

0.0.44

8 years ago

0.0.43

8 years ago

0.0.42

8 years ago

0.0.41

8 years ago

0.0.40

8 years ago

0.0.39

8 years ago

0.0.38

8 years ago

0.0.37

8 years ago

0.0.36

8 years ago

0.0.35

8 years ago

0.0.34

8 years ago

0.0.33

8 years ago

0.0.32

8 years ago

0.0.31

8 years ago

0.0.30

8 years ago

0.0.29

8 years ago

0.0.28

8 years ago

0.0.27

8 years ago

0.0.26

8 years ago

0.0.25

8 years ago

0.0.24

8 years ago

0.0.23

8 years ago

0.0.22

8 years ago

0.0.21

8 years ago

0.0.20

8 years ago

0.0.19

8 years ago

0.0.18

8 years ago

0.0.17

8 years ago

0.0.16

8 years ago

0.0.15

8 years ago

0.0.14

8 years ago

0.0.13

8 years ago

0.0.12

8 years ago

0.0.11

8 years ago

0.0.10

8 years ago

0.0.9

8 years ago

0.0.8

8 years ago

0.0.7

8 years ago

0.0.6

8 years ago

0.0.5

8 years ago

0.0.4

8 years ago

0.0.3

8 years ago

0.0.2

8 years ago