diff --git a/api-reports/2_12.txt b/api-reports/2_12.txt index fc20a3f5d..d49c50514 100644 --- a/api-reports/2_12.txt +++ b/api-reports/2_12.txt @@ -20,6 +20,11 @@ AbortSignal[JT] def dispatchEvent(evt: Event): Boolean AbortSignal[JT] var onabort: js.Function0[Any] AbortSignal[JT] def removeEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit AbortSignal[JT] def removeEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit +AbstractRange[JC] def collapsed: Boolean +AbstractRange[JC] def endContainer: Node +AbstractRange[JC] def endOffset: Int +AbstractRange[JC] def startContainer: Node +AbstractRange[JC] def startOffset: Int AbstractWorker[JT] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit AbstractWorker[JT] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit AbstractWorker[JT] def dispatchEvent(evt: Event): Boolean @@ -14184,6 +14189,82 @@ ImageCapture[JC] val track: MediaStreamTrack ImageData[JC] def data: js.Array[Int] ImageData[JC] def height: Int ImageData[JC] def width: Int +InputEvent[JC] def bubbles: Boolean +InputEvent[JC] def cancelBubble: Boolean +InputEvent[JC] def cancelable: Boolean +InputEvent[JC] def currentTarget: EventTarget +InputEvent[JC] def data: String +InputEvent[JC] def dataTransfer: DataTransfer +InputEvent[JC] def defaultPrevented: Boolean +InputEvent[JC] def detail: Int +InputEvent[JC] def eventPhase: Int +InputEvent[JC] def getTargetRanges(): js.Array[StaticRange] +InputEvent[JC] def inputType: InputType +InputEvent[JC] def isComposing: Boolean +InputEvent[JC] def isTrusted: Boolean +InputEvent[JC] def preventDefault(): Unit +InputEvent[JC] def stopImmediatePropagation(): Unit +InputEvent[JC] def stopPropagation(): Unit +InputEvent[JC] def target: EventTarget +InputEvent[JC] def timeStamp: Double +InputEvent[JC] def `type`: String +InputEvent[JC] def view: Window +InputEventInit[JT] var bubbles: js.UndefOr[Boolean] +InputEventInit[JT] var cancelable: js.UndefOr[Boolean] +InputEventInit[JT] var composed: js.UndefOr[Boolean] +InputEventInit[JT] var data: js.UndefOr[String] +InputEventInit[JT] var detail: js.UndefOr[Int] +InputEventInit[JT] var inputType: js.UndefOr[InputType] +InputEventInit[JT] var isComposing: js.UndefOr[Boolean] +InputEventInit[JT] var scoped: js.UndefOr[Boolean] +InputEventInit[JT] var view: js.UndefOr[Window] +InputType[JT] +InputType[SO] val deleteByCut: InputType +InputType[SO] val deleteByDrag: InputType +InputType[SO] val deleteContent: InputType +InputType[SO] val deleteContentBackward: InputType +InputType[SO] val deleteContentForward: InputType +InputType[SO] val deleteEntireSoftLine: InputType +InputType[SO] val deleteHardLineBackward: InputType +InputType[SO] val deleteHardLineForward: InputType +InputType[SO] val deleteSoftLineBackward: InputType +InputType[SO] val deleteSoftLineForward: InputType +InputType[SO] val deleteWordBackward: InputType +InputType[SO] val deleteWordForward: InputType +InputType[SO] val formatBackColor: InputType +InputType[SO] val formatBold: InputType +InputType[SO] val formatFontColor: InputType +InputType[SO] val formatFontName: InputType +InputType[SO] val formatIndent: InputType +InputType[SO] val formatItalic: InputType +InputType[SO] val formatJustifyCenter: InputType +InputType[SO] val formatJustifyFull: InputType +InputType[SO] val formatJustifyLeft: InputType +InputType[SO] val formatJustifyRight: InputType +InputType[SO] val formatOutdent: InputType +InputType[SO] val formatRemove: InputType +InputType[SO] val formatSetBlockTextDirection: InputType +InputType[SO] val formatSetInlineTextDirection: InputType +InputType[SO] val formatStrikeThrough: InputType +InputType[SO] val formatSubscript: InputType +InputType[SO] val formatSuperscript: InputType +InputType[SO] val formatUnderline: InputType +InputType[SO] val historyRedo: InputType +InputType[SO] val historyUndo: InputType +InputType[SO] val insertCompositionText: InputType +InputType[SO] val insertFromDrop: InputType +InputType[SO] val insertFromPaste: InputType +InputType[SO] val insertFromPasteAsQuotation: InputType +InputType[SO] val insertFromYank: InputType +InputType[SO] val insertHorizontalRule: InputType +InputType[SO] val insertLineBreak: InputType +InputType[SO] val insertLink: InputType +InputType[SO] val insertOrderedList: InputType +InputType[SO] val insertParagraph: InputType +InputType[SO] val insertReplacementText: InputType +InputType[SO] val insertText: InputType +InputType[SO] val insertTranspose: InputType +InputType[SO] val insertUnorderedList: InputType JsonWebKey[JT] var alg: js.Array[String] JsonWebKey[JT] var crv: String JsonWebKey[JT] var d: String @@ -24124,6 +24205,15 @@ SourceBufferList[JT] var onaddsourcebuffer: js.Function1[Event, Any] SourceBufferList[JT] var onremovesourcebuffer: js.Function1[Event, Any] SourceBufferList[JT] def removeEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit SourceBufferList[JT] def removeEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit +StaticRange[JC] def collapsed: Boolean +StaticRange[JC] def endContainer: Node +StaticRange[JC] def endOffset: Int +StaticRange[JC] def startContainer: Node +StaticRange[JC] def startOffset: Int +StaticRangeInit[JT] val endContainer: Node +StaticRangeInit[JT] val endOffset: Int +StaticRangeInit[JT] val startContainer: Node +StaticRangeInit[JT] val startOffset: Int StereoPannerNode[JT] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit StereoPannerNode[JT] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit StereoPannerNode[JT] var channelCount: Int diff --git a/api-reports/2_13.txt b/api-reports/2_13.txt index fc20a3f5d..d49c50514 100644 --- a/api-reports/2_13.txt +++ b/api-reports/2_13.txt @@ -20,6 +20,11 @@ AbortSignal[JT] def dispatchEvent(evt: Event): Boolean AbortSignal[JT] var onabort: js.Function0[Any] AbortSignal[JT] def removeEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit AbortSignal[JT] def removeEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit +AbstractRange[JC] def collapsed: Boolean +AbstractRange[JC] def endContainer: Node +AbstractRange[JC] def endOffset: Int +AbstractRange[JC] def startContainer: Node +AbstractRange[JC] def startOffset: Int AbstractWorker[JT] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit AbstractWorker[JT] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit AbstractWorker[JT] def dispatchEvent(evt: Event): Boolean @@ -14184,6 +14189,82 @@ ImageCapture[JC] val track: MediaStreamTrack ImageData[JC] def data: js.Array[Int] ImageData[JC] def height: Int ImageData[JC] def width: Int +InputEvent[JC] def bubbles: Boolean +InputEvent[JC] def cancelBubble: Boolean +InputEvent[JC] def cancelable: Boolean +InputEvent[JC] def currentTarget: EventTarget +InputEvent[JC] def data: String +InputEvent[JC] def dataTransfer: DataTransfer +InputEvent[JC] def defaultPrevented: Boolean +InputEvent[JC] def detail: Int +InputEvent[JC] def eventPhase: Int +InputEvent[JC] def getTargetRanges(): js.Array[StaticRange] +InputEvent[JC] def inputType: InputType +InputEvent[JC] def isComposing: Boolean +InputEvent[JC] def isTrusted: Boolean +InputEvent[JC] def preventDefault(): Unit +InputEvent[JC] def stopImmediatePropagation(): Unit +InputEvent[JC] def stopPropagation(): Unit +InputEvent[JC] def target: EventTarget +InputEvent[JC] def timeStamp: Double +InputEvent[JC] def `type`: String +InputEvent[JC] def view: Window +InputEventInit[JT] var bubbles: js.UndefOr[Boolean] +InputEventInit[JT] var cancelable: js.UndefOr[Boolean] +InputEventInit[JT] var composed: js.UndefOr[Boolean] +InputEventInit[JT] var data: js.UndefOr[String] +InputEventInit[JT] var detail: js.UndefOr[Int] +InputEventInit[JT] var inputType: js.UndefOr[InputType] +InputEventInit[JT] var isComposing: js.UndefOr[Boolean] +InputEventInit[JT] var scoped: js.UndefOr[Boolean] +InputEventInit[JT] var view: js.UndefOr[Window] +InputType[JT] +InputType[SO] val deleteByCut: InputType +InputType[SO] val deleteByDrag: InputType +InputType[SO] val deleteContent: InputType +InputType[SO] val deleteContentBackward: InputType +InputType[SO] val deleteContentForward: InputType +InputType[SO] val deleteEntireSoftLine: InputType +InputType[SO] val deleteHardLineBackward: InputType +InputType[SO] val deleteHardLineForward: InputType +InputType[SO] val deleteSoftLineBackward: InputType +InputType[SO] val deleteSoftLineForward: InputType +InputType[SO] val deleteWordBackward: InputType +InputType[SO] val deleteWordForward: InputType +InputType[SO] val formatBackColor: InputType +InputType[SO] val formatBold: InputType +InputType[SO] val formatFontColor: InputType +InputType[SO] val formatFontName: InputType +InputType[SO] val formatIndent: InputType +InputType[SO] val formatItalic: InputType +InputType[SO] val formatJustifyCenter: InputType +InputType[SO] val formatJustifyFull: InputType +InputType[SO] val formatJustifyLeft: InputType +InputType[SO] val formatJustifyRight: InputType +InputType[SO] val formatOutdent: InputType +InputType[SO] val formatRemove: InputType +InputType[SO] val formatSetBlockTextDirection: InputType +InputType[SO] val formatSetInlineTextDirection: InputType +InputType[SO] val formatStrikeThrough: InputType +InputType[SO] val formatSubscript: InputType +InputType[SO] val formatSuperscript: InputType +InputType[SO] val formatUnderline: InputType +InputType[SO] val historyRedo: InputType +InputType[SO] val historyUndo: InputType +InputType[SO] val insertCompositionText: InputType +InputType[SO] val insertFromDrop: InputType +InputType[SO] val insertFromPaste: InputType +InputType[SO] val insertFromPasteAsQuotation: InputType +InputType[SO] val insertFromYank: InputType +InputType[SO] val insertHorizontalRule: InputType +InputType[SO] val insertLineBreak: InputType +InputType[SO] val insertLink: InputType +InputType[SO] val insertOrderedList: InputType +InputType[SO] val insertParagraph: InputType +InputType[SO] val insertReplacementText: InputType +InputType[SO] val insertText: InputType +InputType[SO] val insertTranspose: InputType +InputType[SO] val insertUnorderedList: InputType JsonWebKey[JT] var alg: js.Array[String] JsonWebKey[JT] var crv: String JsonWebKey[JT] var d: String @@ -24124,6 +24205,15 @@ SourceBufferList[JT] var onaddsourcebuffer: js.Function1[Event, Any] SourceBufferList[JT] var onremovesourcebuffer: js.Function1[Event, Any] SourceBufferList[JT] def removeEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit SourceBufferList[JT] def removeEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit +StaticRange[JC] def collapsed: Boolean +StaticRange[JC] def endContainer: Node +StaticRange[JC] def endOffset: Int +StaticRange[JC] def startContainer: Node +StaticRange[JC] def startOffset: Int +StaticRangeInit[JT] val endContainer: Node +StaticRangeInit[JT] val endOffset: Int +StaticRangeInit[JT] val startContainer: Node +StaticRangeInit[JT] val startOffset: Int StereoPannerNode[JT] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit StereoPannerNode[JT] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit StereoPannerNode[JT] var channelCount: Int diff --git a/dom/src/main/scala-2/org/scalajs/dom/InputType.scala b/dom/src/main/scala-2/org/scalajs/dom/InputType.scala new file mode 100644 index 000000000..d088798c8 --- /dev/null +++ b/dom/src/main/scala-2/org/scalajs/dom/InputType.scala @@ -0,0 +1,55 @@ +package org.scalajs.dom + +import scala.scalajs.js + +@js.native +sealed trait InputType extends js.Any + +object InputType { + val insertText: InputType = "insertText".asInstanceOf[InputType] + val insertReplacementText: InputType = "insertReplacementText".asInstanceOf[InputType] + val insertLineBreak: InputType = "insertLineBreak".asInstanceOf[InputType] + val insertParagraph: InputType = "insertParagraph".asInstanceOf[InputType] + val insertOrderedList: InputType = "insertOrderedList".asInstanceOf[InputType] + val insertUnorderedList: InputType = "insertUnorderedList".asInstanceOf[InputType] + val insertHorizontalRule: InputType = "insertHorizontalRule".asInstanceOf[InputType] + val insertFromYank: InputType = "insertFromYank".asInstanceOf[InputType] + val insertFromDrop: InputType = "insertFromDrop".asInstanceOf[InputType] + val insertFromPaste: InputType = "insertFromPaste".asInstanceOf[InputType] + val insertFromPasteAsQuotation: InputType = "insertFromPasteAsQuotation".asInstanceOf[InputType] + val insertTranspose: InputType = "insertTranspose".asInstanceOf[InputType] + val insertCompositionText: InputType = "insertCompositionText".asInstanceOf[InputType] + val insertLink: InputType = "insertLink".asInstanceOf[InputType] + val deleteWordBackward: InputType = "deleteWordBackward".asInstanceOf[InputType] + val deleteWordForward: InputType = "deleteWordForward".asInstanceOf[InputType] + val deleteSoftLineBackward: InputType = "deleteSoftLineBackward".asInstanceOf[InputType] + val deleteSoftLineForward: InputType = "deleteSoftLineForward".asInstanceOf[InputType] + val deleteEntireSoftLine: InputType = "deleteEntireSoftLine".asInstanceOf[InputType] + val deleteHardLineBackward: InputType = "deleteHardLineBackward".asInstanceOf[InputType] + val deleteHardLineForward: InputType = "deleteHardLineForward".asInstanceOf[InputType] + val deleteByDrag: InputType = "deleteByDrag".asInstanceOf[InputType] + val deleteByCut: InputType = "deleteByCut".asInstanceOf[InputType] + val deleteContent: InputType = "deleteContent".asInstanceOf[InputType] + val deleteContentBackward: InputType = "deleteContentBackward".asInstanceOf[InputType] + val deleteContentForward: InputType = "deleteContentForward".asInstanceOf[InputType] + val historyUndo: InputType = "historyUndo".asInstanceOf[InputType] + val historyRedo: InputType = "historyRedo".asInstanceOf[InputType] + val formatBold: InputType = "formatBold".asInstanceOf[InputType] + val formatItalic: InputType = "formatItalic".asInstanceOf[InputType] + val formatUnderline: InputType = "formatUnderline".asInstanceOf[InputType] + val formatStrikeThrough: InputType = "formatStrikeThrough".asInstanceOf[InputType] + val formatSuperscript: InputType = "formatSuperscript".asInstanceOf[InputType] + val formatSubscript: InputType = "formatSubscript".asInstanceOf[InputType] + val formatJustifyFull: InputType = "formatJustifyFull".asInstanceOf[InputType] + val formatJustifyCenter: InputType = "formatJustifyCenter".asInstanceOf[InputType] + val formatJustifyRight: InputType = "formatJustifyRight".asInstanceOf[InputType] + val formatJustifyLeft: InputType = "formatJustifyLeft".asInstanceOf[InputType] + val formatIndent: InputType = "formatIndent".asInstanceOf[InputType] + val formatOutdent: InputType = "formatOutdent".asInstanceOf[InputType] + val formatRemove: InputType = "formatRemove".asInstanceOf[InputType] + val formatSetBlockTextDirection: InputType = "formatSetBlockTextDirection".asInstanceOf[InputType] + val formatSetInlineTextDirection: InputType = "formatSetInlineTextDirection".asInstanceOf[InputType] + val formatBackColor: InputType = "formatBackColor".asInstanceOf[InputType] + val formatFontColor: InputType = "formatFontColor".asInstanceOf[InputType] + val formatFontName: InputType = "formatFontName".asInstanceOf[InputType] +} diff --git a/dom/src/main/scala-3/org/scalajs/dom/InputType.scala b/dom/src/main/scala-3/org/scalajs/dom/InputType.scala new file mode 100644 index 000000000..e2878dc98 --- /dev/null +++ b/dom/src/main/scala-3/org/scalajs/dom/InputType.scala @@ -0,0 +1,54 @@ +package org.scalajs.dom + +import scala.scalajs.js + +opaque type InputType <: String = String + +object InputType { + val insertText: InputType = "insertText" + val insertReplacementText: InputType = "insertReplacementText" + val insertLineBreak: InputType = "insertLineBreak" + val insertParagraph: InputType = "insertParagraph" + val insertOrderedList: InputType = "insertOrderedList" + val insertUnorderedList: InputType = "insertUnorderedList" + val insertHorizontalRule: InputType = "insertHorizontalRule" + val insertFromYank: InputType = "insertFromYank" + val insertFromDrop: InputType = "insertFromDrop" + val insertFromPaste: InputType = "insertFromPaste" + val insertFromPasteAsQuotation: InputType = "insertFromPasteAsQuotation" + val insertTranspose: InputType = "insertTranspose" + val insertCompositionText: InputType = "insertCompositionText" + val insertLink: InputType = "insertLink" + val deleteWordBackward: InputType = "deleteWordBackward" + val deleteWordForward: InputType = "deleteWordForward" + val deleteSoftLineBackward: InputType = "deleteSoftLineBackward" + val deleteSoftLineForward: InputType = "deleteSoftLineForward" + val deleteEntireSoftLine: InputType = "deleteEntireSoftLine" + val deleteHardLineBackward: InputType = "deleteHardLineBackward" + val deleteHardLineForward: InputType = "deleteHardLineForward" + val deleteByDrag: InputType = "deleteByDrag" + val deleteByCut: InputType = "deleteByCut" + val deleteContent: InputType = "deleteContent" + val deleteContentBackward: InputType = "deleteContentBackward" + val deleteContentForward: InputType = "deleteContentForward" + val historyUndo: InputType = "historyUndo" + val historyRedo: InputType = "historyRedo" + val formatBold: InputType = "formatBold" + val formatItalic: InputType = "formatItalic" + val formatUnderline: InputType = "formatUnderline" + val formatStrikeThrough: InputType = "formatStrikeThrough" + val formatSuperscript: InputType = "formatSuperscript" + val formatSubscript: InputType = "formatSubscript" + val formatJustifyFull: InputType = "formatJustifyFull" + val formatJustifyCenter: InputType = "formatJustifyCenter" + val formatJustifyRight: InputType = "formatJustifyRight" + val formatJustifyLeft: InputType = "formatJustifyLeft" + val formatIndent: InputType = "formatIndent" + val formatOutdent: InputType = "formatOutdent" + val formatRemove: InputType = "formatRemove" + val formatSetBlockTextDirection: InputType = "formatSetBlockTextDirection" + val formatSetInlineTextDirection: InputType = "formatSetInlineTextDirection" + val formatBackColor: InputType = "formatBackColor" + val formatFontColor: InputType = "formatFontColor" + val formatFontName: InputType = "formatFontName" +} diff --git a/dom/src/main/scala/org/scalajs/dom/AbstractRange.scala b/dom/src/main/scala/org/scalajs/dom/AbstractRange.scala new file mode 100644 index 000000000..9418390f2 --- /dev/null +++ b/dom/src/main/scala/org/scalajs/dom/AbstractRange.scala @@ -0,0 +1,45 @@ +/** All documentation for facades is thanks to Mozilla Contributors at https://developer.mozilla.org/en-US/docs/Web/API + * and available under the Creative Commons Attribution-ShareAlike v2.5 or later. + * http://creativecommons.org/licenses/by-sa/2.5/ + * + * Everything else is under the MIT License http://opensource.org/licenses/MIT + */ +package org.scalajs.dom + +import scala.scalajs.js +import scala.scalajs.js.annotation._ + +/** The AbstractRange abstract interface is the base class upon which all DOM range types are defined. A range is an + * object that indicates the start and end points of a section of content within the document. + */ +@js.native +@JSGlobal +abstract class AbstractRange extends js.Object { + + /** The Range.startOffset read-only property returns a number representing where in the startContainer the Range + * starts. + */ + def startOffset: Int = js.native + + /** The Range.collapsed read-only property returns a Boolean flag indicating whether the start and end points of the + * Range are at the same position. It returns true if the start and end boundary points of the Range are the same + * point in the DOM, false if not. + */ + def collapsed: Boolean = js.native + + /** The Range.endOffset read-only property returns a number representing where in the Range.endContainer the Range + * ends. + */ + def endOffset: Int = js.native + + /** The Range.startContainer read-only property returns the Node within which the Range starts. To change the start + * position of a node, use one of the Range.setStart() methods. + */ + def startContainer: Node = js.native + + /** The Range.endContainer read-only property returns the Node within which the Range ends. To change the end position + * of a node, use the Range.setEnd() method or a similar one. + */ + def endContainer: Node = js.native + +} diff --git a/dom/src/main/scala/org/scalajs/dom/InputEvent.scala b/dom/src/main/scala/org/scalajs/dom/InputEvent.scala new file mode 100644 index 000000000..54a158fee --- /dev/null +++ b/dom/src/main/scala/org/scalajs/dom/InputEvent.scala @@ -0,0 +1,41 @@ +/** All documentation for facades is thanks to Mozilla Contributors at https://developer.mozilla.org/en-US/docs/Web/API + * and available under the Creative Commons Attribution-ShareAlike v2.5 or later. + * http://creativecommons.org/licenses/by-sa/2.5/ + * + * Everything else is under the MIT License http://opensource.org/licenses/MIT + */ +package org.scalajs.dom + +import scala.scalajs.js +import scala.scalajs.js.annotation._ + +/** The InputEvent interface represents an event notifying the user of editable content changes. */ +@js.native +@JSGlobal +class InputEvent(typeArg: String, init: InputEventInit) extends UIEvent(typeArg, init) { + + def this(typeArg: String) = this(typeArg, js.native) + + /** Returns a DOMString with the inserted characters. This may be an empty string if the change doesn't insert text + * (such as when deleting characters, for example). + */ + def data: String = js.native + + /** Returns a DataTransfer object containing information about richtext or plaintext data being added to or removed + * from editable content. + */ + def dataTransfer: DataTransfer = js.native + + /** Returns the type of change for editable content such as, for example, inserting, deleting, or formatting text. See + * the property page for a complete list of input types. + */ + def inputType: InputType = js.native + + /** Returns a Boolean value indicating if the event is fired after compositionstart and before compositionend. */ + def isComposing: Boolean = js.native + + /** Returns an array of static ranges that will be affected by a change to the DOM if the input event is not canceled. + */ + def getTargetRanges(): js.Array[StaticRange] = js.native + +} diff --git a/dom/src/main/scala/org/scalajs/dom/InputEventInit.scala b/dom/src/main/scala/org/scalajs/dom/InputEventInit.scala new file mode 100644 index 000000000..0b71d5b6c --- /dev/null +++ b/dom/src/main/scala/org/scalajs/dom/InputEventInit.scala @@ -0,0 +1,15 @@ +/** All documentation for facades is thanks to Mozilla Contributors at https://developer.mozilla.org/en-US/docs/Web/API + * and available under the Creative Commons Attribution-ShareAlike v2.5 or later. + * http://creativecommons.org/licenses/by-sa/2.5/ + * + * Everything else is under the MIT License http://opensource.org/licenses/MIT + */ +package org.scalajs.dom + +import scala.scalajs.js + +trait InputEventInit extends UIEventInit { + var inputType: js.UndefOr[InputType] = js.undefined + var data: js.UndefOr[String] = js.undefined + var isComposing: js.UndefOr[Boolean] = js.undefined +} diff --git a/dom/src/main/scala/org/scalajs/dom/Range.scala b/dom/src/main/scala/org/scalajs/dom/Range.scala index b19627378..67b5cb070 100644 --- a/dom/src/main/scala/org/scalajs/dom/Range.scala +++ b/dom/src/main/scala/org/scalajs/dom/Range.scala @@ -17,33 +17,7 @@ import scala.scalajs.js.annotation._ */ @js.native @JSGlobal -class Range extends js.Object { - - /** The Range.startOffset read-only property returns a number representing where in the startContainer the Range - * starts. - */ - def startOffset: Int = js.native - - /** The Range.collapsed read-only property returns a Boolean flag indicating whether the start and end points of the - * Range are at the same position. It returns true if the start and end boundary points of the Range are the same - * point in the DOM, false if not. - */ - def collapsed: Boolean = js.native - - /** The Range.endOffset read-only property returns a number representing where in the Range.endContainer the Range - * ends. - */ - def endOffset: Int = js.native - - /** The Range.startContainer read-only property returns the Node within which the Range starts. To change the start - * position of a node, use one of the Range.setStart() methods. - */ - def startContainer: Node = js.native - - /** The Range.endContainer read-only property returns the Node within which the Range ends. To change the end position - * of a node, use the Range.setEnd() method or a similar one. - */ - def endContainer: Node = js.native +class Range extends AbstractRange { /** The Range.commonAncestorContainer read-only property returns the deepest, or further down the document tree, Node * that contains both the Range.startContainer and Range.endContainer nodes. diff --git a/dom/src/main/scala/org/scalajs/dom/StaticRange.scala b/dom/src/main/scala/org/scalajs/dom/StaticRange.scala new file mode 100644 index 000000000..c5a0ade4d --- /dev/null +++ b/dom/src/main/scala/org/scalajs/dom/StaticRange.scala @@ -0,0 +1,15 @@ +package org.scalajs.dom + +import scala.scalajs.js +import scala.scalajs.js.annotation._ + +/** The DOM StaticRange interface extends AbstractRange to provide a method to specify a range of content in the DOM + * whose contents don't update to reflect changes which occur within the DOM tree. + * + * This interface offers the same set of properties and methods as AbstractRange. + * + * AbstractRange and StaticRange are not available from web workers. + */ +@js.native +@JSGlobal +class StaticRange(init: StaticRangeInit) extends AbstractRange diff --git a/dom/src/main/scala/org/scalajs/dom/StaticRangeInit.scala b/dom/src/main/scala/org/scalajs/dom/StaticRangeInit.scala new file mode 100644 index 000000000..0fb9e815a --- /dev/null +++ b/dom/src/main/scala/org/scalajs/dom/StaticRangeInit.scala @@ -0,0 +1,18 @@ +package org.scalajs.dom + +import scala.scalajs.js + +trait StaticRangeInit extends js.Object { + + /** The offset into the starting node at which the first character of the range is found. */ + val startOffset: Int + + /** The offset into the node indicated by endOffset at which the last character in the range is located. */ + val endOffset: Int + + /** The Node in which the starting point of the range is located. */ + val startContainer: Node + + /** The Node in which the end point of the range is located. */ + val endContainer: Node +}