Skip to content

Commit cc2292c

Browse files
Code review change
1 parent 34510e4 commit cc2292c

File tree

10 files changed

+308
-267
lines changed

10 files changed

+308
-267
lines changed

api-reports/2_12.txt

Lines changed: 127 additions & 124 deletions
Large diffs are not rendered by default.

api-reports/2_13.txt

Lines changed: 127 additions & 124 deletions
Large diffs are not rendered by default.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package org.scalajs.dom
2+
3+
import scala.scalajs.js
4+
5+
@js.native
6+
sealed trait EncapsulationMode extends js.Any
7+
8+
object EncapsulationMode {
9+
val open: EncapsulationMode = "open".asInstanceOf[EncapsulationMode]
10+
val closed: EncapsulationMode = "closed".asInstanceOf[EncapsulationMode]
11+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
package org.scalajs.dom
2+
3+
opaque type EncapsulationMode <: String = String
4+
5+
object EncapsulationMode {
6+
val open: EncapsulationMode = "open"
7+
val closed: EncapsulationMode = "closed"
8+
}

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

Lines changed: 0 additions & 9 deletions
This file was deleted.

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

Lines changed: 0 additions & 8 deletions
This file was deleted.

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,5 @@ import scala.scalajs.js.annotation._
1717
abstract class CustomElementRegistry extends js.Object {
1818

1919
/** Defines a new custom element. */
20-
def define(name: String, constructor: js.Dynamic, options: CustomElementDefineOptions = js.native): Unit
20+
def define(name: String, constructor: js.Dynamic, options: ElementDefinitionOptions = js.native): Unit
2121
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ abstract class Element extends Node with NodeSelector with ParentNode with NonDo
261261
def requestPointerLock(): Unit = js.native
262262

263263
/** Attaches a shadow DOM tree to the specified element and returns a reference to its ShadowRoot. */
264-
def attachShadow(init: AttachShadowRootOptions): ShadowRoot = js.native
264+
def attachShadow(init: ShadowRootInit): ShadowRoot = js.native
265265

266266
/** Returns the open shadow root that is hosted by the element, or null if no open shadow root is present. */
267267
def shadowRoot: ShadowRoot = js.native
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
package org.scalajs.dom
2+
3+
import scala.scalajs.js
4+
5+
/** An ElementDefinitionOptions object represents additional options associated with CustomElementRegsitry.define. */
6+
trait ElementDefinitionOptions extends js.Object {
7+
8+
/** String specifying the name of a built-in element to extend. Used to create a customized built-in element. */
9+
var `extends`: js.UndefOr[String] = js.undefined
10+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package org.scalajs.dom
2+
3+
import scala.scalajs.js
4+
5+
/** A ShadowRootInit object represents additional options associated with Element.attachShadow. */
6+
trait ShadowRootInit extends js.Object {
7+
8+
/** A string specifying the encapsulation mode for the shadow DOM tree. This can be one of:
9+
*
10+
* open: Elements of the shadow root are accessible from JavaScript outside the root, for example using
11+
* Element.shadowRoot: element.shadowRoot; // Returns a ShadowRoot obj
12+
*
13+
* closed: Denies access to the node(s) of a closed shadow root from JavaScript outside it: element.shadowRoot; //
14+
* Returns null
15+
*/
16+
var mode: EncapsulationMode
17+
18+
/** A boolean that, when set to true, specifies behavior that mitigates custom element issues around focusability.
19+
* When a non-focusable part of the shadow DOM is clicked, the first focusable part is given focus, and the shadow
20+
* host is given any available :focus styling.
21+
*/
22+
var delegatesFocus: js.UndefOr[Boolean] = js.undefined
23+
}

0 commit comments

Comments
 (0)