org.querki.jquery

JQuery

Related Doc: package jquery

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()
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
Learn more about member selection
Visibility
  1. Public
  2. All

Value Members

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

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

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

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

  5. def addClass(classNames: String): JQuery

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

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

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

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

    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

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

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

  11. def appendTo(target: ElementDesc): JQuery

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

  12. final def asInstanceOf[T0]: T0

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

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

    Set an attribute for the set of matched elements.

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

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

    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

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

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

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

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

    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

  23. def children(selector: String): JQuery

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

  24. def click(): JQuery

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

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

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

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

    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

  30. def clone(withDataAndEvents: Boolean): JQuery

  31. def clone(): JQuery

    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

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

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

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

  36. def css(propertyName: String): String

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

  37. def data(): Dictionary[Any]

    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): Any

    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.

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

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

    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

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

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

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

    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

  46. def delay(duration: Int): JQuery

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

  47. def detach(selector: String): JQuery

  48. def detach(): JQuery

    Remove the set of matched elements from the DOM.

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

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

    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

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

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

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

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

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

  56. def filter(selector: Selector): JQuery

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

  57. def finalize(): Unit

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

    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

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

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

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

  62. def focus(): JQuery

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

  63. def get(): Array[_]

    Retrieve the elements matched by the jQuery object.

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

    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[_]

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

    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

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

  68. def hasOwnProperty(v: String): Boolean

    Definition Classes
    Object
  69. def hashCode(): Int

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

  71. def height(value: Double): JQuery

    Set the CSS height of every matched element.

  72. def height(): Double

    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

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

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

  76. def hide(duration: Int): JQuery

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

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

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

  80. def hide(duration: String): JQuery

  81. def hide(): JQuery

    Hide the matched elements.

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

  83. def html(t: String): JQuery

    Set the HTML contents of every matched element.

  84. def html(): String

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

  85. def index(selector: ElementDesc): Int

  86. def index(): Int

    Search for a given element from among the matched elements.

  87. def innerHeight(): Double

    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

    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

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

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

    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

    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

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

    Definition Classes
    Object
  94. def keydown(): JQuery

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

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

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

  97. def keypress(): JQuery

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

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

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

  100. def keyup(): JQuery

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

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

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

  103. def length: Int

    The number of elements in the jQuery object.

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

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

    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

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

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

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

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

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

  112. def off(): JQuery

  113. def off(events: String): JQuery

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

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

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

    Remove an event handler.

  117. def offset(): JQueryPosition

    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

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

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

  121. def on(events: String): JQuery

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

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

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

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

    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

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

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

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

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

  130. def outerHeight(includeMargin: Boolean): Double

  131. def outerHeight(): Double

    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

  133. def outerWidth(): Double

    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

  135. def parent(selector: String): JQuery

    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

  137. def parents(selector: String): JQuery

    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

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

    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

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

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

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

  143. def prop(propertyName: String): Any

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

  144. def propertyIsEnumerable(v: String): Boolean

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

  146. def remove(): JQuery

    Remove the set of matched elements from the DOM.

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

  148. def removeClass(classNames: String): JQuery

  149. def removeClass(): JQuery

    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

  151. def replaceWith(content: ElementDesc): JQuery

    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

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

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

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

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

  156. def scrollTop(value: Double): JQuery

    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

    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

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

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

  161. def show(duration: Int): JQuery

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

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

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

  165. def show(duration: String): JQuery

  166. def show(): JQuery

    Hide the matched elements.

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

  168. def slideDown(duration: Int): JQuery

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

  170. def slideDown(duration: String): JQuery

  171. def slideDown(): JQuery

    Display the matched elements with a sliding motion.

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

  173. def slideUp(duration: Int): JQuery

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

  175. def slideUp(duration: String): JQuery

  176. def slideUp(): JQuery

    Hide the matched elements with a sliding motion.

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

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

  179. def text(t: String): JQuery

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

  180. def text(): String

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

  181. def toArray(): Array[Element]

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

  182. def toLocaleString(): String

    Definition Classes
    Object
  183. def toString(): String

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

  185. def trigger(eventType: String): JQuery

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

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

  187. def val(value: String): JQuery

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

  189. def val(): Dynamic

    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

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

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

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

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

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

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

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

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

  199. def width(value: Double): JQuery

    Set the CSS width of every matched element.

  200. def width(): Double

    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