Trait

org.querki.jquery

JQuery

Related Doc: package jquery

Permalink

trait JQuery extends Object

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 use \/ (type union) to define these. Note that there are several common unions such as Selector defined in package.scala.

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.

Annotations
@RawJSType() @native()
Linear Supertypes
Object, Any, AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. JQuery
  2. Object
  3. Any
  4. AnyRef
  5. Any
  1. Hide All
  2. Show all
Visibility
  1. Public
  2. All

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. def addClass(func: ThisFunction2[Element, Int, String, String]): JQuery

    Permalink
  5. def addClass(classNames: String): JQuery

    Permalink

    Adds the specified class(es) to each of the set of matched elements.

  6. def after(func: ThisFunction1[Element, Int, ElementDesc]): JQuery

    Permalink
  7. def after(func: ThisFunction0[Element, ElementDesc]): JQuery

    Permalink
  8. def after(content: ElementDesc*): JQuery

    Permalink

    Insert content, specified by the parameter, after each element in the set of matched elements.

  9. def append(func: ThisFunction2[Element, Int, String, Any]): JQuery

    Permalink
  10. def append(content: ElementDesc*): JQuery

    Permalink

    Insert content, specified by the parameter, to the end of each element in the set of matched elements.

  11. def appendTo(target: ElementDesc): JQuery

    Permalink

    Insert every element in the set of matched elements to the end of the target.

  12. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  13. def attr(attributeName: String, func: ThisFunction2[Element, Int, String, AttrVal]): JQuery

    Permalink
  14. def attr(attributeName: String, v: AttrVal): JQuery

    Permalink

    Set an attribute for the set of matched elements.

  15. def attr(attributes: Dictionary[String]): JQuery

    Permalink
  16. def attr(attributeName: String): UndefOr[String]

    Permalink

    Get the value of an attribute for the first element in the set of matched elements.

    Get the value of an attribute for the first element in the set of matched elements.

    Note that this returns UndefOr -- it is entirely legal for this to return undefined if the attribute is not present, and that causes things to crash if it is not UndefOr.

  17. def change(): JQuery

    Permalink
  18. def change(eventData: Any, handler: ThisFunction1[Element, JQueryEventObject, Any]): JQuery

    Permalink
  19. def change(handler: Function1[JQueryEventObject, Any]): JQuery

    Permalink
  20. def change(handler: ThisFunction1[Element, JQueryEventObject, Any]): JQuery

    Permalink
  21. def change(handler: ThisFunction0[Element, Any]): JQuery

    Permalink

    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.

  22. def children(): JQuery

    Permalink
  23. def children(selector: String): JQuery

    Permalink

    Get the children of each element in the set of matched elements, optionally filtered by a selector.

  24. def click(): JQuery

    Permalink
  25. def click(func: Function0[Any]): JQuery

    Permalink
  26. def click(func: Function1[JQueryEventObject, Any]): JQuery

    Permalink
  27. def click(func: ThisFunction1[Element, JQueryEventObject, Any]): JQuery

    Permalink
  28. def click(func: ThisFunction0[Element, Any]): JQuery

    Permalink

    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.

  29. def clone(withDataAndEvents: Boolean, deepWithDataAndEvents: Boolean): JQuery

    Permalink
  30. def clone(withDataAndEvents: Boolean): JQuery

    Permalink
  31. def clone(): JQuery

    Permalink

    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.

    Definition Classes
    JQuery → AnyRef
  32. def css(properties: Dictionary[Any]): JQuery

    Permalink
  33. def css(propertyName: String, value: Int): JQuery

    Permalink
  34. def css(propertyName: String, value: String): JQuery

    Permalink
  35. def css(propertyNames: Array[String]): Dictionary[String]

    Permalink
  36. def css(propertyName: String): String

    Permalink

    Get the computed style properties for the first element in the set of matched elements.

  37. def data(): Dictionary[Any]

    Permalink

    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.

  38. def data(key: String): UndefOr[Any]

    Permalink

    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.

    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. Undefined if that key is not set.

  39. def data(obj: Dictionary[Any]): JQuery

    Permalink
  40. def data(key: String, value: Any): JQuery

    Permalink

    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" ).

  41. def dblclick(func: Function0[Any]): JQuery

    Permalink
  42. def dblclick(func: Function1[JQueryEventObject, Any]): JQuery

    Permalink
  43. def dblclick(func: ThisFunction1[Element, JQueryEventObject, Any]): JQuery

    Permalink
  44. def dblclick(func: ThisFunction0[Element, Any]): JQuery

    Permalink

    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.

  45. def delay(duration: Int, queueName: String): JQuery

    Permalink
  46. def delay(duration: Int): JQuery

    Permalink

    Set a timer to delay execution of subsequent items in the queue.

  47. def detach(selector: String): JQuery

    Permalink
  48. def detach(): JQuery

    Permalink

    Remove the set of matched elements from the DOM.

  49. def each(func: ThisFunction1[Element, Int, Any]): JQuery

    Permalink
  50. def each(func: ThisFunction0[Element, Any]): JQuery

    Permalink

    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.

  51. def empty(): JQuery

    Permalink

    Remove all child nodes of the set of matched elements from the DOM.

  52. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  53. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  54. def filter(func: ThisFunction1[Element, Int, Boolean]): JQuery

    Permalink
  55. def filter(func: ThisFunction0[Element, Boolean]): JQuery

    Permalink
  56. def filter(selector: Selector): JQuery

    Permalink

    Reduce the set of matched elements to those that match the selector or pass the function's test.

  57. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  58. def find(selector: Selector): JQuery

    Permalink

    Get the descendants of each element in the current set of matched elements, filtered by a selector, jQuery object, or element.

  59. def first(): JQuery

    Permalink

    Reduce the set of matched elements to the first in the set.

  60. def focus(eventData: Any, func: ThisFunction1[Element, JQueryEventObject, Any]): JQuery

    Permalink
  61. def focus(func: ThisFunction1[Element, JQueryEventObject, Any]): JQuery

    Permalink
  62. def focus(): JQuery

    Permalink

    Bind an event handler to the "focus" JavaScript event, or trigger that event on an element.

  63. def get(): Array[_]

    Permalink

    Retrieve the elements matched by the jQuery object.

  64. def get(index: Int): UndefOr[Element]

    Permalink

    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.

  65. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  66. def has(selector: Selector): JQuery

    Permalink

    Reduce the set of matched elements to those that have a descendant that matches the selector or DOM element.

  67. def hasClass(className: String): Boolean

    Permalink

    Determine whether any of the matched elements are assigned the given class.

  68. def hasOwnProperty(v: String): Boolean

    Permalink
    Definition Classes
    Object
  69. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  70. def height(value: String): JQuery

    Permalink
  71. def height(value: Double): JQuery

    Permalink

    Set the CSS height of every matched element.

  72. def height(): Double

    Permalink

    Get the current computed height for the first element in the set of matched elements.

  73. def hide(duration: Int, easing: String, complete: Function): JQuery

    Permalink
  74. def hide(duration: Int, easing: String): JQuery

    Permalink
  75. def hide(duration: Int, complete: Function): JQuery

    Permalink
  76. def hide(duration: Int): JQuery

    Permalink
  77. def hide(duration: String, easing: String, complete: Function): JQuery

    Permalink
  78. def hide(duration: String, easing: String): JQuery

    Permalink
  79. def hide(duration: String, complete: Function): JQuery

    Permalink
  80. def hide(duration: String): JQuery

    Permalink
  81. def hide(): JQuery

    Permalink

    Hide the matched elements.

  82. def html(func: ThisFunction2[Element, Int, String, String]): JQuery

    Permalink
  83. def html(t: String): JQuery

    Permalink

    Set the HTML contents of every matched element.

  84. def html(): String

    Permalink

    Get the HTML contents of the first element in the set of matched elements.

  85. def index(selector: ElementDesc): Int

    Permalink
  86. def index(): Int

    Permalink

    Search for a given element from among the matched elements.

  87. def innerHeight(): Double

    Permalink

    Get the current computed inner height (including padding but not border) for the first element in the set of matched elements.

  88. def innerWidth(): Double

    Permalink

    Get the current computed inner width (including padding but not border) for the first element in the set of matched elements.

  89. def insertBefore(target: ElementDesc): JQuery

    Permalink

    Insert every element in the set of matched elements before the target.

  90. def is(func: ThisFunction1[Element, Int, Boolean]): Boolean

    Permalink

    Note that this overload doesn't precisely match the jQuery documentation; we elide the redundant Element param, since you have Element as the this parameter.

  91. def is(selector: Selector): Boolean

    Permalink

    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.

  92. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  93. def isPrototypeOf(v: Object): Boolean

    Permalink
    Definition Classes
    Object
  94. def keydown(): JQuery

    Permalink
  95. def keydown(eventData: Any, handler: Function1[JQueryEventObject, Any]): JQuery

    Permalink
  96. def keydown(handler: Function1[JQueryEventObject, Any]): JQuery

    Permalink

    Bind an event handler to the "keydown" JavaScript event, or trigger that event on an element.

  97. def keypress(): JQuery

    Permalink
  98. def keypress(eventData: Any, handler: Function1[JQueryEventObject, Any]): JQuery

    Permalink
  99. def keypress(handler: Function1[JQueryEventObject, Any]): JQuery

    Permalink

    Bind an event handler to the "keypress" JavaScript event, or trigger that event on an element.

  100. def keyup(): JQuery

    Permalink
  101. def keyup(eventData: Any, handler: Function1[JQueryEventObject, Any]): JQuery

    Permalink
  102. def keyup(handler: Function1[JQueryEventObject, Any]): JQuery

    Permalink

    Bind an event handler to the "keyup" JavaScript event, or trigger that event on an element.

  103. def length: Int

    Permalink

    The number of elements in the jQuery object.

  104. def map(func: ThisFunction1[Element, Int, Any]): JQuery

    Permalink
  105. def map(func: ThisFunction0[Element, Any]): JQuery

    Permalink

    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.)

  106. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  107. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  108. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  109. def off(event: JQueryEventObject): JQuery

    Permalink
  110. def off(eventsMap: Dictionary[ThisFunction1[Element, JQueryEventObject, Any]]): JQuery

    Permalink
  111. def off(eventsMap: Dictionary[ThisFunction1[Element, JQueryEventObject, Any]], selector: String): JQuery

    Permalink
  112. def off(): JQuery

    Permalink
  113. def off(events: String): JQuery

    Permalink
  114. def off(events: String, handler: Function1[JQueryEventObject, Any]): JQuery

    Permalink
  115. def off(events: String, selector: String): JQuery

    Permalink
  116. def off(events: String, selector: String, handler: ThisFunction1[Element, JQueryEventObject, Any]): JQuery

    Permalink

    Remove an event handler.

  117. def offset(): JQueryPosition

    Permalink

    Get the current coordinates of the first element in the set of matched elements, relative to the document.

  118. def on(eventsMap: Dictionary[ThisFunction1[Element, JQueryEventObject, Any]]): JQuery

    Permalink
  119. def on(eventsMap: Dictionary[ThisFunction1[Element, JQueryEventObject, Any]], selector: String): JQuery

    Permalink
  120. def on(eventsMap: Dictionary[ThisFunction1[Element, JQueryEventObject, Any]], selector: String, data: Any): JQuery

    Permalink
  121. def on(events: String): JQuery

    Permalink
  122. def on(events: String, turnOff: Boolean): JQuery

    Permalink
  123. def on(events: String, selector: String): JQuery

    Permalink
  124. def on(events: String, selector: String, data: Any): JQuery

    Permalink
  125. def on(events: String, selector: String, data: Any, turnOff: Boolean): JQuery

    Permalink

    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.

  126. def on(events: String, handler: Function1[JQueryEventObject, Any]): JQuery

    Permalink
  127. def on(events: String, handler: ThisFunction0[Element, Any]): JQuery

    Permalink
  128. def on(events: String, handler: ThisFunction1[Element, JQueryEventObject, Any]): JQuery

    Permalink
  129. def on(events: String, selector: String, data: Any, handler: ThisFunction1[Element, JQueryEventObject, Any]): JQuery

    Permalink

    Attach an event handler function for one or more events to the selected elements.

  130. def outerHeight(includeMargin: Boolean): Double

    Permalink
  131. def outerHeight(): Double

    Permalink

    Get the current computed height for the first element in the set of matched elements, including padding, border, and optionally margin.

  132. def outerWidth(includeMargin: Boolean): Double

    Permalink
  133. def outerWidth(): Double

    Permalink

    Get the current computed width for the first element in the set of matched elements, including padding, border, and optionally margin.

  134. def parent(): JQuery

    Permalink
  135. def parent(selector: String): JQuery

    Permalink

    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.

  136. def parents(): JQuery

    Permalink
  137. def parents(selector: String): JQuery

    Permalink

    Get the ancestors of each element in the current set of matched elements, optionally filtered by a selector.

  138. def prepend(func: ThisFunction2[Element, Int, String, Selector]): JQuery

    Permalink
  139. def prepend(contents: ElementDesc*): JQuery

    Permalink

    Insert content, specified by the parameters, to the beginning of each element in the set of matched elements.

  140. def prop(propertyName: String, func: ThisFunction2[Element, Int, Any, Any]): JQuery

    Permalink
  141. def prop(properties: Dictionary[Any]): JQuery

    Permalink
  142. def prop(propertyName: String, value: Any): JQuery

    Permalink

    Set one or more properties for the set of matched elements.

  143. def prop(propertyName: String): Any

    Permalink

    Get the value of a property for the first element in the set of matched elements.

  144. def propertyIsEnumerable(v: String): Boolean

    Permalink
    Definition Classes
    Object
  145. def remove(childSelector: String): JQuery

    Permalink
  146. def remove(): JQuery

    Permalink

    Remove the set of matched elements from the DOM.

  147. def removeClass(func: ThisFunction2[Element, Int, String, String]): JQuery

    Permalink
  148. def removeClass(classNames: String): JQuery

    Permalink
  149. def removeClass(): JQuery

    Permalink

    Remove a single class, multiple classes, or all classes from each element in the set of matched elements.

  150. def replaceWith(func: ThisFunction0[Element, ElementDesc]): JQuery

    Permalink
  151. def replaceWith(content: ElementDesc): JQuery

    Permalink

    Replace each element in the set of matched elements with the provided new content and return the set of elements that was removed.

  152. def resize(): JQuery

    Permalink
  153. def resize(func: Function0[Any]): JQuery

    Permalink
  154. def resize(eventData: Any, handler: Function1[JQueryEventObject, Any]): JQuery

    Permalink
  155. def resize(func: Function1[JQueryEventObject, Any]): JQuery

    Permalink

    Bind an event handler to the "resize" JavaScript event, or trigger that event on an element.

  156. def scrollTop(value: Double): JQuery

    Permalink

    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.

  157. def scrollTop(): Int

    Permalink

    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.

  158. def show(duration: Int, easing: String, complete: Function): JQuery

    Permalink
  159. def show(duration: Int, easing: String): JQuery

    Permalink
  160. def show(duration: Int, complete: Function): JQuery

    Permalink
  161. def show(duration: Int): JQuery

    Permalink
  162. def show(duration: String, easing: String, complete: Function): JQuery

    Permalink
  163. def show(duration: String, easing: String): JQuery

    Permalink
  164. def show(duration: String, complete: Function): JQuery

    Permalink
  165. def show(duration: String): JQuery

    Permalink
  166. def show(): JQuery

    Permalink

    Hide the matched elements.

  167. def slideDown(duration: Int, complete: Function): JQuery

    Permalink
  168. def slideDown(duration: Int): JQuery

    Permalink
  169. def slideDown(duration: String, complete: Function): JQuery

    Permalink
  170. def slideDown(duration: String): JQuery

    Permalink
  171. def slideDown(): JQuery

    Permalink

    Display the matched elements with a sliding motion.

  172. def slideUp(duration: Int, complete: Function): JQuery

    Permalink
  173. def slideUp(duration: Int): JQuery

    Permalink
  174. def slideUp(duration: String, complete: Function): JQuery

    Permalink
  175. def slideUp(duration: String): JQuery

    Permalink
  176. def slideUp(): JQuery

    Permalink

    Hide the matched elements with a sliding motion.

  177. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  178. def text(func: Function2[Int, String, String]): JQuery

    Permalink
  179. def text(t: String): JQuery

    Permalink

    Set the content of each element in the set of matched elements to the specified text.

  180. def text(): String

    Permalink

    Get the combined text contents of each element in the set of matched elements, including their descendants.

  181. def toArray(): Array[Element]

    Permalink

    Retrieve all the elements contained in the jQuery set, as an array.

  182. def toLocaleString(): String

    Permalink
    Definition Classes
    Object
  183. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  184. def trigger(event: JQueryEventObject): JQuery

    Permalink
  185. def trigger(eventType: String): JQuery

    Permalink

    Execute all handlers and behaviors attached to the matched elements for the given event type.

  186. def val(func: Function2[Int, String, String]): JQuery

    Permalink
  187. def val(value: String): JQuery

    Permalink
  188. def val(value: Array[String]): JQuery

    Permalink
  189. def val(): Dynamic

    Permalink

    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.

  190. def value(func: Function2[Int, String, String]): JQuery

    Permalink
    Annotations
    @JSName( "val" )
  191. def value(value: String): JQuery

    Permalink
    Annotations
    @JSName( "val" )
  192. def value(value: Array[String]): JQuery

    Permalink
    Annotations
    @JSName( "val" )
  193. def value(): Dynamic

    Permalink
    Annotations
    @JSName( "val" )
  194. def valueOf(): Any

    Permalink
    Definition Classes
    Object
  195. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  196. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  197. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  198. def width(value: String): JQuery

    Permalink
  199. def width(value: Double): JQuery

    Permalink

    Set the CSS width of every matched element.

  200. def width(): Double

    Permalink

    Get the current computed width for the first element in the set of matched elements.

Inherited from Object

Inherited from Any

Inherited from AnyRef

Inherited from Any

Ungrouped