4.4.0
Fine Uploader contains a number of utility functions and polyfills to keep
it dependency free and lightweight. These functions are found in the same
namespace as Fine Uploader, qq
.
The qQuery object is much like a poor man’s jQuery. If you cannot or do not want to import a 3rd-party library such as jQuery or Zepto to do cross-browser DOM manipulation, then qQuery will be your friend.
Selects an HTMLElement
and returns a qq
‘wrapped object.’
A HTML element.
qq
functions similar to the jQuery
function in terms of the operations
it can perform. For now, though, qq
only accepts HTMLElements
as input.
To be able to use the qq
methods, first one must wrap some HTMLElement
in the qq
function as such:
For example, if you wanted to hide an element with the id of “myDiv”:
var myDiv, qqMyDiv; myDiv = document.getElementById("myDiv"); qqMyDiv = qq(myDiv); // Now we can call other qq methods: qqMyDiv.hide(); var children = qqMyDiv.children(); // etc ...
Once you’ve wrapped an element, you have access to a wealth of cross-browser polyfills that will let you manipulate the DOM and CSS as you please. Just make sure to wrap any elements before calling these methods on them.
Returns an array of all immediate children of this element.
An HTMLElement or an already wrapped qq
object.
Returns true
if the element contains the passed element.
An HTMLElement or an already wrapped qq
object.
Returns true
if the attribute exists on the element and the value of the attribute is not ‘false’ case-insensitive.
An attribute to test for.
Clears all text for this element
Inserts the element directly before the passed element in the DOM.
Removes the element from the DOM.
Sets the inner text for this element.
The text to set.
Add a class to this element.
The name of the class to add to the element.
Add CSS style(s) to this element.
An object with styles to apply to this element.
Returns an array of all descendants of this element that contain the passed in class name.
The name of the class to look for in each element.
Returns true
if the element has the class name
The name of the class to look for in each element.
Hide this element.
Remove the provided class from the element
The name of the class to look for in each element.
Attach an event handler to this element for a specific DOM event.
A valid DOM Event
A function that will be invoked whenever the respective event occurs
Detach an already attached event handler from this element for a specific DOM event.
A valid DOM Event
A function that will be detached from this event.
polyfill for Function.prototype.bind
. Creates a new function that, when called, has its this
keyword set to the provided context
. Pass comma-separated values after the `context parameter for all arguments to be passed into the new function (when invoked). you can still pass in additional arguments during invocation.
The function that will be bound to.
The context the function will assume.
polyfill iterator. iterates through a collection, passing the key and value into the provided callback. return false;
to stop iteration.
The context the function will assume.
A function that will be called for each item returned by looping through the iterable. This function takes an index and an item.
shallowly copies the parameters of secondobj
to firstobj
. if extendnested
is true then a deep-copy is performed.
The object to copy parameters to.
The object to copy parameters from.
If true
then a deep-copy is performed, else a shallow-copy is.
returns a string, swapping argument values with the associated occurrence of {} in the passed string.
returns the index of item
in the array
starting the search from startingindex
.
true
if the parameter is a ‘simple’ object.
The ‘thing’ to test.
true
if the parameter is a function.
The Object to test.
true
if the parameter is a string.
The Object to test
prevent the user agent’s default action on an event. useful inside of event handlers.
removes whitespace from the ends of a string. poylfill for String.prototype.trim
.
The string to remove whitespace from.
creates and returns a new div
element
Valid HTML that can be parsed by a browser.
log a message to the console. no-op if console logging is not supported. polyfill for th user-agent’s logging function corresponding to that passed logging level. generally delegates to console.log
The message to log.
The logging level. Supports native browser levels (such as ‘info’ and ‘error’), and custom levels.
returns a version4 uuid
true
if cookies are enabled.
returns the value of the cookie with the associated name.
The cookie name to look for
sets or updates a cookie.
The cookie’s name.
The cookie’s value.
Number of days until this cookie expires.
deletes the cookie with the associated name.
The cookie’s name.
return the extension for the filename, if any.
The file’s name to rip the extension off of.