JavaScript Element : Node
Instance Properties
Map of custom 'data-'
prefixed attributes on this
. Attribute names are converted to
camel case.
Example:
RunResults:
A unique name for this element in the document. You can retrieve an element by id
using document.getElementById()
.
Instance Methods
Inserts the specified nodes at the end of this.childNodes
. See also prepend, replaceChildren, and Node.appendChild.
Example:
RunResults:
Returns the rectangular bounds of this
relative to the viewport. If this is a text element that is
split on multiple lines, the rectangle will be enlarged to contain all portions. Use getClientRects()
to get the rectangles of each portion.
Example:
RunResults:
Returns a list of rectangles where this
is in the document. This method is similar to getBoundingClientRect()
except it will return a ClientRect for each part of the element (eg, text elements split on multiple lines will
return a list with length
> 1).
Example:
RunResults:
Returns a list of descendants of this
that match the specified class name. See also getElementsByTagName()
, querySelector()
, and querySelectorAll()
.
Example:
RunResults:
Returns a list of descendants of this
that match the specified tag name. See also getElementsByTagNameNS()
, getElementsByClassName()
, querySelector()
, and querySelectorAll()
.
Example:
RunResults:
Inserts the specified nodes at the start of this.childNodes
. See also
append, replaceChildren, and Node.insertBefore.
Example:
RunResults:
Returns the first Element
that matches the CSS selector
. See also querySelectorAll()
, getElementsByTagName()
, and getElementsByClassName()
.
Example:
RunResults:
Returns a NodeList
containing the Element
s in the document that match the CSS selector.
See also querySelector()
, getElementsByTagName()
, and getElementsByClassName()
.
Example:
RunResults:
Same as
replaceChildren(new Text(item0), new Text(item1), ...)
.
Example:
RunResults:
Removes all items from this.childNodes
and replaces them with the
specified nodes. See also append, prepend, Node.insertBefore, Node.removeChild, and Node.replaceChild.
Example:
RunResults:
Enters fullscreen mode where this
fills the entire screen. See also document.exitFullscreen()
.
Example:
RunResults:
Locks the pointer (mouse cursor) to this
. If successful, document.onpointerlockchange will fire and subsequent pointer moves be
sent to this
. If unable to lock the pointer, document.onpointerlockerror will fire. Use document.exitPointerLock to release the pointer. See also document.pointerLockElement, MouseEvent.movementX and MouseEvent.movementY.