Class

io.scalajs.dom

XMLDocument

Related Doc: package dom

Permalink

class XMLDocument extends Object with Document

The XMLDocument interface represent an XML document. It inherits from the generic Document and does not add any specific methods or properties to it: nevertheless, several algorithms behave differently with the two types of documents.

Annotations
@RawJSType() @native()
See also

https://developer.mozilla.org/en-US/docs/Web/API/XMLDocument

Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. XMLDocument
  2. Document
  3. TouchEvents
  4. ServerSentEvents
  5. PrintEvents
  6. MiscEvents
  7. KeyboardEvents
  8. FrameObjectEvents
  9. FormEvents
  10. DragEvents
  11. ClipboardEvents
  12. AnimationEvents
  13. ParentNode
  14. Node
  15. Object
  16. Any
  17. AnyRef
  18. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new XMLDocument()

    Permalink

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. def URL: String

    Permalink

    Returns the full URL of the HTML document

    Returns the full URL of the HTML document

    returns

    the full URL of the HTML document

    Definition Classes
    Document
  5. def activeElement: Element

    Permalink

    Returns the currently focused element in the document

    Returns the currently focused element in the document

    returns

    the currently focused element in the document

    Definition Classes
    Document
  6. def addEventListener(event: String, callback: Function): Unit

    Permalink

    Attaches an event handler to the document

    Attaches an event handler to the document

    event

    the event

    callback

    the callback function

    Definition Classes
    Document
  7. def adoptNode(element: Element): Unit

    Permalink

    Adopts a node from another document

    Adopts a node from another document

    Definition Classes
    Document
  8. def anchors: HTMLCollection[HTMLAnchorElement]

    Permalink

    Returns a collection of all elements in the document that have a name attribute

  9. def animationend(callback: Function): Unit

    Permalink

    The event occurs when a CSS animation has completed

    The event occurs when a CSS animation has completed

    Definition Classes
    AnimationEvents
  10. def animationiteration(callback: Function): Unit

    Permalink

    The event occurs when a CSS animation is repeated

    The event occurs when a CSS animation is repeated

    Definition Classes
    AnimationEvents
  11. def animationstart(callback: Function): Unit

    Permalink

    The event occurs when a CSS animation has started

    The event occurs when a CSS animation has started

    Definition Classes
    AnimationEvents
  12. def append(nodes: |[Node, String]*): XMLDocument.this.type

    Permalink

    Inserts a set of Node objects or DOMString objects after the last child of the ParentNode.

    Inserts a set of Node objects or DOMString objects after the last child of the ParentNode. DOMString objects are inserted as equivalent Text nodes.

    nodes

    A set of Node or DOMString objects to insert.

    Definition Classes
    ParentNode
  13. def appendChild(node: Node): Node

    Permalink

    Add a new node (and its subtree, if applicable) to the end of the list of children of this node.

    Add a new node (and its subtree, if applicable) to the end of the list of children of this node.

    If the new child is already present in the DOM tree it is first removed (effectively moving it). If the new child is a DocumentFragment node then the entire contents of the document fragment are appended, but the fragment node itself is not (therefore using a document fragment is a good way of building and attaching several nodes at once).

    node

    The new node to be added to this node. If the new node has any children these are also added recursively, preserving the new node's sub-tree.

    returns

    The node that was added

    Definition Classes
    Node
  14. def applets: HTMLCollection[HTMLAppletElement]

    Permalink

    Returns a collection of all <applet> elements in the document

    Returns a collection of all <applet> elements in the document

    returns

    a collection of all <applet> elements in the document

    Definition Classes
    Document
  15. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  16. def attributes: NamedNodeMap[Attr]

    Permalink

    The attributes collection is an unordered list of all the effective attributes1 of an Element; for other nodes this property is null.

    The attributes collection is an unordered list of all the effective attributes1 of an Element; for other nodes this property is null.

    This collection is a NamedNodeMap, primarily intended to be accessed by name. It's also possible to access the items by their index in the map, however the DOM does not specify what order they will appear in (and this varies by browser, as noted in the Compatibility notes below).

    As with all named node maps, attributes is a live collection, which means that changes to the collection it represents are immediately reflected in the node map (as opposed to it being a static snapshot). This collection is read-only.

    Definition Classes
    Node
  17. def baseURI: String

    Permalink

    Returns the absolute base URI of a document

    Returns the absolute base URI of a document

    returns

    the absolute base URI of a document

    Definition Classes
    Document
  18. var body: HTMLBodyElement

    Permalink

    Sets or returns the document's body (the <body> element)

    Sets or returns the document's body (the <body> element)

    returns

    the document's body

    Definition Classes
    Document
  19. def childElementCount: UnsignedLong

    Permalink

    Returns an unsigned long giving the amount of children that the object has.

    Returns an unsigned long giving the amount of children that the object has.

    Definition Classes
    ParentNode
  20. def childNodes[T <: Node]: NodeList[T]

    Permalink

    The childNodes collection is an ordered list of all the direct child nodes of this node; if there are no child nodes then this collection is empty (it has zero length).

    The childNodes collection is an ordered list of all the direct child nodes of this node; if there are no child nodes then this collection is empty (it has zero length). The childNodes collection is a NodeList, in which the items are indexed numerically, and appear in source order.

    As with all node lists, childNodes is a live collection, which means that changes to the collection it represents are immediately reflected in the node list (as opposed to it being a static snapshot).

    Attributes of an element are not considered child nodes, and therefore don’t appear in the childNodes collection2 This collection is read only.

    returns

    an ordered list of all the direct child nodes of this node

    Definition Classes
    Node
  21. def children: HTMLCollection[Element]

    Permalink

    Returns a live HTMLCollection containing all objects of type Element that are children of this ParentNode.

    Returns a live HTMLCollection containing all objects of type Element that are children of this ParentNode.

    Definition Classes
    ParentNode
  22. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  23. def cloneNode(deep: Boolean): XMLDocument.this.type

    Permalink

    Creates a duplicate of this node, including all attributes and their values (including attributes which are not explicitly defined but which have a default value in this document type).

    Creates a duplicate of this node, including all attributes and their values (including attributes which are not explicitly defined but which have a default value in this document type). The duplicate node has no parent (parentNode is null) until it's added to the document, for example using appendChild.

    If the deep argument is included and has the value true then the node's sub-tree (if any) will also be duplicated.

    Cloning a sub-tree that is readonly results in a sub-tree that can be modified (ie. the sub-tree of a cloned node is always mutable, even if the original was immutable), with the exception that the children of a cloned EntityReference are always readonly.

    Cloning an Element node also copies its attributes (including any default attributes), but does not copy its text unless the deep argument is true.

    Cloning an Attr node directly (as opposed to attributes that belong to a cloned Element) creates a node for which the specified property is true.

    Whether a Document, DocumentType, Entity or Notation node may be cloned is not defined by the DOM, and depends on the implementation (see Compatibility notes below).

    deep

    If true duplicate the node's sub-tree as well as the node itself. If false only copy the node (and its attributes, if it's an Element).

    returns

    The duplicate node.

    Definition Classes
    Node
  24. def close(): Unit

    Permalink

    Closes the output stream previously opened with Document#open()

    Closes the output stream previously opened with Document#open()

    Definition Classes
    Document
  25. var cookie: String

    Permalink

    Returns all name/value pairs of cookies in the document

    Returns all name/value pairs of cookies in the document

    returns

    all name/value pairs of cookies in the document

    Definition Classes
    Document
  26. def createAttribute(name: String): Unit

    Permalink

    Creates an attribute node

    Creates an attribute node

    Definition Classes
    Document
  27. def createComment(text: String): Comment

    Permalink

    Creates a Comment node with the specified text

    Creates a Comment node with the specified text

    Definition Classes
    Document
  28. def createDocumentFragment(): DocumentFragment

    Permalink

    Creates an empty DocumentFragment node

    Creates an empty DocumentFragment node

    Definition Classes
    Document
  29. def createElement[T <: Element](type: String): T

    Permalink

    Creates an Element node

    Creates an Element node

    returns

    a new element

    Definition Classes
    Document
  30. def createEntityReference(name: String): EntityReference

    Permalink

    The EntityReference interface inherits from Node, and represents an unexpanded entity reference (eg.

    The EntityReference interface inherits from Node, and represents an unexpanded entity reference (eg. amp). EntityReference nodes may appear in the DOM when an entity reference appears in the source document, or when inserting new entity references. Entity nodes themselves are readonly, so the EntityReference interface is used to create or modify them.

    The DOM does not require an implementation to expand external entities, hence the replacement value of an entity reference may not be available; if it is available it will appear in the childNodes collection of the EntityReference.

    Conversely, an implementation may choose to expand all entities before building the DOM tree, in which case there will be no EntityReference nodes in the document at all, only Entity nodes. In practise, this is what happens in all tested browsers.

    An EntityReference node can have Element, ProcessingInstruction, Comment, Text, CDATASection and other EntityReference nodes as children.

    name

    the name of the entity

    returns

    an EntityReference

    Definition Classes
    Document
  31. def createTextNode(text: String): Element

    Permalink

    Creates a Text node

    Creates a Text node

    text

    the given text

    returns

    a new text node

    Definition Classes
    Document
  32. def doctype: DocumentType

    Permalink

    Returns the Document Type Declaration associated with the document

    Returns the Document Type Declaration associated with the document

    returns

    the Document Type Declaration associated with the document

    Definition Classes
    Document
  33. def documentElement: HTMLElement

    Permalink

    Returns the Document Element of the document (the <html> element)

    Returns the Document Element of the document (the <html> element)

    returns

    the Document Element of the document (the <html> element)

    Definition Classes
    Document
  34. def documentMode: String

    Permalink

    Returns the mode used by the browser to render the document

    Returns the mode used by the browser to render the document

    returns

    the mode used by the browser to render the document

    Definition Classes
    Document
  35. var documentURI: String

    Permalink

    Sets or returns the location of the document

    Sets or returns the location of the document

    Definition Classes
    Document
  36. def domConfig: String

    Permalink

    Obsolete.

    Obsolete. Returns the DOM configuration of the document

    returns

    the DOM configuration of the document

    Definition Classes
    Document
  37. def domain: String

    Permalink

    Returns the domain name of the server that loaded the document

    Returns the domain name of the server that loaded the document

    returns

    the domain name of the server that loaded the document

    Definition Classes
    Document
  38. def embeds: HTMLCollection[HTMLEmbedElement]

    Permalink

    Returns a collection of all <embed> elements the document

    Returns a collection of all <embed> elements the document

    returns

    a collection of all <embed> elements the document

    Definition Classes
    Document
  39. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  40. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  41. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  42. def firstChild[T <: Node]: T

    Permalink

    The first node that is a direct child of this node (ie.

    The first node that is a direct child of this node (ie. this node is its parent and it appears at the beginning of the childNodes collection), or null if there is no such node. This property is readonly.

    returns

    The first node that is a direct child of this node

    Definition Classes
    Node
  43. def firstElementChild: Element

    Permalink

    Returns the Element that is the first child of this ParentNode, or null if there is none.

    Returns the Element that is the first child of this ParentNode, or null if there is none.

    Definition Classes
    ParentNode
  44. def forms: HTMLCollection[HTMLFormElement]

    Permalink

    Returns a collection of all

    elements in the document

    Returns a collection of all

    elements in the document

    returns

    a collection of all elements in the document

    Definition Classes
    Document
  45. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  46. def getElementById[T <: Element](id: String): T

    Permalink

    Returns the element that has the ID attribute with the specified value

    Returns the element that has the ID attribute with the specified value

    id

    the ID attribute

    returns

    the element that has the ID attribute

    Definition Classes
    Document
  47. def getElementsByClassName(className: String): HTMLCollection[Element]

    Permalink

    Returns a HTMLCollection containing all elements with the specified class name

    Returns a HTMLCollection containing all elements with the specified class name

    className

    the specified class name

    returns

    a HTMLCollection of elements

    Definition Classes
    Document
  48. def getElementsByName(name: String): HTMLCollection[Element]

    Permalink

    Returns a HTMLCollection containing all elements with a specified name

    Returns a HTMLCollection containing all elements with a specified name

    name

    the specified name

    returns

    a HTMLCollection of elements

    Definition Classes
    Document
  49. def getElementsByTagName(tagName: String): HTMLCollection[Element]

    Permalink

    Returns a HTMLCollection containing all elements with the specified tag name

    Returns a HTMLCollection containing all elements with the specified tag name

    tagName

    the specified tag name

    returns

    a HTMLCollection of elements

    Definition Classes
    Document
  50. def hasAttributes(): Boolean

    Permalink

    Returns whether an Element node has any attributes.

    Returns whether an Element node has any attributes.

    returns

    true if this node is an Element and has any effective attributes, otherwise false

    Definition Classes
    Node
  51. def hasChildNodes(): Boolean

    Permalink

    Test whether a node has any child nodes; equivalent to evaluating whether the childNodes collection has a length greater than zero.

    Test whether a node has any child nodes; equivalent to evaluating whether the childNodes collection has a length greater than zero.

    returns

    true if this node has any children, otherwise false

    Definition Classes
    Node
  52. def hasFocus(): Boolean

    Permalink

    Returns a Boolean value indicating whether the document has focus

    Returns a Boolean value indicating whether the document has focus

    returns

    a Boolean value indicating whether the document has focus

    Definition Classes
    Document
  53. def hasOwnProperty(v: String): Boolean

    Permalink
    Definition Classes
    Object
  54. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  55. def head: HTMLHeadElement

    Permalink

    Returns the <head> element of the document

    Returns the <head> element of the document

    returns

    the <head> element of the document

    Definition Classes
    Document
  56. def images: HTMLCollection[Image]

    Permalink

    Returns a collection of all elements in the document

    Returns a collection of all elements in the document

    returns

    a collection of all elements in the document

    Definition Classes
    Document
  57. def implementation: DocumentImplementation

    Permalink

    The implementation property returns the DOMimplementation object that handles this document, as a DocumentImplementation object.

    The implementation property returns the DOMimplementation object that handles this document, as a DocumentImplementation object.

    Definition Classes
    Document
  58. def importNode(node: Element, deep: Boolean): Element

    Permalink

    Imports a node from another document

    Imports a node from another document

    node

    Required. The node from another document. Can be of any node type

    deep

    Required. If set to false, only the node itself is imported, if set to true, all child nodes (descendants) are also imported

    returns

    A Node object, representing the imported node

    Definition Classes
    Document
  59. def inputEncoding: String

    Permalink

    Returns the encoding, character set, used for the document

    Returns the encoding, character set, used for the document

    returns

    the encoding, character set, used for the document

    Definition Classes
    Document
  60. def insertBefore(newNode: Node, existingChild: Node): Node

    Permalink

    Insert a new node as a child of this node, directly before an existing child of this node, or at the end of the list of children if no existing child is specified or it's null.

    Insert a new node as a child of this node, directly before an existing child of this node, or at the end of the list of children if no existing child is specified or it's null. If the new child is already present in the DOM tree it is first removed (effectively moving it).

    newNode

    The new node to insert.

    existingChild

    An existing child node that the new node should be inserted before. If this argument is null, the new node is inserted at the end of this node's list of children.

    returns

    the inserted node

    Definition Classes
    Node
  61. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  62. def isPrototypeOf(v: Object): Boolean

    Permalink
    Definition Classes
    Object
  63. def isSupported(feature: String, version: String = js.native): Boolean

    Permalink

    Test whether a specific feature of the DOM is implemented, and supported by this node.

    Test whether a specific feature of the DOM is implemented, and supported by this node.

    This method is essentially the same as hasFeature, except that it's concerned with whether a feature is supported by a specific node, rather than whether it's implemented in general.

    feature

    The name of the feature to test, using one of the values defined in the DOM 2 Conformance list.

    version

    The DOM version to test. For DOM 2 this is always the value 2.0. If this argument is not specified, the method will return true if the feature is supported at any DOM level.

    returns

    true if the feature is implemented and supported on this node, otherwise false

    Definition Classes
    Node
  64. def lastChild: Node

    Permalink

    The last node that is a direct child of this node (ie.

    The last node that is a direct child of this node (ie. this node is its parent and it appears at the end of the childNodes collection), or null if there is no such node. This property is readonly.

    returns

    The last node that is a direct child of this node

    Definition Classes
    Node
  65. def lastElementChild: Element

    Permalink

    Returns the Element that is the last child of this ParentNode, or null if there is none.

    Returns the Element that is the last child of this ParentNode, or null if there is none.

    Definition Classes
    ParentNode
  66. def lastModified: Double

    Permalink

    Returns the date and time the document was last modified

    Returns the date and time the document was last modified

    returns

    the date and time the document was last modified

    Definition Classes
    Document
  67. def links: HTMLCollection[HTMLAnchorElement]

    Permalink

    Returns a collection of all and elements in the document that have a href attribute

  68. def load(): Unit

    Permalink

    Loads an XML document.

    Loads an XML document.

    document.load() is a part of an old version of the W3C DOM Level 3 Load & Save module. Can be used with document.async to indicate whether the request is synchronous or asynchronous (the default). As of at least Gecko 1.9, this no longer supports cross-site loading of documents (Use XMLHttpRequest instead).

  69. def localName: String

    Permalink

    The local name (ie.

    The local name (ie. not including any namespace prefix) of a Element or Attr node; for other nodes this property is null.

    DOM 1 methods such as getAttribute are not namespace aware, and identify nodes by their nodeName. Namespace aware DOM 2 methods such as getAttributeNS identify nodes by a combination of their namespaceURI and localName; the localName and prefix combined form a qualified name — a name which comprises the namespace prefix then the local name, delimited with a colon. This property is readonly.

    returns

    The local name

    Definition Classes
    Node
  70. def namespaceURI: String

    Permalink

    The namespace URI of an Element or Attr node.

    The namespace URI of an Element or Attr node. For other nodes, or elements or attributes created with a DOM 1 method that isn't namespace aware (such as createElement), or nodes with no namespace, this property is null.

    This should not be a computed value or lookup of the namespace an element should have, it should be the literal value that it does have.

    An Element node can inherit its namespace from an ancestor. However Attr nodes do not inherit a namespace from the element they're attached to — if an attribute does not have an explicitly defined namespace then it simply has no namespace. This property is readonly.

    returns

    The namespace URI

    Definition Classes
    Node
  71. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  72. def nextSibling: Node

    Permalink

    The node immediately after this node (ie.

    The node immediately after this node (ie. both nodes have the same parent and are next to each other in its childNodes collection), or null if there is no such node. This property is readonly.

    returns

    The node immediately after this node

    Definition Classes
    Node
  73. def nodeName: String

    Permalink

    The name of this node

    The name of this node

    Definition Classes
    Node
  74. def nodeType: NodeType

    Permalink

    A numeric code that represents the type of this node +---------------------------+----+ | Element | 1 | | Attr | 2 | | Text | 3 | | CDATASection | 4 | | EntityReference | 5 | | Entity | 6 | | ProcessingInstruction | 7 | | Comment | 8 | | Document | 9 | | DocumentType | 10 | | DocumentFragment | 11 | | Notation | 12 | +---------------------------+----+

    A numeric code that represents the type of this node +---------------------------+----+ | Element | 1 | | Attr | 2 | | Text | 3 | | CDATASection | 4 | | EntityReference | 5 | | Entity | 6 | | ProcessingInstruction | 7 | | Comment | 8 | | Document | 9 | | DocumentType | 10 | | DocumentFragment | 11 | | Notation | 12 | +---------------------------+----+

    returns

    the numeric code

    Definition Classes
    Node
    See also

    NodeTypes

  75. def nodeValue: Any

    Permalink

    The value of this node

    The value of this node

    Definition Classes
    Node
  76. def normalize(): Unit

    Permalink

    Removes empty Text nodes, and joins adjacent nodes

    Removes empty Text nodes, and joins adjacent nodes

    Definition Classes
    DocumentNode
  77. def normalizeDocument(): Unit

    Permalink

    Removes empty Text nodes, and joins adjacent nodes

    Removes empty Text nodes, and joins adjacent nodes

    Definition Classes
    Document
  78. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  79. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  80. def onabort(callback: Function): Unit

    Permalink

    The event occurs when the loading of a resource has been aborted

    The event occurs when the loading of a resource has been aborted

    Definition Classes
    FrameObjectEvents
  81. def onafterprint(callback: Function): Unit

    Permalink

    The event occurs when a page has started printing, or if the print dialogue box has been closed

    The event occurs when a page has started printing, or if the print dialogue box has been closed

    Definition Classes
    PrintEvents
  82. def onbeforeprint(callback: Function): Unit

    Permalink

    The event occurs when a page is about to be printed

    The event occurs when a page is about to be printed

    Definition Classes
    PrintEvents
  83. def onbeforeunload(callback: Function): Unit

    Permalink

    The event occurs before the document is about to be unloaded

    The event occurs before the document is about to be unloaded

    Definition Classes
    FrameObjectEvents
  84. def onblur(callback: Function): Unit

    Permalink

    The event occurs when an element loses focus

    The event occurs when an element loses focus

    Definition Classes
    FormEvents
  85. def onchange(callback: Function): Unit

    Permalink

    The event occurs when the content of a form element, the selection, or the checked state have changed (for , ,