Skip to content

Commit 408830d

Browse files
committed
Extract AbstractRange interface
1 parent 59b5b89 commit 408830d

File tree

2 files changed

+44
-27
lines changed

2 files changed

+44
-27
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
/** All documentation for facades is thanks to Mozilla Contributors at https://developer.mozilla.org/en-US/docs/Web/API
2+
* and available under the Creative Commons Attribution-ShareAlike v2.5 or later.
3+
* http://creativecommons.org/licenses/by-sa/2.5/
4+
*
5+
* Everything else is under the MIT License http://opensource.org/licenses/MIT
6+
*/
7+
package org.scalajs.dom
8+
9+
import scala.scalajs.js
10+
11+
/** The AbstractRange abstract interface is the base class upon which all DOM range types are defined. A range is an
12+
* object that indicates the start and end points of a section of content within the document.
13+
*/
14+
@js.native
15+
trait AbstractRange extends js.Object {
16+
17+
/** The Range.startOffset read-only property returns a number representing where in the startContainer the Range
18+
* starts.
19+
*/
20+
def startOffset: Int = js.native
21+
22+
/** The Range.collapsed read-only property returns a Boolean flag indicating whether the start and end points of the
23+
* Range are at the same position. It returns true if the start and end boundary points of the Range are the same
24+
* point in the DOM, false if not.
25+
*/
26+
def collapsed: Boolean = js.native
27+
28+
/** The Range.endOffset read-only property returns a number representing where in the Range.endContainer the Range
29+
* ends.
30+
*/
31+
def endOffset: Int = js.native
32+
33+
/** The Range.startContainer read-only property returns the Node within which the Range starts. To change the start
34+
* position of a node, use one of the Range.setStart() methods.
35+
*/
36+
def startContainer: Node = js.native
37+
38+
/** The Range.endContainer read-only property returns the Node within which the Range ends. To change the end position
39+
* of a node, use the Range.setEnd() method or a similar one.
40+
*/
41+
def endContainer: Node = js.native
42+
43+
}

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

+1-27
Original file line numberDiff line numberDiff line change
@@ -17,33 +17,7 @@ import scala.scalajs.js.annotation._
1717
*/
1818
@js.native
1919
@JSGlobal
20-
class Range extends js.Object {
21-
22-
/** The Range.startOffset read-only property returns a number representing where in the startContainer the Range
23-
* starts.
24-
*/
25-
def startOffset: Int = js.native
26-
27-
/** The Range.collapsed read-only property returns a Boolean flag indicating whether the start and end points of the
28-
* Range are at the same position. It returns true if the start and end boundary points of the Range are the same
29-
* point in the DOM, false if not.
30-
*/
31-
def collapsed: Boolean = js.native
32-
33-
/** The Range.endOffset read-only property returns a number representing where in the Range.endContainer the Range
34-
* ends.
35-
*/
36-
def endOffset: Int = js.native
37-
38-
/** The Range.startContainer read-only property returns the Node within which the Range starts. To change the start
39-
* position of a node, use one of the Range.setStart() methods.
40-
*/
41-
def startContainer: Node = js.native
42-
43-
/** The Range.endContainer read-only property returns the Node within which the Range ends. To change the end position
44-
* of a node, use the Range.setEnd() method or a similar one.
45-
*/
46-
def endContainer: Node = js.native
20+
class Range extends AbstractRange {
4721

4822
/** The Range.commonAncestorContainer read-only property returns the deepest, or further down the document tree, Node
4923
* that contains both the Range.startContainer and Range.endContainer nodes.

0 commit comments

Comments
 (0)