Skip to content

Commit ff11655

Browse files
authored
Merge branch 'master' into srcObject
2 parents 053820e + 22e4a70 commit ff11655

File tree

13 files changed

+225
-61
lines changed

13 files changed

+225
-61
lines changed

.github/workflows/ci.yml

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: CI
2+
on:
3+
push:
4+
branches:
5+
- master
6+
pull_request:
7+
branches:
8+
- master
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
scalaversion: ["2.11.12", "2.12.10", "2.13.1"]
16+
scalajsversion: ["1.x", "0.6.x"]
17+
include:
18+
- scalaversion: "2.10.7"
19+
scalajsversion: "0.6.x"
20+
env:
21+
SCALAJS_VERSION: "${{ matrix.scalajsversion == '0.6.x' && '0.6.28' || '' }}"
22+
steps:
23+
- uses: actions/checkout@v2
24+
- uses: olafurpg/setup-scala@v10
25+
with:
26+
java-version: "[email protected]"
27+
- uses: coursier/cache-action@v5
28+
- name: Build
29+
run: sbt "++${{ matrix.scalaversion }}" package
30+
- name: Test generate documentation
31+
run: sbt "++${{ matrix.scalaversion }}" doc
32+
- name: Build examples
33+
run: sbt "++${{ matrix.scalaversion }}" example/compile
34+
- name: scalafmt
35+
run: sbt "++${{ matrix.scalaversion }}" scalafmtCheck
36+
readme:
37+
runs-on: ubuntu-latest
38+
steps:
39+
- uses: actions/checkout@v2
40+
- uses: olafurpg/setup-scala@v10
41+
with:
42+
java-version: "[email protected]"
43+
- uses: coursier/cache-action@v5
44+
- name: Readme generation
45+
run: sbt readme/run

.github/workflows/ghpages.yml

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
2+
name: Build and Deploy GhPages docs
3+
4+
on:
5+
push:
6+
branches:
7+
- master
8+
9+
jobs:
10+
build-and-deploy:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v2
14+
- uses: olafurpg/setup-scala@v10
15+
with:
16+
java-version: "[email protected]"
17+
- uses: coursier/cache-action@v5
18+
19+
- name: Build
20+
run: sbt readme/run
21+
22+
- name: Deploy
23+
uses: JamesIves/[email protected]
24+
with:
25+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
26+
BRANCH: gh-pages
27+
FOLDER: readme/target/scalatex

.travis.yml

-33
This file was deleted.

