Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions api-reports/2_12.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14486,6 +14486,7 @@ History[JC] def pushState(statedata: js.Any, title: String): Unit
History[JC] def pushState(statedata: js.Any, title: String, url: String): Unit
History[JC] def replaceState(statedata: js.Any, title: String): Unit
History[JC] def replaceState(statedata: js.Any, title: String, url: String): Unit
History[JC] var scrollRestoration: ScrollRestoration
History[JC] def state: js.Any
HkdfCtrParams[JT] val context: BufferSource
HkdfCtrParams[JT] val hash: HashAlgorithmIdentifier
Expand Down Expand Up @@ -24703,6 +24704,9 @@ Screen[JC] def colorDepth: Int
Screen[JC] def height: Double
Screen[JC] def pixelDepth: Int
Screen[JC] def width: Double
ScrollRestoration[JT]
ScrollRestoration[SO] val auto: ScrollRestoration
ScrollRestoration[SO] val manual: ScrollRestoration
Selection[JC] def addRange(range: Range): Unit
Selection[JC] def anchorNode: Node
Selection[JC] def anchorOffset: Int
Expand Down
4 changes: 4 additions & 0 deletions api-reports/2_13.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14486,6 +14486,7 @@ History[JC] def pushState(statedata: js.Any, title: String): Unit
History[JC] def pushState(statedata: js.Any, title: String, url: String): Unit
History[JC] def replaceState(statedata: js.Any, title: String): Unit
History[JC] def replaceState(statedata: js.Any, title: String, url: String): Unit
History[JC] var scrollRestoration: ScrollRestoration
History[JC] def state: js.Any
HkdfCtrParams[JT] val context: BufferSource
HkdfCtrParams[JT] val hash: HashAlgorithmIdentifier
Expand Down Expand Up @@ -24703,6 +24704,9 @@ Screen[JC] def colorDepth: Int
Screen[JC] def height: Double
Screen[JC] def pixelDepth: Int
Screen[JC] def width: Double
ScrollRestoration[JT]
ScrollRestoration[SO] val auto: ScrollRestoration
ScrollRestoration[SO] val manual: ScrollRestoration
Selection[JC] def addRange(range: Range): Unit
Selection[JC] def anchorNode: Node
Selection[JC] def anchorOffset: Int
Expand Down
15 changes: 15 additions & 0 deletions dom/src/main/scala-2/org/scalajs/dom/ScrollRestoration.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package org.scalajs.dom

import scala.scalajs.js

@js.native
sealed trait ScrollRestoration extends js.Any

/**
* see [[https://html.spec.whatwg.org/multipage/history.html#the-history-interface]]
* which contains the spec for ScrollRestoration
*/
object ScrollRestoration {
val auto: ScrollRestoration = "auto".asInstanceOf[ScrollRestoration]
val manual: ScrollRestoration = "manual".asInstanceOf[ScrollRestoration]
}
16 changes: 16 additions & 0 deletions dom/src/main/scala-3/org/scalajs/dom/ScrollRestoration.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package org.scalajs.dom

import scala.scalajs.js

opaque type ScrollRestoration <: String = String

/**
* see [[https://html.spec.whatwg.org/multipage/history.html#the-history-interface]]
* which contains the spec for ScrollRestoration
*/
object ScrollRestoration {
/** The location on the page to which the user has scrolled will be restored. */
val auto: ScrollRestoration = "auto"
/** The location on the page is not restored. The user will have to scroll to the location manually. */
val manual: ScrollRestoration = "manual"
}
5 changes: 5 additions & 0 deletions dom/src/main/scala/org/scalajs/dom/History.scala
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,9 @@ class History extends js.Object {
* safely passed.
*/
def pushState(statedata: js.Any, title: String): Unit = js.native

/** The `scrollRestoration` property of [[History]] interface allows web applications to explicitly set default scroll
* restoration behavior on history navigation.
*/
var scrollRestoration: ScrollRestoration = js.native
}