Adds the specified class(es) to each of the set of matched elements.
Bind an event handler to the "change" JavaScript event, or trigger that event on an element.
Bind an event handler to the "change" JavaScript event, or trigger that event on an element.
NOTE: the jQuery documentation is very fuzzy on this point, but implies in an example that "this" gets set appropriately.
Get the children of each element in the set of matched elements, optionally filtered by a selector.
Bind an event handler to the "click" JavaScript event, or trigger that event on an element.
Bind an event handler to the "click" JavaScript event, or trigger that event on an element.
This is the simpler version, and usually what you want.
Create a deep copy of the set of matched elements.
Create a deep copy of the set of matched elements.
Note that this requires an override because Scala.Object declares a clone() method which is entirely unrelated.
Get the computed style properties for the first element in the set of matched elements.
Calling .data() with no parameters retrieves all of the values as a JavaScript object.
Calling .data() with no parameters retrieves all of the values as a JavaScript object. This object can be safely cached in a variable as long as a new object is not set with .data(obj). Using the object directly to get or set values is faster than making individual calls to .data() to get or set each value.
Return the value at the named data store for the first element in the jQuery collection, as set by data(name, value) or by an HTML5 data-* attribute.
Store arbitrary data associated with the matched elements.
Store arbitrary data associated with the matched elements.
undefined is not recognised as a data value. Calls such as .data( "name", undefined ) will return the corresponding data for "name", and is therefore the same as .data( "name" ).
Bind an event handler to the "dblclick" JavaScript event.
Bind an event handler to the "dblclick" JavaScript event.
This is the simpler version, and usually what you want.
Set a timer to delay execution of subsequent items in the queue.
Remove the set of matched elements from the DOM.
Iterate over a jQuery object, executing a function for each matched element.
Iterate over a jQuery object, executing a function for each matched element.
Note that we do not bother with the full jQuery signature, since the "element" parameter simply matches "this".
You can stop the loop from within the callback function by returning false. Otherwise, the return value is irrelevant.
Remove all child nodes of the set of matched elements from the DOM.
Reduce the set of matched elements to the first in the set.
Bind an event handler to the "focus" JavaScript event, or trigger that event on an element.
Retrieve the elements matched by the jQuery object.
Retrieve one of the elements matched by the jQuery object.
Retrieve one of the elements matched by the jQuery object.
If the value of index is out of bounds - less than the negative number of elements or equal to or greater than the number of elements - it returns undefined.
Determine whether any of the matched elements are assigned the given class.
Set the CSS height of every matched element.
Get the current computed height for the first element in the set of matched elements.
Hide the matched elements.
Set the HTML contents of every matched element.
Get the HTML contents of the first element in the set of matched elements.
Get the current computed inner height (including padding but not border) for the first element in the set of matched elements.
Get the current computed inner width (including padding but not border) for the first element in the set of matched elements.
Check the current matched set of elements against a selector, element, or jQuery object and return true if at least one of these elements matches the given arguments.
Check the current matched set of elements against a selector, element, or jQuery object and return true if at least one of these elements matches the given arguments.
Bind an event handler to the "keydown" JavaScript event, or trigger that event on an element.
Bind an event handler to the "keypress" JavaScript event, or trigger that event on an element.
Bind an event handler to the "keyup" JavaScript event, or trigger that event on an element.
The number of elements in the jQuery object.
Pass each element in the current matched set through a function, producing a new jQuery object containing the return values.
Pass each element in the current matched set through a function, producing a new jQuery object containing the return values.
For Scala code, it is often more convenient to use the mapElems() extension function.
Within the callback function, this refers to the current DOM element for each iteration. The function can return an individual data item or an array of data items to be inserted into the resulting set.
If a js.Array is returned, the elements inside the array are inserted into the set. If the function returns null or undefined, no element will be inserted. (Note the implication: this doesn't quite match the usual Scala semantics of map() -- there is a flatten component as well.)
Remove an event handler.
Get the current coordinates of the first element in the set of matched elements, relative to the document.
Attach an event handler function for one or more events to the selected elements.
Attach an event handler function for one or more events to the selected elements.
This version of the signature allows you to pass in "false" as the handler. This is kind of magical in jQuery -- it is shorthand for a function that just does "return false", which stops propagation on the event. Note that true is *not* a legal value, only false.
Attach an event handler function for one or more events to the selected elements.
Get the current computed height for the first element in the set of matched elements, including padding, border, and optionally margin.
Get the current computed width for the first element in the set of matched elements, including padding, border, and optionally margin.
Get the parent of each element in the current set of matched elements, optionally filtered by a selector.
Get the parent of each element in the current set of matched elements, optionally filtered by a selector.
TBD: is the parameter really a Selector, or just a String? The JQuery API docs are unclear.
Get the ancestors of each element in the current set of matched elements, optionally filtered by a selector.
Insert content, specified by the parameters, to the beginning of each element in the set of matched elements.
Insert content, specified by the parameters, to the beginning of each element in the set of matched elements.
Set one or more properties for the set of matched elements.
Get the value of a property for the first element in the set of matched elements.
Remove the set of matched elements from the DOM.
Remove a single class, multiple classes, or all classes from each element in the set of matched elements.
Bind an event handler to the "resize" JavaScript event, or trigger that event on an element.
Set the current vertical position of the scroll bar for each of the set of matched elements.
Set the current vertical position of the scroll bar for each of the set of matched elements.
Note that this intentionally takes Double -- while you usually want to set it to an Int, there are occasions when being able to take a Double (that is, a full JS Number) is convenient in code.
Get the current vertical position of the scroll bar for the first element in the set of matched elements or set the vertical position of the scroll bar for every matched element.
Hide the matched elements.
Display the matched elements with a sliding motion.
Hide the matched elements with a sliding motion.
Set the content of each element in the set of matched elements to the specified text.
Get the combined text contents of each element in the set of matched elements, including their descendants.
Retrieve all the elements contained in the jQuery set, as an array.
Execute all handlers and behaviors attached to the matched elements for the given event type.
Get the value of this JQuery.
Get the value of this JQuery.
"value" is highly context-dependent. The signature is loose because it can return a String, a Number (?) or an Array, depending on circumstances. See the extension methods in JQueryExtensions for more strongly-typed versions that you can use when you expect a specific return type.
Set the CSS width of every matched element.
Get the current computed width for the first element in the set of matched elements.
A facade for the main jQuery object.
This is a reimplementation, very loosely based on the existing scalajs-jquery. It aims to be much more strongly and precisely typed, while being as literal a translation of the functionality of jQuery as possible. It is intentionally pretty close to scalajs-jquery, and many files can be switched over by simply switching the import, but compatibility has *not* been a priority, and a modest number of functions have changed in breaking ways. (This is one reason why I treated this as a rewrite rather than as an evolution of the existing library.)
TODO: as of this writing, this is *quite* incomplete; I am only adding functions as I use them, and at least half of them are currently missing. Pull requests are greatly welcomed. In particular, we are lacking many overloads -- I've added some of them, but many jQuery functions have a considerable number of potential overloads.
Many parameters are polymorphic. We are currently dealing with the messy cases by defining a polymorphic type in package.scala, using the "tor" type-union trick, and then defining a mid-level facade for that method in JQueryTyped. Then we put a primitive "Internal" version of the method in here. As a rule, you should not directly use any methods here named [something]Internal -- they should always have a more precisely-typed version in JQueryTyped.
NOTE: discussion on scalajs Gitter, 1/28/15, says that facades should *return* Any, but *take* js.Any *if* the Javascript is going to process the value in any way. This is the guiding principle here.
Also: when a facade function takes a property bag, if it is understood to be name/value pairs in JS, declare it as js.Dictionary[T]. Often, we can constrain T; if not, just put js.Any, and it is at least explicit that it is name/value pairs.
TODO: we should probably mark the XXXInternal methods as private [jquery]. See if that works.