5.15.0
Fine Uploader contains a number of utility functions and shims 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 shims 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 a specific 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.
Shim 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.
Iterates through a collection, passing the key and value into the provided callback. return false;
to stop iteration.
The array or object containing items/properties to loop through.
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.
Returns a string, swapping argument values with the associated occurrence of {} in the passed string.
Return the extension for the filename, if any.
The file's name to rip the extension off of.
Returns a version4 uuid
Returns the index of item
in the Array
starting the search from startingindex
.
true
if the parameter is a function.
The Object to test.
true
if the parameter is a 'simple' object.
The 'thing' to test.
true
if the parameter is a string.
The Object to test
Log a message to the console. no-op if console logging is not supported. shim for console.log
.
The message to log.
The logging level, such as 'warn' and 'info'. If null
, then 'info' is assumed.
Prevent the browser's default action on an event.
The name of the default event to prevent.
Creates and returns a new <div>
element
Valid HTML that can be parsed by a browser.
Removes whitespace from the ends of a string. Shim for String.prototype.trim
.
The string to remove whitespace from.