io.scalajs.dom.Document.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of dom-html_sjs0.6_2.11 Show documentation
Show all versions of dom-html_sjs0.6_2.11 Show documentation
DOM/HTML bindings for Scala.js
package io.scalajs.dom
import io.scalajs.dom.collection.HTMLCollection
import io.scalajs.dom.event._
import io.scalajs.dom.html._
import io.scalajs.dom.html.css.CSSSelector
import scala.scalajs.js
/**
* The Document interface represents any web page loaded in the browser and serves as an entry point into the
* web page's content, which is the DOM tree. The DOM tree includes elements such as and , among
* many others. It provides functionality global to the document, like how to obtain the page's URL and create
* new elements in the document.
* @see https://developer.mozilla.org/en-US/docs/Web/API/Document
* @see http://www.w3schools.com/jsref/dom_obj_document.asp
* @author [email protected]
*/
@js.native
trait Document
extends ParentNode
with AnimationEvents
with ClipboardEvents
with DragEvents
with FormEvents
with FrameObjectEvents
with KeyboardEvents
with MiscEvents
with PrintEvents
with ServerSentEvents
with TouchEvents {
/**
* The event occurs when an error occurs while loading an external file
*/
override def onerror(callback: js.Function): Unit = js.native
/**
* The event occurs when a message is received through the event source
*/
override def onmessage(callback: js.Function): Unit = js.native
/**
* Returns the currently focused element in the document
* @return the currently focused element in the document
*/
def activeElement: Element = js.native
/**
* Attaches an event handler to the document
* @param event the event
* @param callback the callback [[js.Function function]]
*/
def addEventListener(event: String, callback: js.Function): Unit = js.native
/**
* Adopts a node from another document
*/
def adoptNode(element: Element): Unit = js.native
/**
* Returns a collection of all elements in the document that have a name attribute
* @return a collection of all elements in the document that have a name attribute
*/
def anchors: HTMLCollection[HTMLAnchorElement] = js.native
/**
* Returns a collection of all