From 7c68f0954ac2615d287cba224d2e9632ef2b97d5 Mon Sep 17 00:00:00 2001 From: Starzu Date: Fri, 30 Jun 2017 13:56:01 +0200 Subject: [PATCH 1/4] Upgrade to jQuery 3.2.1 --- build.sbt | 23 +- project/build.properties | 2 +- project/plugins.sbt | 2 +- .../io/udash/wrappers/jquery/JQuery.scala | 546 +++++------------- .../wrappers/jquery/JQueryDeferred.scala | 8 +- .../udash/wrappers/jquery/JQueryStatic.scala | 75 +-- 6 files changed, 197 insertions(+), 459 deletions(-) diff --git a/build.sbt b/build.sbt index 2d41939..17f5081 100644 --- a/build.sbt +++ b/build.sbt @@ -1,10 +1,10 @@ name := "udash-jquery" -version := "1.0.1" +version := "1.1.0" organization := "io.udash" -scalaVersion := "2.12.1" -crossScalaVersions := Seq("2.11.8", "2.12.1") +scalaVersion := "2.12.2" +crossScalaVersions := Seq("2.11.11", "2.12.2") scalacOptions in ThisBuild ++= Seq( "-feature", "-deprecation", @@ -14,23 +14,24 @@ scalacOptions in ThisBuild ++= Seq( "-language:dynamics", "-Xfuture", "-Xfatal-warnings", - "-Xlint:_,-missing-interpolator,-adapted-args" + CrossVersion.partialVersion(scalaVersion.value).collect { + // WORKAROUND https://github.com/scala/scala/pull/5402 + case (2, 12) => "-Xlint:-unused,_" + }.getOrElse("-Xlint:_") ) -jsEnv in Test := new org.scalajs.jsenv.selenium.SeleniumJSEnv(org.scalajs.jsenv.selenium.Firefox) +jsEnv in Test := new org.scalajs.jsenv.selenium.SeleniumJSEnv(org.scalajs.jsenv.selenium.Firefox()) libraryDependencies ++= Seq( - "org.scala-js" %%% "scalajs-dom" % "0.9.1", - "org.scalatest" %%% "scalatest" % "3.0.1" % Test, - "com.lihaoyi" %%% "scalatags" % "0.6.2" % Test + "org.scala-js" %%% "scalajs-dom" % "0.9.2", + "org.scalatest" %%% "scalatest" % "3.0.3" % Test, + "com.lihaoyi" %%% "scalatags" % "0.6.5" % Test ) jsDependencies += - "org.webjars" % "jquery" % "2.2.4" / "2.2.4/jquery.js" minified "2.2.4/jquery.min.js" + "org.webjars" % "jquery" % "3.2.1" / "3.2.1/jquery.js" minified "3.2.1/jquery.min.js" requiresDOM in Test := true -persistLauncher in Test := false -scalaJSUseRhino in Test := false lazy val root = project.in(file(".")) .enablePlugins(ScalaJSPlugin) diff --git a/project/build.properties b/project/build.properties index e0cbc71..6be4958 100755 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version = 0.13.13 \ No newline at end of file +sbt.version = 0.13.15 \ No newline at end of file diff --git a/project/plugins.sbt b/project/plugins.sbt index 5aec49e..3a623d2 100755 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,5 +1,5 @@ logLevel := Level.Warn -addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.13") +addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.18") libraryDependencies += "org.scala-js" %% "scalajs-env-selenium" % "0.1.3" diff --git a/src/main/scala/io/udash/wrappers/jquery/JQuery.scala b/src/main/scala/io/udash/wrappers/jquery/JQuery.scala index 6e4b757..7c7bdd8 100644 --- a/src/main/scala/io/udash/wrappers/jquery/JQuery.scala +++ b/src/main/scala/io/udash/wrappers/jquery/JQuery.scala @@ -6,7 +6,7 @@ import scala.collection.mutable import scala.concurrent.duration.Duration import scala.scalajs.js import scala.scalajs.js.annotation.JSName -import scala.scalajs.js.{Dictionary, ThisFunction1, UndefOr} +import scala.scalajs.js.{Dictionary, ThisFunction1, UndefOr, |} @js.native trait JQuery extends js.Object { @@ -36,14 +36,6 @@ trait JQuery extends js.Object { * See: jQuery Docs */ def addClass(className: String): JQuery = js.native - /** Adds the specified class(es) to each element in the set of matched elements.
- * See: jQuery Docs */ - private[jquery] def addClass(function: js.Function1[Int, String]): JQuery = js.native - - /** Adds the specified class(es) to each element in the set of matched elements.
- * See: jQuery Docs */ - private[jquery] def addClass(function: js.Function2[Int, String, String]): JQuery = js.native - /** Insert content, specified by the parameter, after each element in the set of matched elements.
* See: jQuery Docs */ def after(content: (Selector | Element | JQuery)*): JQuery = js.native @@ -52,22 +44,10 @@ trait JQuery extends js.Object { * See: jQuery Docs */ def after(function: js.Function2[Int, String, String | Element | JQuery]): JQuery = js.native - /** Perform a custom animation of a set of CSS properties.
- * See: jQuery Docs */ - private[jquery] def animate(properties: js.Dictionary[Any], duration: Int, easing: EasingFunction, callback: js.ThisFunction0[Element, Any]): JQuery = js.native - - /** Perform a custom animation of a set of CSS properties.
- * See: jQuery Docs */ - private[jquery] def animate(properties: js.Dictionary[Any], options: js.Dictionary[Any]): JQuery = js.native - /** Insert content, specified by the parameter, to the end of each element in the set of matched elements.
* See: jQuery Docs */ def append(content: (String | Element | JQuery)*): JQuery = js.native - /** Insert content, specified by the parameter, to the end of each element in the set of matched elements.
- * See: jQuery Docs */ - private[jquery] def append(function: js.ThisFunction2[Element, Int, String, Any]): JQuery = js.native - /** Insert every element in the set of matched elements to the end of the target.
* See: jQuery Docs */ def appendTo(target: (Selector | Element | JQuery)*): JQuery = js.native @@ -76,26 +56,10 @@ trait JQuery extends js.Object { * See: jQuery Docs */ def attr(attributeName: String, attributeValue: String | Int | Double | Boolean): JQuery = js.native - /** Get the value of an attribute for the first element in the set of matched elements.
- * See: jQuery Docs */ - private[jquery] def attr(attributeName: String): UndefOr[String] = js.native - - /** Set one or more attributes for the set of matched elements.
- * See: jQuery Docs */ - private[jquery] def attr(attributes: js.Dictionary[String | Int | Double | Boolean]): JQuery = js.native - - /** Set one or more attributes for the set of matched elements.
- * See: jQuery Docs */ - private[jquery] def attr(attributeName: String, function: js.Function2[Int, String, String | Int | Double | Boolean]): JQuery = js.native - /** Insert content, specified by the parameter, before each element in the set of matched elements.
* See: jQuery Docs */ def before(content: (String | Element | JQuery)*): JQuery = js.native - /** Insert content, specified by the parameter, before each element in the set of matched elements.
- * See: jQuery Docs */ - private[jquery] def before(content: js.Function2[Int, String, String | Element | JQuery]): JQuery = js.native - /** Trigger blur event on an element.
* See: jQuery Docs */ def blur(): JQuery = js.native @@ -153,30 +117,14 @@ trait JQuery extends js.Object { * See: jQuery Docs */ def css(attributeName: String, attributeValue: String | Int | Double | Boolean): JQuery = js.native - /** Set one or more CSS properties for the set of matched elements.
- * See: jQuery Docs */ - private[jquery] def css(attributeName: String, attributeFun: js.Function2[Int, String, String | Int | Double | Boolean]): JQuery = js.native - - /** Set one or more CSS properties for the set of matched elements.
- * See: jQuery Docs */ - private[jquery] def css(properties: js.Dictionary[String | Int | Double | Boolean]): JQuery = js.native - /** Store arbitrary data associated with the matched elements.
* See: jQuery Docs */ def data(key: String, value: Any): JQuery = js.native - /** Store arbitrary data associated with the matched elements.
- * See: jQuery Docs */ - private[jquery] def data(obj: js.Dictionary[Any]): JQuery = js.native - /** 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.
* See: jQuery Docs */ def data(): js.Dynamic = js.native - /** 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.
- * See: jQuery Docs */ - private[jquery] def data(key: String): UndefOr[Any] = js.native - /** Trigger dblclick event on an element.
* See: jQuery Docs */ @JSName("dblclick") @@ -194,10 +142,6 @@ trait JQuery extends js.Object { * See: jQuery Docs */ def detach(selector: Selector): JQuery = js.native - /** Iterate over a jQuery object, executing a function for each matched element.
- * See: jQuery Docs */ - private[jquery] def each(function: js.ThisFunction1[Element, Int, Any]): JQuery = js.native - /** Remove all child nodes of the set of matched elements from the DOM.
* See: jQuery Docs */ def empty(): JQuery = js.native @@ -220,54 +164,22 @@ trait JQuery extends js.Object { * See: jQuery Docs */ def fadeIn(duration: Int = js.native, easing: EasingFunction = js.native): JQuery = js.native - /** Display the matched elements by fading them to opaque.
- * See: jQuery Docs */ - private[jquery] def fadeIn(duration: Int, easing: EasingFunction, callback: js.ThisFunction0[Element, Any]): JQuery = js.native - - /** Display the matched elements by fading them to opaque.
- * See: jQuery Docs */ - private[jquery] def fadeIn(options: js.Dictionary[Any]): JQuery = js.native - /** Hide the matched elements by fading them to transparent.
* See: jQuery Docs */ def fadeOut(duration: Int = js.native, easing: EasingFunction = js.native): JQuery = js.native - /** Hide the matched elements by fading them to transparent.
- * See: jQuery Docs */ - private[jquery] def fadeOut(duration: Int, easing: EasingFunction, callback: js.ThisFunction0[Element, Any]): JQuery = js.native - - /** Hide the matched elements by fading them to transparent.
- * See: jQuery Docs */ - private[jquery] def fadeOut(options: js.Dictionary[Any]): JQuery = js.native - /** Adjust the opacity of the matched elements.
* See: jQuery Docs */ def fadeTo(duration: Int, opacity: Double): JQuery = js.native - /** Adjust the opacity of the matched elements.
- * See: jQuery Docs */ - private[jquery] def fadeTo(duration: Int, opacity: Double, callback: js.ThisFunction0[Element, Any]): JQuery = js.native - /** Adjust the opacity of the matched elements.
* See: jQuery Docs */ def fadeTo(duration: Int, opacity: Double, easing: EasingFunction): JQuery = js.native - /** Adjust the opacity of the matched elements.
- * See: jQuery Docs */ - private[jquery] def fadeTo(duration: Int, opacity: Double, easing:String, callback: js.ThisFunction0[Element, Any]): JQuery = js.native - /** Display or hide the matched elements by animating their opacity.
* See: jQuery Docs */ def fadeToggle(duration: Int = js.native, easing: EasingFunction = js.native): JQuery = js.native - /** Display or hide the matched elements by animating their opacity.
- * See: jQuery Docs */ - private[jquery] def fadeToggle(duration: Int, easing: EasingFunction, callback: js.ThisFunction0[Element, Any]): JQuery = js.native - - /** Display or hide the matched elements by animating their opacity.
- * See: jQuery Docs */ - private[jquery] def fadeToggle(options: js.Dictionary[Any]): JQuery = js.native - /** Reduce the set of matched elements to those that match the selector or pass the function's test.
* See: jQuery Docs */ def filter(selector: Selector | JQuery): JQuery = js.native @@ -276,10 +188,6 @@ trait JQuery extends js.Object { * See: jQuery Docs */ def filter(elements: Element*): JQuery = js.native - /** Reduce the set of matched elements to those that match the selector or pass the function's test.
- * See: jQuery Docs */ - private[jquery] def filter(function: js.ThisFunction2[Element, Int, Element, Boolean]): JQuery = js.native - /** Get the descendants of each element in the current set of matched elements, filtered by a selector, jQuery object, or element.
* See: jQuery Docs */ def find(selector: String | Element | JQuery): JQuery = js.native @@ -306,14 +214,6 @@ trait JQuery extends js.Object { @JSName("focusout") def focusOut(): JQuery = js.native - /** Retrieve one of the elements matched by the jQuery object.
- * See: jQuery Docs */ - private[jquery] def get(index: Int): UndefOr[Element] = js.native - - /** Retrieve the elements matched by the jQuery object.
- * See: jQuery Docs */ - private[jquery] def get(): js.Array[Element] = js.native - /** Reduce the set of matched elements to those that have a descendant that matches the selector or DOM element.
* See: jQuery Docs */ def has(selector: String | Element): JQuery = js.native @@ -330,22 +230,10 @@ trait JQuery extends js.Object { * See: jQuery Docs */ def height(value: String | Int | Double): JQuery = js.native - /** Set the CSS height of every matched element.
- * See: jQuery Docs */ - private[jquery] def height(function: js.ThisFunction2[Element, Int, Int, String | Int | Double]): JQuery = js.native - /** Hide the matched elements.
* See: jQuery Docs */ def hide(duration: Int = js.native, easing: EasingFunction = js.native): JQuery = js.native - /** Hide the matched elements.
- * See: jQuery Docs */ - private[jquery] def hide(duration: Int, easing: EasingFunction, callback: js.ThisFunction0[Element, Any]): JQuery = js.native - - /** Hide the matched elements.
- * See: jQuery Docs */ - private[jquery] def hide(options: js.Dictionary[Any]): JQuery = js.native - /** Get the HTML contents of the first element in the set of matched elements.
* See: jQuery Docs */ def html(): String = js.native @@ -370,10 +258,6 @@ trait JQuery extends js.Object { * See: jQuery Docs */ def innerHeight(value: Double | String): JQuery = js.native - /** Set the CSS inner height of each element in the set of matched elements.
- * See: jQuery Docs */ - private[jquery] def innerHeight(function: js.ThisFunction2[Element, Int, Double, Int | Double | String]): JQuery = js.native - /** Get the current computed inner width for the first element in the set of matched elements, including padding but not border.
* See: jQuery Docs */ def innerWidth(): Double = js.native @@ -382,10 +266,6 @@ trait JQuery extends js.Object { * See: jQuery Docs */ def innerWidth(value: Int | Double | String): JQuery = js.native - /** Set the CSS inner width of each element in the set of matched elements.
- * See: jQuery Docs */ - private[jquery] def innerWidth(function: js.ThisFunction2[Element, Int, Double, Int | Double | String]): JQuery = js.native - /** Insert every element in the set of matched elements after the target.
* See: jQuery Docs */ def insertAfter(selector: String | Element | JQuery): JQuery = js.native @@ -398,10 +278,6 @@ trait JQuery extends js.Object { * See: jQuery Docs */ def is(selector: String | Element | JQuery): Boolean = js.native - /** 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.
- * See: jQuery Docs */ - private[jquery] def is(function: js.ThisFunction2[Element, Int, Element, Boolean]): Boolean = js.native - /** A string containing the jQuery version number.
* See: jQuery Docs */ def jquery: String = js.native @@ -433,14 +309,6 @@ trait JQuery extends js.Object { * See: jQuery Docs */ def load(url: String, data: js.Any = js.native): JQuery = js.native - /** Load data from the server and place the returned HTML into the matched element.
- * See: jQuery Docs */ - private[jquery] def load(url: String, data: js.Any, callback: js.ThisFunction3[Element, String, String, JQueryXHR, Any]): JQuery = js.native - - /** Pass each element in the current matched set through a function, producing a new jQuery object containing the return values.
- * See: jQuery Docs */ - private[jquery] def map(callback: js.Function2[Int, Element, Any]): JQuery = js.native - /** Trigger mousedown event on an element.
* See: jQuery Docs */ @JSName("mousedown") @@ -496,10 +364,6 @@ trait JQuery extends js.Object { * See: jQuery Docs */ def not(el: Element*): JQuery = js.native - /** Remove elements from the set of matched elements.
- * See: jQuery Docs */ - private[jquery] def not(function: js.ThisFunction2[Element, Int, Element, Boolean]): JQuery = js.native - /** Remove an event handler.
* See: jQuery Docs */ def off(): JQuery = js.native @@ -512,53 +376,10 @@ trait JQuery extends js.Object { * See: jQuery Docs */ def off(jEvent: JQueryEvent, selector: String = js.native): JQuery = js.native - // Don't use this method directly. Use CallbackRegistration::unregister() returned from on() instead - private[jquery] def off(events: String, callback: js.ThisFunction1[Element, JQueryEvent, Any]): JQuery = js.native - - /** Get the current coordinates of the first element in the set of matched elements, relative to the document.
- * See: jQuery Docs */ - private[jquery] def offset(): js.Dictionary[Double] = js.native - - /** Get the current coordinates of the first element in the set of matched elements, relative to the document.
- * See: jQuery Docs */ - private[jquery] def offset(coordinates: js.Dictionary[Int | Double]): JQuery = js.native - /** Get the closest ancestor element that is positioned.
* See: jQuery Docs */ def offsetParent(): JQuery = js.native - /** Attach an event handler function for one or more events to the selected elements.
- * See: jQuery Docs */ - private[jquery] def on(events: String, callback: js.ThisFunction1[Element, JQueryEvent, Any]): JQuery = js.native - - /** Attach an event handler function for one or more events to the selected elements.
- * See: jQuery Docs */ - private[jquery] def on(events: String, data: js.Any, callback: js.ThisFunction1[Element, JQueryEvent, Any]): JQuery = js.native - - /** Attach an event handler function for one or more events to the selected elements.
- * See: jQuery Docs */ - private[jquery] def on(events: String, selector: String, callback: js.ThisFunction1[Element, JQueryEvent, Any]): JQuery = js.native - - /** Attach an event handler function for one or more events to the selected elements.
- * See: jQuery Docs */ - private[jquery] def on(events: String, selector: String, data: js.Any, callback: js.ThisFunction1[Element, JQueryEvent, Any]): JQuery = js.native - - /** Attach a handler to an event for the elements. The handler is executed at most once per element per event type.
- * See: jQuery Docs */ - private[jquery] def one(events: String, callback: js.ThisFunction1[Element, JQueryEvent, Any]): JQuery = js.native - - /** Attach a handler to an event for the elements. The handler is executed at most once per element per event type.
- * See: jQuery Docs */ - private[jquery] def one(events: String, data: js.Any, callback: js.ThisFunction1[Element, JQueryEvent, Any]): JQuery = js.native - - /** Attach a handler to an event for the elements. The handler is executed at most once per element per event type.
- * See: jQuery Docs */ - private[jquery] def one(events: String, selector: String, callback: js.ThisFunction1[Element, JQueryEvent, Any]): JQuery = js.native - - /** Attach a handler to an event for the elements. The handler is executed at most once per element per event type.
- * See: jQuery Docs */ - private[jquery] def one(events: String, selector: String, data: js.Any, callback: js.ThisFunction1[Element, JQueryEvent, Any]): JQuery = js.native - /** Get the current computed height for the first element in the set of matched elements, including padding, border, and optionally margin. Returns a number (without "px") representation of the value or null if called on an empty set of elements.
* See: jQuery Docs */ def outerHeight(includeMargin: Boolean = js.native): Double = js.native @@ -567,10 +388,6 @@ trait JQuery extends js.Object { * See: jQuery Docs */ def outerHeight(value: Int | Double | String): JQuery = js.native - /** Set the CSS outer Height of each element in the set of matched elements.
- * See: jQuery Docs */ - private[jquery] def outerHeight(function: js.ThisFunction2[Element, Int, Double, Double]): JQuery = js.native - /** Get the current computed width for the first element in the set of matched elements, including padding and border.
* See: jQuery Docs */ def outerWidth(includeMargin: Boolean = js.native): Double = js.native @@ -579,10 +396,6 @@ trait JQuery extends js.Object { * See: jQuery Docs */ def outerWidth(value: Int | Double | String): JQuery = js.native - /** Set the CSS outer width of each element in the set of matched elements.
- * See: jQuery Docs */ - private[jquery] def outerWidth(function: js.ThisFunction2[Element, Int, Double, Double]): JQuery = js.native - /** Get the parent of each element in the current set of matched elements, optionally filtered by a selector.
* See: jQuery Docs */ def parent(selector: Selector = js.native): JQuery = js.native @@ -595,18 +408,10 @@ trait JQuery extends js.Object { * See: jQuery Docs */ def parentsUntil(selector: Selector | Element | JQuery = js.native, filter: Selector = js.native): JQuery = js.native - /** Get the current coordinates of the first element in the set of matched elements, relative to the offset parent.
- * See: jQuery Docs */ - private[jquery] def position(): js.Dictionary[Double] = js.native - /** Insert content, specified by the parameter, to the beginning of each element in the set of matched elements.
* See: jQuery Docs */ def prepend(content: (String | Element | JQuery)*): JQuery = js.native - /** Insert content, specified by the parameter, to the beginning of each element in the set of matched elements.
- * See: jQuery Docs */ - private[jquery] def prepend(function: js.ThisFunction2[Element, Int, String, Any]): JQuery = js.native - /** Insert every element in the set of matched elements to the beginning of the target.
* See: jQuery Docs */ def prependTo(target: (Selector | Element | JQuery)*): JQuery = js.native @@ -635,26 +440,6 @@ trait JQuery extends js.Object { * See: jQuery Docs */ def prop(propertyName: String, value: js.Any): JQuery = js.native - /** Set one or more properties for the set of matched elements.
- * See: jQuery Docs */ - private[jquery] def prop(propertyName: String, function: js.ThisFunction2[Element, Int, js.Any, Any]): JQuery = js.native - - /** Set one or more properties for the set of matched elements.
- * See: jQuery Docs */ - private[jquery] def prop(properties: js.Dictionary[Any]): JQuery = js.native - - /** Add a collection of DOM elements onto the jQuery stack.
- * See: jQuery Docs */ - private[jquery] def pushStack(elements: js.Array[Any]): JQuery = js.native - - /** Add a collection of DOM elements onto the jQuery stack.
- * See: jQuery Docs */ - private[jquery] def pushStack(elements: js.Array[Any], name: String, arguments: js.Array[Any]): JQuery = js.native - - /** Specify a function to execute when the DOM is fully loaded.
- * See: jQuery Docs */ - private[jquery] def ready(callback: js.ThisFunction0[Element, Any]): JQuery = js.native - /** Remove the set of matched elements from the DOM.
* See: jQuery Docs */ def remove(selector: String = js.native): JQuery = js.native @@ -667,18 +452,10 @@ trait JQuery extends js.Object { * See: jQuery Docs */ def removeClass(className: String*): JQuery = js.native - /** Remove a single class, multiple classes, or all classes from each element in the set of matched elements.
- * See: jQuery Docs */ - private[jquery] def removeClass(function: js.Function2[Int, String, String]): JQuery = js.native - /** Remove a previously-stored piece of data.
* See: jQuery Docs */ def removeData(name: String = js.native): JQuery = js.native - /** Remove a previously-stored piece of data.
- * See: jQuery Docs */ - private[jquery] def removeData(list: js.Array[String]): JQuery = js.native - /** Remove a property for the set of matched elements.
* See: jQuery Docs */ def removeProp(propertyName: String): JQuery = js.native @@ -731,14 +508,6 @@ trait JQuery extends js.Object { * See: jQuery Docs */ def show(duration: Int = js.native, easing: EasingFunction = js.native): JQuery = js.native - /** Display the matched elements.
- * See: jQuery Docs */ - private[jquery] def show(duration: Int, easing: EasingFunction, callback: js.ThisFunction0[Element, Any]): JQuery = js.native - - /** Display the matched elements.
- * See: jQuery Docs */ - private[jquery] def show(options: js.Dictionary[Any]): JQuery = js.native - /** Get the siblings of each element in the set of matched elements, optionally filtered by a selector.
* See: jQuery Docs */ def siblings(selector: String = js.native): JQuery = js.native @@ -751,38 +520,14 @@ trait JQuery extends js.Object { * See: jQuery Docs */ def slideDown(duration: Int = js.native, easing: EasingFunction = js.native): JQuery = js.native - /** Display the matched elements with a sliding motion.
- * See: jQuery Docs */ - private[jquery] def slideDown(duration: Int, easing: EasingFunction, callback: js.ThisFunction0[Element, Any]): JQuery = js.native - - /** Display the matched elements with a sliding motion.
- * See: jQuery Docs */ - private[jquery] def slideDown(options: js.Dictionary[Any]): JQuery = js.native - /** Display or hide the matched elements with a sliding motion.
* See: jQuery Docs */ def slideToggle(duration: Int = js.native, easing: EasingFunction = js.native): JQuery = js.native - /** Display or hide the matched elements with a sliding motion.
- * See: jQuery Docs */ - private[jquery] def slideToggle(duration: Int, easing: EasingFunction, callback: js.ThisFunction0[Element, Any]): JQuery = js.native - - /** Display or hide the matched elements with a sliding motion.
- * See: jQuery Docs */ - private[jquery] def slideToggle(options: js.Dictionary[Any]): JQuery = js.native - /** Hide the matched elements with a sliding motion.
* See: jQuery Docs */ def slideUp(duration: Int = js.native, easing: EasingFunction = js.native): JQuery = js.native - /** Hide the matched elements with a sliding motion.
- * See: jQuery Docs */ - private[jquery] def slideUp(duration: Int, easing: EasingFunction, callback: js.ThisFunction0[Element, Any]): JQuery = js.native - - /** Hide the matched elements with a sliding motion.
- * See: jQuery Docs */ - private[jquery] def slideUp(options: js.Dictionary[Any]): JQuery = js.native - /** Stop the currently-running animation on the matched elements.
* See: jQuery Docs */ def stop(queue: String = js.native, clearQueue: Boolean = js.native, jumpToEnd: Boolean = js.native): JQuery = js.native @@ -799,14 +544,6 @@ trait JQuery extends js.Object { * See: jQuery Docs */ def text(text: String | Double | Int | Boolean): JQuery = js.native - /** Set the content of each element in the set of matched elements to the specified text.
- * See: jQuery Docs */ - private[jquery] def text(function: js.ThisFunction2[Element, Int, String, String]): JQuery = js.native - - /** Retrieve all the elements contained in the jQuery set, as an array.
- * See: jQuery Docs */ - private[jquery] def toArray(): js.Array[Element] = js.native - /** Display or hide the matched elements.
* See: jQuery Docs */ def toggle(display: Boolean): JQuery = js.native @@ -815,14 +552,6 @@ trait JQuery extends js.Object { * See: jQuery Docs */ def toggle(duration: Int = js.native, easing: EasingFunction = js.native): JQuery = js.native - /** Display or hide the matched elements.
- * See: jQuery Docs */ - private[jquery] def toggle(duration: Int, easing: EasingFunction, callback: js.ThisFunction0[Element, Any]): JQuery = js.native - - /** Display or hide the matched elements.
- * See: jQuery Docs */ - private[jquery] def toggle(options: js.Dictionary[Any]): JQuery = js.native - /** Add or remove one or more classes from each element in the set of matched elements, depending on either the class's presence or the value of the state argument.
* See: jQuery Docs */ def toggleClass(className: String): JQuery = js.native @@ -831,26 +560,14 @@ trait JQuery extends js.Object { * See: jQuery Docs */ def toggleClass(className: String, state: Boolean): JQuery = js.native - /** Add or remove one or more classes from each element in the set of matched elements, depending on either the class's presence or the value of the state argument.
- * See: jQuery Docs */ - private[jquery] def toggleClass(function: js.Function3[Int, String, Boolean, String], state: Boolean = js.native): JQuery = js.native - /** Execute all handlers and behaviors attached to the matched elements for the given event type.
* See: jQuery Docs */ def trigger(event: String | JQueryEvent): JQuery = js.native - /** Execute all handlers and behaviors attached to the matched elements for the given event type.
- * See: jQuery Docs */ - private[jquery] def trigger(event: String | JQueryEvent, extraParams: js.Dictionary[Any] | js.Array[Any]): JQuery = js.native - /** Execute all handlers attached to an element for an event.
* See: jQuery Docs */ def triggerHandler(event: String | JQueryEvent): JQuery = js.native - /** Execute all handlers attached to an element for an event.
- * See: jQuery Docs */ - private[jquery] def triggerHandler(event: String | JQueryEvent, extraParams: js.Dictionary[Any] | js.Array[Any]): JQuery = js.native - /** Remove the parents of the set of matched elements from the DOM, leaving the matched elements in their place.
* See: jQuery Docs */ def unwrap(): JQuery = js.native @@ -865,11 +582,6 @@ trait JQuery extends js.Object { @JSName("val") def value(value: String | Int | Double | js.Array[Any]): JQuery = js.native - /** Set the value of each element in the set of matched elements.
- * See: jQuery Docs */ - @JSName("val") - private[jquery] def value(function: js.ThisFunction2[Element, Int, String, String]): JQuery = js.native - /** Get the current computed width for the first element in the set of matched elements.
* See: jQuery Docs */ def width(): Double = js.native @@ -878,38 +590,20 @@ trait JQuery extends js.Object { * See: jQuery Docs */ def width(value: String | Int | Double): JQuery = js.native - /** Set the CSS width of each element in the set of matched elements.
- * See: jQuery Docs */ - private[jquery] def width(function: js.ThisFunction2[Element, Int, Int, String | Int | Double]): JQuery = js.native - /** Wrap an HTML structure around each element in the set of matched elements.
* See: jQuery Docs */ def wrap(wrappingElement: Selector | Element | JQuery): JQuery = js.native - /** Wrap an HTML structure around each element in the set of matched elements.
- * See: jQuery Docs */ - private[jquery] def wrap(function: js.ThisFunction1[Element, Int, String | JQuery]): JQuery = js.native - /** Wrap an HTML structure around all elements in the set of matched elements.
* See: jQuery Docs */ def wrapAll(wrappingElement: Selector | Element | JQuery): JQuery = js.native - /** Wrap an HTML structure around all elements in the set of matched elements.
- * See: jQuery Docs */ - private[jquery] def wrapAll(function: js.ThisFunction1[Element, Int, String | JQuery]): JQuery = js.native - /** Wrap an HTML structure around the content of each element in the set of matched elements.
* See: jQuery Docs */ def wrapInner(wrappingElement: Selector | Element | JQuery): JQuery = js.native - - /** Wrap an HTML structure around the content of each element in the set of matched elements.
- * See: jQuery Docs */ - private[jquery] def wrapInner(function: js.ThisFunction1[Element, Int, String | JQuery]): JQuery = js.native } object JQuery { - import scala.scalajs.js.`|` - trait CallbackRegistration { def unregister(): Unit } @@ -924,7 +618,7 @@ object JQuery { class OnCallbackRegistration(event: String, callback: JQueryCallback, reg: (ThisFunction1[Element, JQueryEvent, Any]) => Any, - unreg: (String, ThisFunction1[Element, JQueryEvent, Any]) => js.Any = (event, c) => jquery.off(event, c)) + unreg: (String, ThisFunction1[Element, JQueryEvent, Any]) => js.Any = (event, c) => jquery.asInstanceOf[js.Dynamic].off(event, c)) extends CallbackRegistration { private val c: ThisFunction1[Element, JQueryEvent, Any] = callback reg(c) @@ -934,40 +628,48 @@ object JQuery { /** Adds the specified class(es) to each element in the set of matched elements.
* See: jQuery Docs */ - def addClass(function: (Int) => String): JQuery = jquery.addClass(function) + def addClass(function: (Int) => String): JQuery = + jquery.asInstanceOf[js.Dynamic].addClass(function).asInstanceOf[JQuery] /** Adds the specified class(es) to each element in the set of matched elements.
* See: jQuery Docs */ - def addClass(function: (Int, String) => String): JQuery = jquery.addClass(function) + def addClass(function: (Int, String) => String): JQuery = + jquery.asInstanceOf[js.Dynamic].addClass(function).asInstanceOf[JQuery] /** Perform a custom animation of a set of CSS properties.
* See: jQuery Docs */ def animate(properties: Map[String, Any], duration: Int = 400, easing: EasingFunction = EasingFunction.swing, callback: (Element) => Any = (_) => {}): JQuery = - jquery.animate(properties.toJSDictionary, duration, easing, callback) + jquery.asInstanceOf[js.Dynamic].animate(properties.toJSDictionary, duration, easing, js.ThisFunction.fromFunction1(callback)).asInstanceOf[JQuery] /** Perform a custom animation of a set of CSS properties.
* See: jQuery Docs */ - def animate(properties: Map[String, Any], options: AnimationOptions): JQuery = jquery.animate(properties.toJSDictionary, options.toJSDictionary) + def animate(properties: Map[String, Any], options: AnimationOptions): JQuery = + jquery.asInstanceOf[js.Dynamic].animate(properties.toJSDictionary, options.toJSDictionary).asInstanceOf[JQuery] /** Insert content, specified by the parameter, to the end of each element in the set of matched elements.
* See: jQuery Docs */ - def append(function: (Element, Int, String) => Any): JQuery = jquery.append(function) + def append(function: (Element, Int, String) => Any): JQuery = + jquery.asInstanceOf[js.Dynamic].append(js.ThisFunction.fromFunction3(function)).asInstanceOf[JQuery] /** Get the value of an attribute for the first element in the set of matched elements.
* See: jQuery Docs */ - def attr(attributeName: String): Option[String] = jquery.attr(attributeName).toOption + def attr(attributeName: String): Option[String] = + jquery.asInstanceOf[js.Dynamic].attr(attributeName).asInstanceOf[UndefOr[String]].toOption /** Set one or more attributes for the set of matched elements.
* See: jQuery Docs */ - def attr(attributes: Map[String, String | Int | Double | Boolean]): JQuery = jquery.attr(attributes.toJSDictionary) + def attr(attributes: Map[String, String | Int | Double | Boolean]): JQuery = + jquery.asInstanceOf[js.Dynamic].attr(attributes.toJSDictionary).asInstanceOf[JQuery] /** Set one or more attributes for the set of matched elements.
* See: jQuery Docs */ - def attr(attributeName: String, function: (Int, String) => String | Int | Double | Boolean): JQuery = jquery.attr(attributeName, function) + def attr(attributeName: String, function: (Int, String) => String | Int | Double | Boolean): JQuery = + jquery.asInstanceOf[js.Dynamic].attr(attributeName, function).asInstanceOf[JQuery] /** Insert content, specified by the parameter, before each element in the set of matched elements.
* See: jQuery Docs */ - def before(content: (Int, String) => String | Element | JQuery): JQuery = jquery.before(content) + def before(content: (Int, String) => String | Element | JQuery): JQuery = + jquery.asInstanceOf[js.Dynamic].before(content).asInstanceOf[JQuery] /** Bind an event handler to the "blur" JavaScript event on an element.
* See: jQuery Docs */ @@ -1003,19 +705,23 @@ object JQuery { /** Set one or more CSS properties for the set of matched elements.
* See: jQuery Docs */ - def css(propertyNames: Map[String, String | Int | Double | Boolean]): JQuery = jquery.css(propertyNames.toJSDictionary) + def css(propertyNames: Map[String, String | Int | Double | Boolean]): JQuery = + jquery.asInstanceOf[js.Dynamic].css(propertyNames.toJSDictionary).asInstanceOf[JQuery] /** Set one or more CSS properties for the set of matched elements.
* See: jQuery Docs */ - def css(attributeName: String, attributeFun: (Int, String) => String | Int | Double | Boolean): JQuery = jquery.css(attributeName, attributeFun) + def css(attributeName: String, attributeFun: (Int, String) => String | Int | Double | Boolean): JQuery = + jquery.asInstanceOf[js.Dynamic].css(attributeName, attributeFun).asInstanceOf[JQuery] /** 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.
* See: jQuery Docs */ - def data(key: String): Option[Any] = jquery.data(key).toOption + def data(key: String): Option[Any] = + jquery.asInstanceOf[js.Dynamic].data(key).asInstanceOf[UndefOr[Any]].toOption /** Store arbitrary data associated with the matched elements.
* See: jQuery Docs */ - def data(obj: Map[String, Any]): JQuery = jquery.data(obj.toJSDictionary) + def data(obj: Map[String, Any]): JQuery = + jquery.asInstanceOf[js.Dynamic].data(obj.toJSDictionary).asInstanceOf[JQuery] /** Bind an event handler to the "dblclick" JavaScript event on an element.
* See: jQuery Docs */ @@ -1027,7 +733,8 @@ object JQuery { /** Iterate over a jQuery object, executing a function for each matched element.
* See: jQuery Docs */ - def each(callback: (Element, Int) => Any): JQuery = jquery.each(callback) + def each(callback: (Element, Int) => Any): JQuery = + jquery.asInstanceOf[js.Dynamic].each(js.ThisFunction.fromFunction2(callback)).asInstanceOf[JQuery] /** Bind an event handler to the "error" JavaScript event on an element.
* See: jQuery Docs */ @@ -1041,39 +748,48 @@ object JQuery { /** Display the matched elements by fading them to opaque.
* See: jQuery Docs */ - def fadeIn(duration: Int, easing: EasingFunction, callback: (Element) => Any): JQuery = jquery.fadeIn(duration, easing, callback) + def fadeIn(duration: Int, easing: EasingFunction, callback: (Element) => Any): JQuery = + jquery.asInstanceOf[js.Dynamic].fadeIn(duration, easing, js.ThisFunction.fromFunction1(callback)).asInstanceOf[JQuery] /** Display the matched elements by fading them to opaque.
* See: jQuery Docs */ - def fadeIn(options: AnimationOptions): JQuery = jquery.fadeIn(options.toJSDictionary) + def fadeIn(options: AnimationOptions): JQuery = + jquery.asInstanceOf[js.Dynamic].fadeIn(options.toJSDictionary).asInstanceOf[JQuery] /** Hide the matched elements by fading them to transparent.
* See: jQuery Docs */ - def fadeOut(duration: Int, easing: EasingFunction, callback: (Element) => Any): JQuery = jquery.fadeOut(duration, easing, callback) + def fadeOut(duration: Int, easing: EasingFunction, callback: (Element) => Any): JQuery = + jquery.asInstanceOf[js.Dynamic].fadeOut(duration, easing, js.ThisFunction.fromFunction1(callback)).asInstanceOf[JQuery] /** Hide the matched elements by fading them to transparent.
* See: jQuery Docs */ - def fadeOut(options: AnimationOptions): JQuery = jquery.fadeOut(options.toJSDictionary) + def fadeOut(options: AnimationOptions): JQuery = + jquery.asInstanceOf[js.Dynamic].fadeOut(options.toJSDictionary).asInstanceOf[JQuery] /** Adjust the opacity of the matched elements.
* See: jQuery Docs */ - def fadeTo(duration: Int, opacity: Double, callback: (Element) => Any): JQuery = jquery.fadeTo(duration, opacity, callback) + def fadeTo(duration: Int, opacity: Double, callback: (Element) => Any): JQuery = + jquery.asInstanceOf[js.Dynamic].fadeTo(duration, opacity, js.ThisFunction.fromFunction1(callback)).asInstanceOf[JQuery] /** Adjust the opacity of the matched elements.
* See: jQuery Docs */ - def fadeTo(duration: Int, opacity: Double, easing: EasingFunction, callback: (Element) => Any): JQuery = jquery.fadeTo(duration, opacity, easing, callback) + def fadeTo(duration: Int, opacity: Double, easing: EasingFunction, callback: (Element) => Any): JQuery = + jquery.asInstanceOf[js.Dynamic].fadeTo(duration, opacity, easing, js.ThisFunction.fromFunction1(callback)).asInstanceOf[JQuery] /** Display or hide the matched elements by animating their opacity.
* See: jQuery Docs */ - def fadeToggle(duration: Int, easing: EasingFunction, callback: (Element) => Any): JQuery = jquery.fadeToggle(duration, easing, callback) + def fadeToggle(duration: Int, easing: EasingFunction, callback: (Element) => Any): JQuery = + jquery.asInstanceOf[js.Dynamic].fadeToggle(duration, easing, js.ThisFunction.fromFunction1(callback)).asInstanceOf[JQuery] /** Display or hide the matched elements by animating their opacity.
* See: jQuery Docs */ - def fadeToggle(options: AnimationOptions): JQuery = jquery.fadeToggle(options.toJSDictionary) + def fadeToggle(options: AnimationOptions): JQuery = + jquery.asInstanceOf[js.Dynamic].fadeToggle(options.toJSDictionary).asInstanceOf[JQuery] /** Reduce the set of matched elements to those that match the selector or pass the function's test.
* See: jQuery Docs */ - def filter(function: (Element, Int, Element) => Boolean): JQuery = jquery.filter(function) + def filter(function: (Element, Int, Element) => Boolean): JQuery = + jquery.asInstanceOf[js.Dynamic].filter(js.ThisFunction.fromFunction3(function)).asInstanceOf[JQuery] /** Bind an event handler to the "focus" JavaScript event on an element.
* See: jQuery Docs */ @@ -1101,23 +817,28 @@ object JQuery { /** Retrieve one of the elements matched by the jQuery object.
* See: jQuery Docs */ - def get(index: Int): Option[Element] = jquery.get(index).toOption + def get(index: Int): Option[Element] = + jquery.asInstanceOf[js.Dynamic].get(index).asInstanceOf[UndefOr[Element]].toOption /** Retrieve the elements matched by the jQuery object.
* See: jQuery Docs */ - def get(): Seq[Element] = jquery.get().toSeq + def get(): Seq[Element] = + jquery.asInstanceOf[js.Dynamic].get().asInstanceOf[js.Array[Element]].toSeq /** Set the CSS height of every matched element.
* See: jQuery Docs */ - def height(function: (Element, Int, Int) => String | Int | Double): JQuery = jquery.height(function) + def height(function: (Element, Int, Int) => String | Int | Double): JQuery = + jquery.asInstanceOf[js.Dynamic].height(js.ThisFunction.fromFunction3(function)).asInstanceOf[JQuery] /** Hide the matched elements.
* See: jQuery Docs */ - def hide(duration: Int, easing: EasingFunction, callback: (Element) => Any): JQuery = jquery.hide(duration, easing, callback) + def hide(duration: Int, easing: EasingFunction, callback: (Element) => Any): JQuery = + jquery.asInstanceOf[js.Dynamic].hide(duration, easing, js.ThisFunction.fromFunction1(callback)).asInstanceOf[JQuery] /** Hide the matched elements.
* See: jQuery Docs */ - def hide(options: AnimationOptions): JQuery = jquery.hide(options.toJSDictionary) + def hide(options: AnimationOptions): JQuery = + jquery.asInstanceOf[js.Dynamic].hide(options.toJSDictionary).asInstanceOf[JQuery] /** Bind two handlers to the matched elements, to be executed when the mouse pointer enters and leaves the elements.
* See: jQuery Docs */ @@ -1133,15 +854,18 @@ object JQuery { /** Set the CSS inner height of each element in the set of matched elements.
* See: jQuery Docs */ - def innerHeight(function: (Element, Int, Double) => Int | Double | String): JQuery = jquery.innerHeight(function) + def innerHeight(function: (Element, Int, Double) => Int | Double | String): JQuery = + jquery.asInstanceOf[js.Dynamic].innerHeight(js.ThisFunction.fromFunction3(function)).asInstanceOf[JQuery] /** Set the CSS inner width of each element in the set of matched elements.
* See: jQuery Docs */ - def innerWidth(function: (Element, Int, Double) => Int | Double | String): JQuery = jquery.innerWidth(function) + def innerWidth(function: (Element, Int, Double) => Int | Double | String): JQuery = + jquery.asInstanceOf[js.Dynamic].innerWidth(js.ThisFunction.fromFunction3(function)).asInstanceOf[JQuery] /** 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.
* See: jQuery Docs */ - def is(function: (Element, Int, Element) => Boolean): Boolean = jquery.is(function) + def is(function: (Element, Int, Element) => Boolean): Boolean = + jquery.asInstanceOf[js.Dynamic].is(js.ThisFunction.fromFunction3(function)).asInstanceOf[Boolean] /** Bind an event handler to the "keydown" JavaScript event on an element.
* See: jQuery Docs */ @@ -1169,11 +893,13 @@ object JQuery { /** Load data from the server and place the returned HTML into the matched element.
* See: jQuery Docs */ - def load(url: String, data: js.Any, callback: (Element, String, String, JQueryXHR) => Any): JQuery = jquery.load(url, data, callback) + def load(url: String, data: js.Any, callback: (Element, String, String, JQueryXHR) => Any): JQuery = + jquery.asInstanceOf[js.Dynamic].load(url, data, js.ThisFunction.fromFunction4(callback)).asInstanceOf[JQuery] /** Pass each element in the current matched set through a function, producing a new jQuery object containing the return values.
* See: jQuery Docs */ - def map(callback: (Int, Element) => Any): JQuery = jquery.map(callback) + def map(callback: (Int, Element) => Any): JQuery = + jquery.asInstanceOf[js.Dynamic].map(js.ThisFunction.fromFunction2(callback)).asInstanceOf[JQuery] /** Bind an event handler to the "mousedown" JavaScript event on an element.
* See: jQuery Docs */ @@ -1233,18 +959,20 @@ object JQuery { /** Remove elements from the set of matched elements.
* See: jQuery Docs */ - def not(function: (Element, Int, Element) => Boolean): JQuery = jquery.not(function) + def not(function: (Element, Int, Element) => Boolean): JQuery = + jquery.asInstanceOf[js.Dynamic].not(js.ThisFunction.fromFunction3(function)).asInstanceOf[JQuery] /** Get the current coordinates of the first element in the set of matched elements, relative to the document.
* See: jQuery Docs */ def offset(): Offset = { - val o = jquery.offset() + val o = jquery.asInstanceOf[js.Dynamic].offset().asInstanceOf[js.Dictionary[Double]] Offset(o("top"), o("left")) } /** Get the current coordinates of the first element in the set of matched elements, relative to the document.
* See: jQuery Docs */ - def offset(coordinates: Offset): JQuery = jquery.offset(coordinates.toJSDictionary) + def offset(coordinates: Offset): JQuery = + jquery.asInstanceOf[js.Dynamic].offset(coordinates.toJSDictionary).asInstanceOf[JQuery] /** Attach an event handler function for one or more events to the selected elements.
* See: jQuery Docs */ @@ -1305,10 +1033,10 @@ object JQuery { /** Remove an event handler.
* See: jQuery Docs */ def off(event: String, callback: JQueryCallback): JQuery = { - jquery.toArray() + jquery.asInstanceOf[js.Dynamic].toArray().asInstanceOf[js.Array[Element]] .foreach( el => { if (registrations.contains(el)) { - val jqueryRegs: mutable.Buffer[CallbackRegistrationRef] = registrations.get(el).get + val jqueryRegs: mutable.Buffer[CallbackRegistrationRef] = registrations(el) val found: mutable.Buffer[CallbackRegistrationRef] = jqueryRegs.filter(r => { r match { case CallbackRegistrationRef(ev, cb, _) if cb == callback && ev == event => true @@ -1324,26 +1052,26 @@ object JQuery { jquery } - private def separateCallbacks(event: String, callback:JQueryCallback, params: CallbackParameters): Unit = { + private def separateCallbacks(event: String, callback: JQueryCallback, params: CallbackParameters): Unit = { type ThisFunctionCallback = ThisFunction1[Element, JQueryEvent, Any] - jquery.each((element: Element, idx: Int) => { + jquery.asInstanceOf[js.Dynamic].each(js.ThisFunction.fromFunction2((element: Element, idx: Int) => { val cb = params match { - case CallbackParameters(false, null, null) => c: ThisFunctionCallback => jQ(element).on(event, c) - case CallbackParameters(false, null, data) => c: ThisFunctionCallback => jQ(element).on(event, data, c) - case CallbackParameters(false, selector, null) => c: ThisFunctionCallback => jQ(element).on(event, selector, c) - case CallbackParameters(false, selector, data) => c: ThisFunctionCallback => jQ(element).on(event, selector, data, c) - - case CallbackParameters(true, null, null) => c: ThisFunctionCallback => jQ(element).one(event, c) - case CallbackParameters(true, null, data) => c: ThisFunctionCallback => jQ(element).one(event, data, c) - case CallbackParameters(true, selector, null) => c: ThisFunctionCallback => jQ(element).one(event, selector, c) - case CallbackParameters(true, selector, data) => c: ThisFunctionCallback => jQ(element).one(event, selector, data, c) + case CallbackParameters(false, null, null) => c: ThisFunctionCallback => jQ(element).asInstanceOf[js.Dynamic].on(event, c) + case CallbackParameters(false, null, data) => c: ThisFunctionCallback => jQ(element).asInstanceOf[js.Dynamic].on(event, data, c) + case CallbackParameters(false, selector, null) => c: ThisFunctionCallback => jQ(element).asInstanceOf[js.Dynamic].on(event, selector, c) + case CallbackParameters(false, selector, data) => c: ThisFunctionCallback => jQ(element).asInstanceOf[js.Dynamic].on(event, selector, data, c) + + case CallbackParameters(true, null, null) => c: ThisFunctionCallback => jQ(element).asInstanceOf[js.Dynamic].one(event, c) + case CallbackParameters(true, null, data) => c: ThisFunctionCallback => jQ(element).asInstanceOf[js.Dynamic].one(event, data, c) + case CallbackParameters(true, selector, null) => c: ThisFunctionCallback => jQ(element).asInstanceOf[js.Dynamic].one(event, selector, c) + case CallbackParameters(true, selector, data) => c: ThisFunctionCallback => jQ(element).asInstanceOf[js.Dynamic].one(event, selector, data, c) } val registration: CallbackRegistration = new OnCallbackRegistration(event, callback, cb) collectRegistration(event, callback, element, idx, params, registration) - }) + })) } private def collectRegistration(event: String, callback: JQueryCallback, el: Element, index: Int, params: CallbackParameters, reg: CallbackRegistration) = { @@ -1354,50 +1082,61 @@ object JQuery { /** Set the CSS outer Height of each element in the set of matched elements.
* See: jQuery Docs */ - def outerHeight(function: (Element, Int, Double) => Double): JQuery = jquery.outerHeight(function) + def outerHeight(function: (Element, Int, Double) => Double): JQuery = + jquery.asInstanceOf[js.Dynamic].outerHeight(js.ThisFunction.fromFunction3(function)).asInstanceOf[JQuery] /** Set the CSS outer width of each element in the set of matched elements.
* See: jQuery Docs */ - def outerWidth(function: (Element, Int, Double) => Double): JQuery = jquery.outerWidth(function) + def outerWidth(function: (Element, Int, Double) => Double): JQuery = + jquery.asInstanceOf[js.Dynamic].outerWidth(js.ThisFunction.fromFunction3(function)).asInstanceOf[JQuery] /** Get the current coordinates of the first element in the set of matched elements, relative to the offset parent.
* See: jQuery Docs */ def position(): Position = { - val p = jquery.position() + val p = jquery.asInstanceOf[js.Dynamic].position().asInstanceOf[js.Dictionary[Double]] Position(p("top"), p("left")) } /** Insert content, specified by the parameter, to the beginning of each element in the set of matched elements.
* See: jQuery Docs */ - def prepend(function: (Element, Int, String) => Any): JQuery = jquery.prepend(function) + def prepend(function: (Element, Int, String) => Any): JQuery = + jquery.asInstanceOf[js.Dynamic].prepend(js.ThisFunction.fromFunction3(function)).asInstanceOf[JQuery] /** Set one or more properties for the set of matched elements.
* See: jQuery Docs */ - def prop(propertyName: String, function: (Element, Int, Any) => Any): JQuery = jquery.prop(propertyName, function) + def prop(propertyName: String, function: (Element, Int, Any) => Any): JQuery = + jquery.asInstanceOf[js.Dynamic].prop(propertyName, js.ThisFunction.fromFunction3(function)).asInstanceOf[JQuery] /** Set one or more properties for the set of matched elements.
* See: jQuery Docs */ - def prop(properties: Map[String, Any]): JQuery = jquery.prop(properties.toJSDictionary) + def prop(properties: Map[String, Any]): JQuery = + jquery.asInstanceOf[js.Dynamic].prop(properties.toJSDictionary).asInstanceOf[JQuery] /** Add a collection of DOM elements onto the jQuery stack.
* See: jQuery Docs */ - def pushStack(elements: Seq[Any]): JQuery = jquery.pushStack(elements.toJSArray) + def pushStack(elements: Seq[Any]): JQuery = + jquery.asInstanceOf[js.Dynamic].pushStack(elements.toJSArray).asInstanceOf[JQuery] /** Add a collection of DOM elements onto the jQuery stack.
* See: jQuery Docs */ - def pushStack(elements: Seq[Any], name: String, arguments: Seq[Any]): JQuery = jquery.pushStack(elements.toJSArray, name, arguments.toJSArray) + def pushStack(elements: Seq[Any], name: String, arguments: Seq[Any]): JQuery = + jquery.asInstanceOf[js.Dynamic].pushStack(elements.toJSArray, name, arguments.toJSArray).asInstanceOf[JQuery] /** Specify a function to execute when the DOM is fully loaded.
* See: jQuery Docs */ - def ready(callback: (Element) => Any): JQuery = jquery.ready(callback) + @deprecated("Use jQ(callback) instead.", "1.1.0") + def ready(callback: (Element) => Any): JQuery = + jquery.asInstanceOf[js.Dynamic].ready(js.ThisFunction.fromFunction1(callback)).asInstanceOf[JQuery] /** Remove a single class, multiple classes, or all classes from each element in the set of matched elements.
* See: jQuery Docs */ - def removeClass(function: (Int, String) => String): JQuery = jquery.removeClass(function) + def removeClass(function: (Int, String) => String): JQuery = + jquery.asInstanceOf[js.Dynamic].removeClass(function).asInstanceOf[JQuery] /** Remove a previously-stored piece of data.
* See: jQuery Docs */ - def removeData(list: String*): JQuery = jquery.removeData(list.toJSArray) + def removeData(list: String*): JQuery = + jquery.asInstanceOf[js.Dynamic].removeData(list.toJSArray).asInstanceOf[JQuery] /** Bind an event handler to the "resize" JavaScript event on an element.
* See: jQuery Docs */ @@ -1425,35 +1164,43 @@ object JQuery { /** Display the matched elements.
* See: jQuery Docs */ - def show(duration: Int, easing: EasingFunction, callback: (Element) => Any): JQuery = jquery.show(duration, easing, callback) + def show(duration: Int, easing: EasingFunction, callback: (Element) => Any): JQuery = + jquery.asInstanceOf[js.Dynamic].show(duration, easing, js.ThisFunction.fromFunction1(callback)).asInstanceOf[JQuery] /** Display the matched elements.
* See: jQuery Docs */ - def show(options: AnimationOptions): JQuery = jquery.show(options.toJSDictionary) + def show(options: AnimationOptions): JQuery = + jquery.asInstanceOf[js.Dynamic].show(options.toJSDictionary).asInstanceOf[JQuery] /** Display the matched elements with a sliding motion.
* See: jQuery Docs */ - def slideDown(duration: Int, easing: EasingFunction, callback: (Element) => Any): JQuery = jquery.slideDown(duration, easing, callback) + def slideDown(duration: Int, easing: EasingFunction, callback: (Element) => Any): JQuery = + jquery.asInstanceOf[js.Dynamic].slideDown(duration, easing, js.ThisFunction.fromFunction1(callback)).asInstanceOf[JQuery] /** Display the matched elements with a sliding motion.
* See: jQuery Docs */ - def slideDown(options: AnimationOptions): JQuery = jquery.slideDown(options.toJSDictionary) + def slideDown(options: AnimationOptions): JQuery = + jquery.asInstanceOf[js.Dynamic].slideDown(options.toJSDictionary).asInstanceOf[JQuery] /** Display or hide the matched elements with a sliding motion.
* See: jQuery Docs */ - def slideToggle(duration: Int, easing: EasingFunction, callback: (Element) => Any): JQuery = jquery.slideToggle(duration, easing, callback) + def slideToggle(duration: Int, easing: EasingFunction, callback: (Element) => Any): JQuery = + jquery.asInstanceOf[js.Dynamic].slideToggle(duration, easing, js.ThisFunction.fromFunction1(callback)).asInstanceOf[JQuery] /** Display or hide the matched elements with a sliding motion.
* See: jQuery Docs */ - def slideToggle(options: AnimationOptions): JQuery = jquery.slideToggle(options.toJSDictionary) + def slideToggle(options: AnimationOptions): JQuery = + jquery.asInstanceOf[js.Dynamic].slideToggle(options.toJSDictionary).asInstanceOf[JQuery] /** Hide the matched elements with a sliding motion.
* See: jQuery Docs */ - def slideUp(duration: Int, easing: EasingFunction, callback: (Element) => Any): JQuery = jquery.slideUp(duration, easing, callback) + def slideUp(duration: Int, easing: EasingFunction, callback: (Element) => Any): JQuery = + jquery.asInstanceOf[js.Dynamic].slideUp(duration, easing, js.ThisFunction.fromFunction1(callback)).asInstanceOf[JQuery] /** Hide the matched elements with a sliding motion.
* See: jQuery Docs */ - def slideUp(options: AnimationOptions): JQuery = jquery.slideUp(options.toJSDictionary) + def slideUp(options: AnimationOptions): JQuery = + jquery.asInstanceOf[js.Dynamic].slideUp(options.toJSDictionary).asInstanceOf[JQuery] /** Trigger submit event on an element.
* See: jQuery Docs */ @@ -1465,63 +1212,78 @@ object JQuery { /** Set the content of each element in the set of matched elements to the specified text.
* See: jQuery Docs */ - def text(function: (Element, Int, String) => String): JQuery = jquery.text(function) + def text(function: (Element, Int, String) => String): JQuery = + jquery.asInstanceOf[js.Dynamic].text(js.ThisFunction.fromFunction3(function)).asInstanceOf[JQuery] /** Retrieve all the elements contained in the jQuery set, as an array.
* See: jQuery Docs */ - def toArray: Seq[Element] = jquery.toArray().toSeq + def toArray: Seq[Element] = + jquery.asInstanceOf[js.Dynamic].toArray().asInstanceOf[js.Array[Element]].toSeq /** Display or hide the matched elements.
* See: jQuery Docs */ - def toggle(duration: Int, easing: EasingFunction, callback: (Element) => Any): JQuery = jquery.toggle(duration, easing, callback) + def toggle(duration: Int, easing: EasingFunction, callback: (Element) => Any): JQuery = + jquery.asInstanceOf[js.Dynamic].toggle(duration, easing, js.ThisFunction.fromFunction1(callback)).asInstanceOf[JQuery] /** Display or hide the matched elements.
* See: jQuery Docs */ - def toggle(options: AnimationOptions): JQuery = jquery.toggle(options.toJSDictionary) + def toggle(options: AnimationOptions): JQuery = + jquery.asInstanceOf[js.Dynamic].toggle(options.toJSDictionary).asInstanceOf[JQuery] /** Add or remove one or more classes from each element in the set of matched elements, depending on either the class's presence or the value of the state argument.
* See: jQuery Docs */ - def toggleClass(function: (Int, String, Boolean) => String): JQuery = jquery.toggleClass(function) + def toggleClass(function: (Int, String, Boolean) => String): JQuery = + jquery.asInstanceOf[js.Dynamic].toggleClass(function).asInstanceOf[JQuery] /** Add or remove one or more classes from each element in the set of matched elements, depending on either the class's presence or the value of the state argument.
* See: jQuery Docs */ - def toggleClass(function: (Int, String, Boolean) => String, state: Boolean): JQuery = jquery.toggleClass(function, state) + def toggleClass(function: (Int, String, Boolean) => String, state: Boolean): JQuery = + jquery.asInstanceOf[js.Dynamic].toggleClass(function, state).asInstanceOf[JQuery] /** Execute all handlers and behaviors attached to the matched elements for the given event type.
* See: jQuery Docs */ - def trigger(event: String | JQueryEvent, extraParams: Map[String, Any]): JQuery = jquery.trigger(event, extraParams.toJSDictionary) + def trigger(event: String | JQueryEvent, extraParams: Map[String, Any]): JQuery = + jquery.asInstanceOf[js.Dynamic].trigger(event.asInstanceOf[js.Dynamic], extraParams.toJSDictionary).asInstanceOf[JQuery] /** Execute all handlers and behaviors attached to the matched elements for the given event type.
* See: jQuery Docs */ - def trigger(event: String | JQueryEvent, extraParams: Seq[Any]): JQuery = jquery.trigger(event, extraParams.toJSArray) + def trigger(event: String | JQueryEvent, extraParams: Seq[Any]): JQuery = + jquery.asInstanceOf[js.Dynamic].trigger(event.asInstanceOf[js.Dynamic], extraParams.toJSArray).asInstanceOf[JQuery] /** Execute all handlers attached to an element for an event.
* See: jQuery Docs */ - def triggerHandler(event: String | JQueryEvent, extraParams: Map[String, Any]): JQuery = jquery.triggerHandler(event, extraParams.toJSDictionary) + def triggerHandler(event: String | JQueryEvent, extraParams: Map[String, Any]): JQuery = + jquery.asInstanceOf[js.Dynamic].triggerHandler(event.asInstanceOf[js.Dynamic], extraParams.toJSDictionary).asInstanceOf[JQuery] /** Execute all handlers attached to an element for an event.
* See: jQuery Docs */ - def triggerHandler(event: String | JQueryEvent, extraParams: Seq[Any]): JQuery = jquery.triggerHandler(event, extraParams.toJSArray) + def triggerHandler(event: String | JQueryEvent, extraParams: Seq[Any]): JQuery = + jquery.asInstanceOf[js.Dynamic].triggerHandler(event.asInstanceOf[js.Dynamic], extraParams.toJSArray).asInstanceOf[JQuery] /** Set the value of each element in the set of matched elements.
* See: jQuery Docs */ - def value(function: (Element, Int, String) => String): JQuery = jquery.value(function) + def value(function: (Element, Int, String) => String): JQuery = + jquery.asInstanceOf[js.Dynamic].value(js.ThisFunction.fromFunction3(function)).asInstanceOf[JQuery] /** Set the CSS width of each element in the set of matched elements.
* See: jQuery Docs */ - def width(function: (Element, Int, Int) => String | Int | Double): JQuery = jquery.width(function) + def width(function: (Element, Int, Int) => String | Int | Double): JQuery = + jquery.asInstanceOf[js.Dynamic].width(js.ThisFunction.fromFunction3(function)).asInstanceOf[JQuery] /** Wrap an HTML structure around each element in the set of matched elements.
* See: jQuery Docs */ - def wrap(function: (Element, Int) => String | JQuery): JQuery = jquery.wrap(function) + def wrap(function: (Element, Int) => String | JQuery): JQuery = + jquery.asInstanceOf[js.Dynamic].wrap(js.ThisFunction.fromFunction2(function)).asInstanceOf[JQuery] /** Wrap an HTML structure around all elements in the set of matched elements.
* See: jQuery Docs */ - def wrapAll(function: (Element, Int) => String | JQuery): JQuery = jquery.wrapAll(function) + def wrapAll(function: (Element, Int) => String | JQuery): JQuery = + jquery.asInstanceOf[js.Dynamic].wrapAll(js.ThisFunction.fromFunction2(function)).asInstanceOf[JQuery] /** Wrap an HTML structure around the content of each element in the set of matched elements.
* See: jQuery Docs */ - def wrapInner(function: (Element, Int) => String | JQuery): JQuery = jquery.wrapInner(function) + def wrapInner(function: (Element, Int) => String | JQuery): JQuery = + jquery.asInstanceOf[js.Dynamic].wrapInner(js.ThisFunction.fromFunction2(function)).asInstanceOf[JQuery] } } diff --git a/src/main/scala/io/udash/wrappers/jquery/JQueryDeferred.scala b/src/main/scala/io/udash/wrappers/jquery/JQueryDeferred.scala index da307ea..0695953 100644 --- a/src/main/scala/io/udash/wrappers/jquery/JQueryDeferred.scala +++ b/src/main/scala/io/udash/wrappers/jquery/JQueryDeferred.scala @@ -29,11 +29,7 @@ trait JQueryPromise[FunType <: js.Function1[ArgType, js.Any], ArgType] extends j /** Add handlers to be called when the Deferred object is resolved, rejected, or still in progress.
* See: jQuery Docs */ // Usage of then as identifier is deprecated. It can be used as a keyword in future versions of scala. - // def then(done: FunType, fail: FunType, progress: FunType): JQueryDeferred[FunType, ArgType] = js.native - - /** Determine the current state of a Deferred object.
- * See: jQuery Docs */ - private[jquery] def state: String = js.native + def `then`(done: FunType, fail: FunType, progress: FunType): JQueryDeferred[FunType, ArgType] = js.native } @@ -74,7 +70,7 @@ object JQueryPromise { implicit class JQueryPromiseExt(jQueryPromise: JQueryPromise[_, _]) { /** Determine the current state of a Deferred object.
* See: jQuery Docs */ - def state: JQueryDeferredState = jQueryPromise.state match { + def state: JQueryDeferredState = jQueryPromise.asInstanceOf[js.Dynamic].state.asInstanceOf[String] match { case "pending" => JQueryDeferredPending case "resolved" => JQueryDeferredResolved case "rejected" => JQueryDeferredRejected diff --git a/src/main/scala/io/udash/wrappers/jquery/JQueryStatic.scala b/src/main/scala/io/udash/wrappers/jquery/JQueryStatic.scala index b659bea..f4d4ac3 100644 --- a/src/main/scala/io/udash/wrappers/jquery/JQueryStatic.scala +++ b/src/main/scala/io/udash/wrappers/jquery/JQueryStatic.scala @@ -29,10 +29,6 @@ trait JQueryStatic extends js.Object { * See: jQuery Docs */ def apply(`object`: js.Any): JQuery = js.native - /** Return a collection of matched elements either found in the DOM based on passed argument(s) or created by passing an HTML string.
- * See: jQuery Docs */ - private[jquery] def apply(elementArray: js.Array[Element]): JQuery = js.native - /** Return a collection of matched elements either found in the DOM based on passed argument(s) or created by passing an HTML string.
* See: jQuery Docs */ def apply(jq: JQuery): JQuery = js.native @@ -57,14 +53,6 @@ trait JQueryStatic extends js.Object { * See: jQuery Docs */ def ajax(url: String, settings: JQueryAjaxSettings = js.native): JQueryXHR = js.native - /** Handle custom Ajax options or modify existing options before each request is sent and before they are processed by `.ajax()`.
- * See: jQuery Docs */ - private[jquery] def ajaxPrefilter(dataTypes: String, handler: js.Function3[js.Dynamic, js.Dynamic, JQueryXHR, js.Any]): Unit = js.native - - /** Creates an object that handles the actual transmission of Ajax data.
- * See: jQuery Docs */ - private[jquery] def ajaxTransport(tpe: String, handler: js.Function3[js.Dynamic, js.Dynamic, JQueryXHR, js.Any]): Unit = js.native - /** A multi-purpose callbacks list object that provides a powerful way to manage callback lists.
* See: jQuery Docs */ @JSName("Callbacks") @@ -88,52 +76,30 @@ trait JQueryStatic extends js.Object { * See: jQuery Docs */ def dequeue(element: Element, queueName: String): Unit = js.native - /** A generic iterator function, which can be used to seamlessly iterate over both objects and arrays. Arrays and - * array-like objects with a length property (such as a function's arguments object) are iterated by numeric index, - * from 0 to length-1. Other objects are iterated via their named properties.
- * See: jQuery Docs */ - private[jquery] def each[T](array: js.Array[T], callback: js.Function2[Int, T, js.Any]): Unit = js.native - - /** A generic iterator function, which can be used to seamlessly iterate over both objects and arrays. Arrays and - * array-like objects with a length property (such as a function's arguments object) are iterated by numeric index, - * from 0 to length-1. Other objects are iterated via their named properties.
- * See: jQuery Docs */ - private[jquery] def each(obj: js.Any, callback: js.Function2[String, js.Any, js.Any]): Unit = js.native + /** Escapes any character that has a special meaning in a CSS selector.
+ * See: jQuery Docs */ + def escapeSelector(index: Int): JQuery = js.native /** Load data from the server using a HTTP GET request.
* See: jQuery Docs */ def get(settings: JQueryAjaxSettings): Unit = js.native - /** Load data from the server using a HTTP GET request.
- * See: jQuery Docs */ - private[jquery] def get(url: String, data: js.Any | String = js.native, success: js.Function3[js.Dynamic, String, JQueryXHR, js.Any] = js.native, dataType: String = js.native): JQueryXHR = js.native - - /** Load a JavaScript file from the server using a GET HTTP request, then execute it.
- * See: jQuery Docs */ - private[jquery] def getScript(url: String, success: (String, String, JQueryXHR) => js.Any): JQueryXHR = js.native - /** Execute some JavaScript code globally.
* See: jQuery Docs */ def globalEval(code: String): Unit = js.native - /** Finds the elements of an array which satisfy a filter function. The original array is not affected.
- * See: jQuery Docs */ - private[jquery] def grep[T](array: js.Array[T], function: js.Function2[T, Int, Boolean], invert: Boolean): js.Array[T] = js.native - /** Determine whether an element has any jQuery data associated with it.
* See: jQuery Docs */ def hasData(element: Element): Boolean = js.native /** Determine whether an element has any jQuery data associated with it.
* See: jQuery Docs */ + @deprecated("Since jQuery 3.2.0", "1.1.0") def holdReady(hold: Boolean): Unit = js.native - /** Search for a specified value within an array and return its index (or -1 if not found).
- * See: jQuery Docs */ - private[jquery] def inArray[T](value: T, array: js.Array[T], fromIndex: Int): Int = js.native - /** Determine whether the argument is an array.
* See: jQuery Docs */ + @deprecated("Since jQuery 3.2.0", "1.1.0") def isArray[T](el: js.Any): Boolean = js.native /** Check to see if an object is empty (contains no enumerable properties).
@@ -166,6 +132,7 @@ trait JQueryStatic extends js.Object { /** Takes a well-formed JSON string and returns the resulting JavaScript value.
* See: jQuery Docs */ + @deprecated("Since all the browsers supported by jQuery 3.0 support the native JSON.parse() method, we are deprecating jQuery.parseJSON().", "1.1.0") def parseJSON(json: String): js.Any = js.native /** Parses a string into an XML document.
@@ -178,8 +145,13 @@ trait JQueryStatic extends js.Object { /** Sorts an array of DOM elements, in place, with the duplicates removed. Note that this only works on arrays of DOM elements, not strings or numbers.
* See: jQuery Docs */ + @deprecated("The jQuery.unique() method has been renamed to jQuery.uniqueSort() to make its behavior easier to understand.", "1.1.0") def unique[T](array: js.Array[T]): js.Array[T] = js.native + /** Sorts an array of DOM elements, in place, with the duplicates removed. Note that this only works on arrays of DOM elements, not strings or numbers.
+ * See: jQuery Docs */ + def uniqueSort[T](array: js.Array[T]): js.Array[T] = js.native + /** Provides a way to execute callback functions based on one or more objects, usually Deferred objects that represent asynchronous events.
* See: jQuery Docs */ def when[FunType <: js.Function1[ArgType, js.Any], ArgType](deferred: JQueryDeferred[FunType, ArgType]*): JQueryPromise[FunType, ArgType] = js.native @@ -206,49 +178,56 @@ object JQueryStatic { /** Handle custom Ajax options or modify existing options before each request is sent and before they are processed by `.ajax()`.
* See: jQuery Docs */ - def ajaxPrefilter(dataTypes: String, handler: (js.Dynamic, js.Dynamic, JQueryXHR) => js.Any): Unit = jQueryStatic.ajaxPrefilter(dataTypes, handler) + def ajaxPrefilter(dataTypes: String, handler: (js.Dynamic, js.Dynamic, JQueryXHR) => js.Any): Unit = + jQueryStatic.asInstanceOf[js.Dynamic].ajaxPrefilter(dataTypes, handler) /** Creates an object that handles the actual transmission of Ajax data.
* See: jQuery Docs */ - def ajaxTransport(tpe: String, handler: (js.Dynamic, js.Dynamic, JQueryXHR) => js.Any): Unit = jQueryStatic.ajaxTransport(tpe, handler) + def ajaxTransport(tpe: String, handler: (js.Dynamic, js.Dynamic, JQueryXHR) => js.Any): Unit = + jQueryStatic.asInstanceOf[js.Dynamic].ajaxTransport(tpe, handler) /** A generic iterator function, which can be used to seamlessly iterate over both objects and arrays. Arrays and * array-like objects with a length property (such as a function's arguments object) are iterated by numeric index, * from 0 to length-1. Other objects are iterated via their named properties.
* See: jQuery Docs */ - def each[T](array: Seq[T], callback: (Int, T) => js.Any): Unit = jQueryStatic.each[T](array.toJSArray, callback) + def each[T](array: Seq[T], callback: (Int, T) => js.Any): Unit = + jQueryStatic.asInstanceOf[js.Dynamic].each(array.toJSArray, callback) /** A generic iterator function, which can be used to seamlessly iterate over both objects and arrays. Arrays and * array-like objects with a length property (such as a function's arguments object) are iterated by numeric index, * from 0 to length-1. Other objects are iterated via their named properties.
* See: jQuery Docs */ - def each(obj: js.Any, callback: (String, js.Any) => js.Any): Unit = jQueryStatic.each(obj, callback) + def each(obj: js.Any, callback: (String, js.Any) => js.Any): Unit = + jQueryStatic.asInstanceOf[js.Dynamic].each(obj, callback) /** Load data from the server using a HTTP GET request.
* See: jQuery Docs */ def get[T](url: String, data: js.Any, success: (T, String, JQueryXHR) => js.Any, dataType: String): JQueryXHR = { val callback = (data: js.Dynamic, status: String, xhr: JQueryXHR) => success(data.asInstanceOf[T], status, xhr) - jQueryStatic.get(url, data, callback, dataType) + jQueryStatic.asInstanceOf[js.Dynamic].get(url, data, callback, dataType).asInstanceOf[JQueryXHR] } /** Load JSON-encoded data from the server using a GET HTTP request.
* See: jQuery Docs */ def getJSON[T](url: String, data: js.Any, success: (T, String, JQueryXHR) => js.Any): JQueryXHR = { val callback = (data: js.Dynamic, status: String, xhr: JQueryXHR) => success(data.asInstanceOf[T], status, xhr) - jQueryStatic.get(url, data, callback, "json") + jQueryStatic.asInstanceOf[js.Dynamic].get(url, data, callback, "json").asInstanceOf[JQueryXHR] } /** Load a JavaScript file from the server using a GET HTTP request, then execute it.
* See: jQuery Docs */ - def getScript(url: String, success: (String, String, JQueryXHR) => js.Any): JQueryXHR = jQueryStatic.getScript(url, success) + def getScript(url: String, success: (String, String, JQueryXHR) => js.Any): JQueryXHR = + jQueryStatic.asInstanceOf[js.Dynamic].getScript(url, success).asInstanceOf[JQueryXHR] /** Finds the elements of an array which satisfy a filter function. The original array is not affected.
* See: jQuery Docs */ - def grep[T](array: Seq[T], function: (T, Int) => Boolean, invert: Boolean = false): js.Array[T] = jQueryStatic.grep[T](array.toJSArray, function, invert) + def grep[T](array: Seq[T], function: (T, Int) => Boolean, invert: Boolean = false): Seq[T] = + jQueryStatic.asInstanceOf[js.Dynamic].grep(array.toJSArray, function, invert).asInstanceOf[js.Array[T]].toSeq /** Search for a specified value within an array and return its index (or -1 if not found).
* See: jQuery Docs */ - def inArray[T](value: T, array: Seq[T], fromIndex: Int): Int = jQueryStatic.inArray(value, array.toJSArray, fromIndex) + def inArray[T](value: T, array: Seq[T], fromIndex: Int): Int = + jQueryStatic.asInstanceOf[js.Dynamic].inArray(value.asInstanceOf[js.Dynamic], array.toJSArray, fromIndex).asInstanceOf[Int] def parse(data: String) = { jQ(jQueryStatic.parseHTML(data)(0)) From 7608242c7ee6e15aec50b31003be2e3dc47e1735 Mon Sep 17 00:00:00 2001 From: Starzu Date: Mon, 3 Jul 2017 08:49:29 +0200 Subject: [PATCH 2/4] Demo upgrade --- example/build.sbt | 20 +++++++++---------- example/project/Dependencies.scala | 9 +++------ example/project/UdashBuild.scala | 2 +- example/project/build.properties | 2 +- example/project/plugins.sbt | 2 +- example/src/main/assets/index.dev.html | 1 - example/src/main/assets/index.prod.html | 1 - .../scala/io/udash/demos/jquery/init.scala | 6 +++--- 8 files changed, 19 insertions(+), 24 deletions(-) diff --git a/example/build.sbt b/example/build.sbt index 19f5556..3cbf20d 100644 --- a/example/build.sbt +++ b/example/build.sbt @@ -1,7 +1,10 @@ +import UdashBuild._ +import Dependencies._ + name := "jquery-demo" -version in ThisBuild := "1.0.1-SNAPSHOT" -scalaVersion in ThisBuild := "2.11.8" +version in ThisBuild := "1.1.0" +scalaVersion in ThisBuild := "2.12.2" organization in ThisBuild := "io.udash" crossPaths in ThisBuild := false scalacOptions in ThisBuild ++= Seq( @@ -12,29 +15,28 @@ scalacOptions in ThisBuild ++= Seq( "-language:existentials", "-language:dynamics", "-Xfuture", - "-Xfatal-warnings", - "-Xlint:_,-missing-interpolator,-adapted-args" + "-Xfatal-warnings" ) val generatedDir = file("generated") val `jquery-demo` = project.in(file(".")).enablePlugins(ScalaJSPlugin) .settings( libraryDependencies ++= deps.value, - persistLauncher in Compile := true, /* move these files out of target/. */ crossTarget in (Compile, fullOptJS) := generatedDir, crossTarget in (Compile, fastOptJS) := generatedDir, crossTarget in (Compile, packageJSDependencies) := generatedDir, - crossTarget in (Compile, packageScalaJSLauncher) := generatedDir, crossTarget in (Compile, packageMinifiedJSDependencies) := generatedDir, - compile <<= (compile in Compile).dependsOn(compileStatics), + compile := (compile in Compile).dependsOn(compileStatics).value, compileStatics := { compileStaticsForRelease.value (crossTarget.value / StaticFilesDir).***.get }, + scalaJSUseMainModuleInitializer := true, + artifactPath in(Compile, fastOptJS) := (crossTarget in(Compile, fastOptJS)).value / StaticFilesDir / WebContent / "scripts" / "frontend-impl-fast.js", artifactPath in(Compile, fullOptJS) := @@ -42,7 +44,5 @@ val `jquery-demo` = project.in(file(".")).enablePlugins(ScalaJSPlugin) artifactPath in(Compile, packageJSDependencies) := (crossTarget in(Compile, packageJSDependencies)).value / StaticFilesDir / WebContent / "scripts" / "frontend-deps-fast.js", artifactPath in(Compile, packageMinifiedJSDependencies) := - (crossTarget in(Compile, packageMinifiedJSDependencies)).value / StaticFilesDir / WebContent / "scripts" / "frontend-deps.js", - artifactPath in(Compile, packageScalaJSLauncher) := - (crossTarget in(Compile, packageScalaJSLauncher)).value / StaticFilesDir / WebContent / "scripts" / "frontend-init.js" + (crossTarget in(Compile, packageMinifiedJSDependencies)).value / StaticFilesDir / WebContent / "scripts" / "frontend-deps.js" ) \ No newline at end of file diff --git a/example/project/Dependencies.scala b/example/project/Dependencies.scala index 9364f20..946b5be 100644 --- a/example/project/Dependencies.scala +++ b/example/project/Dependencies.scala @@ -1,15 +1,12 @@ import org.scalajs.sbtplugin.ScalaJSPlugin.autoImport._ import sbt._ -object Dependencies extends Build { - val udashCoreVersion = "0.4.0" - val udashJQueryVersion = "1.0.1" +object Dependencies { + val udashCoreVersion = "0.5.0" + val udashJQueryVersion = "1.1.0" val deps = Def.setting(Seq[ModuleID]( "io.udash" %%% "udash-core-frontend" % udashCoreVersion, "io.udash" %%% "udash-jquery" % udashJQueryVersion )) - - val depsJS = Def.setting(Seq[org.scalajs.sbtplugin.JSModuleID]( - )) } \ No newline at end of file diff --git a/example/project/UdashBuild.scala b/example/project/UdashBuild.scala index 464b556..f58e7c3 100644 --- a/example/project/UdashBuild.scala +++ b/example/project/UdashBuild.scala @@ -2,7 +2,7 @@ import org.scalajs.sbtplugin.ScalaJSPlugin.AutoImport._ import sbt.Keys._ import sbt._ -object UdashBuild extends Build { +object UdashBuild { val StaticFilesDir = "UdashStatic" val WebContent = "WebContent" diff --git a/example/project/build.properties b/example/project/build.properties index e0cbc71..6be4958 100644 --- a/example/project/build.properties +++ b/example/project/build.properties @@ -1 +1 @@ -sbt.version = 0.13.13 \ No newline at end of file +sbt.version = 0.13.15 \ No newline at end of file diff --git a/example/project/plugins.sbt b/example/project/plugins.sbt index 26a69b3..68fe409 100644 --- a/example/project/plugins.sbt +++ b/example/project/plugins.sbt @@ -1,2 +1,2 @@ logLevel := Level.Warn -addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.13") \ No newline at end of file +addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.18") \ No newline at end of file diff --git a/example/src/main/assets/index.dev.html b/example/src/main/assets/index.dev.html index 72b62d5..ce52d69 100644 --- a/example/src/main/assets/index.dev.html +++ b/example/src/main/assets/index.dev.html @@ -6,7 +6,6 @@ - diff --git a/example/src/main/assets/index.prod.html b/example/src/main/assets/index.prod.html index 9c2609e..187b36d 100644 --- a/example/src/main/assets/index.prod.html +++ b/example/src/main/assets/index.prod.html @@ -6,7 +6,6 @@ - diff --git a/example/src/main/scala/io/udash/demos/jquery/init.scala b/example/src/main/scala/io/udash/demos/jquery/init.scala index 8bbe6ce..30d7f4b 100644 --- a/example/src/main/scala/io/udash/demos/jquery/init.scala +++ b/example/src/main/scala/io/udash/demos/jquery/init.scala @@ -16,12 +16,12 @@ object Context { implicit val applicationInstance = new Application[RoutingState](routingRegistry, viewPresenterRegistry, RootState) } -object Init extends JSApp { +object Init { import Context._ @JSExport - override def main(): Unit = { - jQ(document).ready((_: Element) => { + def main(args: Array[String]): Unit = { + jQ((_: Element) => { val appRoot = jQ("#application").get(0) if (appRoot.isEmpty) { dom.console.error("Application root element not found! Check you index.html file!") From d51b0334948e57f3354546b947967853ee3fd114 Mon Sep 17 00:00:00 2001 From: Starzu Date: Mon, 3 Jul 2017 08:50:22 +0200 Subject: [PATCH 3/4] Travis build configuration --- .travis.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 556f7d1..5a5db0c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,8 +3,8 @@ dist: trusty jdk: oraclejdk8 scala: - - 2.11.8 - - 2.12.1 + - 2.11.11 + - 2.12.2 before_script: - "export DISPLAY=:99.0" @@ -24,4 +24,4 @@ before_script: script: - sbt ++$TRAVIS_SCALA_VERSION "set (jsEnv in Test := new org.scalajs.jsenv.selenium.SeleniumJSEnv(org.scalajs.jsenv.selenium.Chrome))" test - sbt ++$TRAVIS_SCALA_VERSION publishLocal - # - cd example && sbt ++$TRAVIS_SCALA_VERSION compile \ No newline at end of file + - cd example && sbt ++$TRAVIS_SCALA_VERSION compile \ No newline at end of file From 33226e1d710d251e548148c5427a2a2dc81a3a22 Mon Sep 17 00:00:00 2001 From: Starzu Date: Mon, 3 Jul 2017 08:51:28 +0200 Subject: [PATCH 4/4] README update --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index fca8785..9918489 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ Static types for the jQuery API for [Scala.js](http://www.scala-js.org/) program Add the following to your SBT build: ```scala -libraryDependencies += "io.udash" %%% "udash-jquery" % "1.0.0" +libraryDependencies += "io.udash" %%% "udash-jquery" % "1.1.0" ``` then import the jQuery package: