v2.0.0
scala-js-dom v2.0.0 is the first release in the 2.x series. It is published for Scala 2.11, 2.12, 2.13, and 3.0+ with Scala.js 1.5+. Note that it breaks binary-compatibility with the 1.x series.
!! IMPORTANT: Remove CrossVersion.for3Use2_13
!!
As scala-js-dom v2.x publishes a Scala 3 artifact, this setting is no longer necessary. Failing to remove this from your build.sbt
will cause your library to become binary-incompatible with other libraries correctly depending on scala-js-dom v2.x.
Migration guide
Update: for the latest migration guide with additional notes/hints from the community see #627.
scala-js-dom v2.0.0 is source-compatible to a great extent with v1.2.0, besides some corrections to facades and many new deprecation warnings. While testing the RC, we were able to upgrade several projects without making any changes!
To address the deprecation warnings:
- Replace imports into the
dom.raw.*
,dom.experimental.*
anddom.crypto.*
sub-packages withdom.*
. Nearly everything is indom.*
now except forintl
andwebgl
. - Use
new
-based constructors instead ofapply
-based constructors.
Note that a consequence of retiring the experimental
package is that we no longer designate experimental APIs. You can consult MDN and caniuse to determine which APIs are suitable for your projects.
You can also automate some, hopefully the majority, of your migration by running this quick script:
find . -type f -path '*/src/*.scala' -exec perl -pi -e '
s/\bdom\.(raw|crypto|webworkers)\./dom./;
s/\bdom\.experimental\.[a-z]+\./dom./;
s/\bClientRect\b/DOMRect/g;
' {} +
Example migration
import org.scalajs.dom
// Before (deprecated)
val response = dom.experimental.ResponseInit(myStatus, myStatusText, myHeaders)
// After
val response = new dom.ResponseInit {
var status = myStatus
var statusText = myStatusText
var headers = myHeaders
}
User-facing PRs
Thanks to our community contributors to this release for bravely opening PRs despite the significant churn as we put together 2.0.0! Now that things have stabilized, we look forward to many more PRs. Check out the contributing guide and help-wanted issues.
- Cleanups, part 1. by @sjrd in #458
- feat(idb): Update to newer API by @mprevel in #350
- Enable ExplicitResultTypes by @japgolly in #549
- Fix #516 Request extends Body by @armanbilge in #550
- Fix #515 Blob.stream() emits Uint8Array by @armanbilge in #551
- Added ImageCapture by @RoelofRuis in #410
- Document coding standards and conventions by @japgolly in #523
- Remove MDN from scaladocs by @armanbilge in #554
- Add Node.baseURI by @AugustNagro in #559
- add Node.isConnected by @AugustNagro in #558
- Add remove and other missing Element methods by @japgolly in #561
- Revise all
postMessage
methods by @japgolly in #563 - querySelectorAll returns Elements, not Nodes by @japgolly in #560
- Improve precision of IDB API and add tests by @japgolly in #569
- Clean up config traits by @sjrd in #579
- Restructure Java-style by @japgolly in #586
- The great migration to
dom
by @armanbilge in #588 - Use opaque types for Scala 3 by @armanbilge in #592
- Add
webcrypto
by @japgolly in #598 - Improve
HTMLCollection
, addHTMLOptionsCollection
andHTMLFormControlsCollection
by @ghostbuster91 in #593 - Make opaque string types subtype String by @japgolly in #603
- Minor fixes by @japgolly in #616
- Revise and add
ReadyState
classes by @japgolly in #617
Full Changelog: v1.2.0...v2.0.0