[ˈnuɲeθ]
Very small jQuery-like library with only few functions with emphasis on total size.
since 0.0.1
addClass(name) -> self
Add class to each element.
since 0.0.2
ajax(options) -> xhttp
since 0.0.4
ajax(url, options) -> xhttp
Performs an Ajax request.
async boolean, default true
complete function
data string
error function(xhttp)
headers {}
success function(responseText, xhttp)
type string, default GET
url string
since 0.0.4
get(url, options) -> xhttp
Shortcut for ajax request with GET type.
since 0.0.4
post(url, options) -> xhttp
Shortcut for ajax request with POST type.
since 0.0.4
put(url, options) -> xhttp
Shortcut for ajax request with PUT type.
since 0.0.3
appendTo(selector) -> collection
Appends collection as last into each element found by selector.
since 0.0.1
attr(attribute_name) -> value
attr(attribute_name, value) -> self
Read or set DOM attribute of each element. If value is not defined, it returns value of first element, otherwise it sets attribute to each element.
since 0.0.1
click() -> self
click(trigger) -> self
If trigger is not defined, it performs click on each element, otherwise it adds event listener.
since 0.0.3
clone() -> collection
Performs deep copy of each element and return clones as collection.
since 0.0.1
each(function (index, element) { ... }) -> self
Iterates elements of the collection. Function arguments are optional since current element is accessible with this keyword.
since 0.0.1
find(selector) -> collection
Finds elements by selector in current children collection of elements.
since 0.0.1
hasClass(name) -> boolean
Checks if any element in collection has specified class.
since 0.0.4
hasEvent(name) -> boolean
Checks if first element in collection has specified event.
since 0.0.1
hide() -> self
Hides elements in collection by setting display to none.
since 0.0.3
html() -> string
html(content) -> self
Read or set inner HTML of each element. If content is not defined, it returns HTML of first element, otherwise it sets HTML to each element.
since 0.0.1
is(selector) -> boolean
Checks first element of collection matches the CSS selector.
since 0.0.3
insertAfter(selector) -> collection
Inserts copy of collection after each element found by selector.
since 0.0.3
insertBefore(selector) -> collection
Inserts copy of collection before each element found by selector.
since 0.0.3
nunjs -> version
Not a function, just a property, that signals current version of library.
since 0.0.1
off(event) -> self
off(event, trigger) -> self
Detach event handlers added with on. If trigger is defined, it detach only this one specific listener, otherwise it detach all of event type.
since 0.0.1
on(event, trigger) -> self
Attach event handler to all elements in collection.
since 0.0.1
parent() -> collection
parent(selector) -> collection
If selector is not defined, it returns collection of parents of all elements, otherwise it returns collection of parents (on any level) matching selector.
since 0.0.3
appendTo(selector) -> collection
Appends collection as first into each element found by selector.
since 0.0.3
prop(property_name) -> value
prop(property_name, value) -> self
Read or set DOM property of each element. If value is not defined, it returns property of first element, otherwise it sets property to each element.
since 0.0.1
ready(trigger) -> self
Attach an event handler for the DOMContentLoaded, that is fired when the page is ready.
since 0.0.3
remove() -> void
Removes all elements in the collection.
since 0.0.3
removeAttr(name) -> self
Removes specified attribute from all elements in the collection.
since 0.0.1
removeClass(name) -> self
Removes specified class from all elements in the collection.
since 0.0.3
removeProp(property_name) -> self
Removes specified property from all elements in the collection.
since 0.0.1
show() -> self
Restores default value of display on all elements.
since 0.0.1
submit() -> self
Performs submit.
since 0.0.1
text() -> string
text(content) -> self
Gets of sets the text content of elements in the collection. If no content is defined, it returns the text contents of all elements, otherwise it replaces the text content of each elements.
since 0.0.1
toggle() -> self
Toggles between showing and hiding of the elements based on their on display property of first element in collection.
since 0.0.2
val() -> string
val(value) -> self
Gets or sets value of form control. If no value is defined, it returns value of first element, otherwise it sets value for all elements in collection.