build.sbt

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ crossScalaVersions in ThisBuild := {
1212
scalaVersion in ThisBuild := crossScalaVersions.value.head
1313

1414
val commonSettings = Seq(
15-
version := "1.0.1-SNAPSHOT",
15+
version := "1.2.0-SNAPSHOT",
1616
organization := "org.scala-js",
1717
scalacOptions ++= Seq("-deprecation", "-feature", "-Xfatal-warnings")
1818
)

example/src/main/scala/example/Example.scala

+4-6
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,8 @@ object XMLHttpRequest{
123123
@JSExport
124124
def main(pre: html.Pre) = {
125125
val xhr = new dom.XMLHttpRequest()
126-
xhr.open("GET",
127-
"http://api.openweathermap.org/" +
128-
"data/2.5/weather?q=Singapore"
126+
xhr.open("GET",
127+
"https://www.boredapi.com/api/activity"
129128
)
130129
xhr.onload = { (e: dom.Event) =>
131130
if (xhr.status == 200) {
@@ -142,7 +141,7 @@ object Websocket {
142141
@JSExport
143142
def main(in: html.Input,
144143
pre: html.Pre) = {
145-
val echo = "ws://echo.websocket.org"
144+
val echo = "wss://echo.websocket.org"
146145
val socket = new dom.WebSocket(echo)
147146
socket.onmessage = {
148147
(e: dom.MessageEvent) =>
@@ -167,8 +166,7 @@ object AjaxExtension {
167166
.Implicits
168167
.global
169168
val url =
170-
"http://api.openweathermap.org/" +
171-
"data/2.5/weather?q=Singapore"
169+
"https://www.boredapi.com/api/activity"
172170
Ajax.get(url).foreach { case xhr =>
173171
pre.textContent = xhr.responseText
174172
}

project/build.sbt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
val scalaJSVersion =
2-
Option(System.getenv("SCALAJS_VERSION")).getOrElse("1.0.0")
2+
Option(System.getenv("SCALAJS_VERSION")).filter(_ != "").getOrElse("1.0.0")
33

44
addSbtPlugin("org.scala-js" % "sbt-scalajs" % scalaJSVersion)
55

readme/Index.scalatex

+4-4
Original file line numberDiff line numberDiff line change
@@ -48,17 +48,17 @@
4848
@pair("Alert", Nil)
4949

5050
@p
51-
Will cause a javascript alert box saying `HAI` to appear. Other javascript classes and objects can be similarly accessed e.g. @hl.scala{new dom.XMLHttpRequest()} to perform a new Ajax request, @hl.scala{dom.document} to access the global @hl.scala{document} object, or @hl.scala{html.Div} to to refer to the type of a @hl.scala{<div>} element.
51+
Will cause a javascript alert box saying `Hi from Scala-js-dom` to appear. Other javascript classes and objects can be similarly accessed e.g. @hl.scala{new dom.XMLHttpRequest()} to perform a new Ajax request, @hl.scala{dom.document} to access the global @hl.scala{document} object, or @hl.scala{html.Div} to to refer to the type of a @hl.scala{<div>} element.
5252

5353
@sect{Usage}
5454
@p
5555
Add the following to your sbt build definition:
5656

5757
@hl.scala
58-
libraryDependencies += "org.scala-js" %%% "scalajs-dom" % "1.0.0"
58+
libraryDependencies += "org.scala-js" %%% "scalajs-dom" % "1.1.0"
5959

6060
@p
61-
then enjoy the types available in @hl.scala{org.scalajs.dom}. scalajs-dom 1.0.0 is built and published for Scala.js 0.6.17+ and Scala.js 1.0.0+, with Scala 2.10, 2.11, 2.12 and 2.13.
61+
then enjoy the types available in @hl.scala{org.scalajs.dom}. scalajs-dom 1.1.0 is built and published for Scala.js 0.6.17+ and Scala.js 1.0.0+, with Scala 2.10, 2.11, 2.12 and 2.13.
6262

6363
@p
6464
To begin with, @code{scala-js-dom} organizes the full-list of DOM APIs into a number of buckets:
@@ -90,7 +90,7 @@
9090
@sect{Node.onmousemove}
9191
@pair(
9292
"EventHandler",
93-
Seq(pre("pre")),
93+
Seq(pre("Hover this box!")),
9494
autorun=true
9595
)
9696

src/main/scala/org/scalajs/dom/experimental/Fetch.scala

+13-13
Original file line numberDiff line numberDiff line change
@@ -80,29 +80,29 @@ class Request(input: RequestInfo, init: RequestInit = null) extends js.Object {
8080
* the types.
8181
*/
8282
trait RequestInit extends js.Object {
83-
var method: js.UndefOr[HttpMethod]
83+
var method: js.UndefOr[HttpMethod] = js.undefined
8484

85-
var headers: js.UndefOr[HeadersInit]
85+
var headers: js.UndefOr[HeadersInit] = js.undefined
8686

87-
var body: js.UndefOr[BodyInit]
87+
var body: js.UndefOr[BodyInit] = js.undefined
8888

89-
var referrer: js.UndefOr[String]
89+
var referrer: js.UndefOr[String] = js.undefined
9090

91-
var referrerPolicy: js.UndefOr[ReferrerPolicy]
91+
var referrerPolicy: js.UndefOr[ReferrerPolicy] = js.undefined
9292

93-
var mode: js.UndefOr[RequestMode]
93+
var mode: js.UndefOr[RequestMode] = js.undefined
9494

95-
var credentials: js.UndefOr[RequestCredentials]
95+
var credentials: js.UndefOr[RequestCredentials] = js.undefined
9696

97-
var cache: js.UndefOr[RequestCache]
97+
var cache: js.UndefOr[RequestCache] = js.undefined
9898

99-
var redirect: js.UndefOr[RequestRedirect]
99+
var redirect: js.UndefOr[RequestRedirect] = js.undefined
100100

101-
var integrity: js.UndefOr[String]
101+
var integrity: js.UndefOr[String] = js.undefined
102102

103-
var keepalive: js.UndefOr[Boolean]
103+
var keepalive: js.UndefOr[Boolean] = js.undefined
104104

105-
var signal: js.UndefOr[AbortSignal]
105+
var signal: js.UndefOr[AbortSignal] = js.undefined
106106

107107
/**
108108
* The whatwg spec section on [[https://fetch.spec.whatwg.org/#requestinit RequestInit dictionary]]
@@ -111,7 +111,7 @@ trait RequestInit extends js.Object {
111111
* it says even more clearly:
112112
* "If init's window member is present and it is not null, throw a TypeError."
113113
*/
114-
var window: js.UndefOr[Null]
114+
var window: js.UndefOr[Null] = js.undefined
115115
}
116116

117117
/**

src/main/scala/org/scalajs/dom/experimental/sharedworkers/SharedWorkerGlobalScope.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ trait SharedWorkerGlobalScope extends WorkerGlobalScope {
4444
*
4545
* MDN
4646
*/
47-
var onconnect: Function1[ExtendableMessageEvent, _] = js.native
47+
var onconnect: js.Function1[ExtendableMessageEvent, _] = js.native
4848
}
4949

5050
@js.native

src/main/scala/org/scalajs/dom/ext/Extensions.scala

+6
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,12 @@ object Ajax {
243243
apply("PUT", url, data, timeout, headers, withCredentials, responseType)
244244
}
245245

246+
def patch(url: String, data: InputData = null, timeout: Int = 0,
247+
headers: Map[String, String] = Map.empty,
248+
withCredentials: Boolean = false, responseType: String = "") = {
249+
apply("PATCH", url, data, timeout, headers, withCredentials, responseType)
250+
}
251+
246252
def delete(url: String, data: InputData = null, timeout: Int = 0,
247253
headers: Map[String, String] = Map.empty,
248254
withCredentials: Boolean = false, responseType: String = "") = {

src/main/scala/org/scalajs/dom/package.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -219,5 +219,5 @@ package object dom {
219219
lazy val window: Window = js.Dynamic.global.window.asInstanceOf[Window]
220220
lazy val document: html.Document = window.document
221221

222-
lazy val console: Console = window.console
222+
lazy val console: Console = js.Dynamic.global.console.asInstanceOf[Console] // #411
223223
}

src/main/scala/org/scalajs/dom/raw/Css.scala

+7
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,13 @@ class CSSStyleRule extends CSSRule {
308308
*/
309309
var selectorText: String = js.native
310310
var readOnly: Boolean = js.native
311+
312+
/**
313+
* Returns the CSSStyleDeclaration object for the rule.
314+
*
315+
* MDN
316+
*/
317+
val style: CSSStyleDeclaration = js.native
311318
}
312319

313320
/**

0 commit comments

Comments
 (0)