Skip to content

Commit ad6342a

Browse files
authored
upgrade jQuery to 3.6.4 (#33)
* upgrade jQuery to 3.6.4 due to CVE-2020-11022, CVE-2020-23064, CVE-2020-11023 vulnerabilities * upgrade scalaJs, add jQuery methods * upgrade webpack to 5.75.0 * move webpack version declaration * add "even/odd matching element" test case * refactor test * refactor test
1 parent 6d8ee18 commit ad6342a

File tree

6 files changed

+32
-7
lines changed

6 files changed

+32
-7
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Static types for the jQuery API for [Scala.js](http://www.scala-js.org/) program
1010
Add the following dependency to your SBT build:
1111

1212
```scala
13-
libraryDependencies += "io.udash" %%% "udash-jquery" % "3.0.4"
13+
libraryDependencies += "io.udash" %%% "udash-jquery" % "3.2.0"
1414
```
1515

1616
then import the jQuery package:

build.sbt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ val commonJSSettings = Seq(
3333
val githubDir = "https://raw.githubusercontent.com/UdashFramework/scala-js-jquery"
3434
s"-P:scalajs:mapSourceURI:$localDir->$githubDir/v${version.value}/"
3535
},
36+
webpack / version := "5.75.0", // TODO: can be removed when sbt-scalajs-bundler > 0.21.1
3637
)
3738

3839
val deploymentConfiguration = Seq(
@@ -80,11 +81,11 @@ lazy val root = project.in(file("."))
8081
deploymentConfiguration,
8182

8283
libraryDependencies ++= Seq(
83-
"org.scala-js" %%% "scalajs-dom" % "2.0.0",
84+
"org.scala-js" %%% "scalajs-dom" % "2.7.0",
8485
"org.scalatest" %%% "scalatest" % "3.2.9" % Test,
8586
"com.lihaoyi" %%% "scalatags" % "0.10.0" % Test
8687
),
8788

88-
Compile / npmDependencies += "jquery" -> "3.4.1",
89-
jsDependencies += "org.webjars" % "jquery" % "3.4.1" / "3.4.1/jquery.js" minified s"3.4.1/jquery.min.js",
89+
Compile / npmDependencies += "jquery" -> "3.6.4",
90+
jsDependencies += "org.webjars" % "jquery" % "3.6.4" / "3.6.4/jquery.js" minified s"3.6.4/jquery.min.js",
9091
)

project/build.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
# suppress inspection "UnusedProperty"
2-
sbt.version=1.5.5
2+
sbt.version=1.9.2

project/plugins.sbt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
logLevel := Level.Warn
22

3-
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.7.0")
4-
addSbtPlugin("ch.epfl.scala" % "sbt-scalajs-bundler" % "0.20.0")
3+
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.13.2")
4+
addSbtPlugin("ch.epfl.scala" % "sbt-scalajs-bundler" % "0.21.1")
55
addSbtPlugin("org.scala-js" % "sbt-jsdependencies" % "1.0.2")
66

77
// Deployment configuration

src/main/scala/io/udash/wrappers/jquery/JQuery.scala

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,10 @@ trait JQuery extends js.Object {
164164
@JSName("eq")
165165
def at(index: Int): JQuery = js.native
166166

167+
/** Reduce the set of matched elements to the even ones in the set, numbered from zero. <br/>
168+
* See: <a href="http://api.jquery.com/even/">jQuery Docs</a> */
169+
def even(): JQuery = js.native
170+
167171
/** Display the matched elements by fading them to opaque. <br/>
168172
* See: <a href="http://api.jquery.com/fadeIn/">jQuery Docs</a> */
169173
def fadeIn(duration: Int = js.native, easing: EasingFunction = js.native): JQuery = js.native
@@ -381,6 +385,10 @@ trait JQuery extends js.Object {
381385
* See: <a href="http://api.jquery.com/not/">jQuery Docs</a> */
382386
def not(el: Element*): JQuery = js.native
383387

388+
/** Reduce the set of matched elements to the odd ones in the set, numbered from zero. <br/>
389+
* See: <a href="http://api.jquery.com/odd/">jQuery Docs</a> */
390+
def odd(): JQuery = js.native
391+
384392
/** Remove an event handler. <br/>
385393
* See: <a href="http://api.jquery.com/off/">jQuery Docs</a> */
386394
def off(): JQuery = js.native

src/test/scala/io/udash/wrappers/jquery_test/TraversingTest.scala

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,5 +166,21 @@ class TraversingTest extends AnyWordSpec with Matchers {
166166
root.children("a").first().length should be(0)
167167
root.children("a").last().length should be(0)
168168
}
169+
170+
"even/odd matching element" in {
171+
val dom = div(
172+
span("0"),
173+
span("1"),
174+
span("2"),
175+
span("3"),
176+
span("4"),
177+
span("5"),
178+
).render
179+
180+
val root = jQ(dom)
181+
root.children("span").even().text() shouldBe "024"
182+
root.children("span").odd().text() shouldBe "135"
183+
}
184+
169185
}
170186
}

0 commit comments

Comments
 (0)