The Document interface is an interface for web documents. It represents a document as a logical tree and has different properties and methods you can access as you build.
Listen to these events using addEventListener()
or by assigning an event listener to the oneventname
property of this interface.
afterscriptexecute
Non-standard
Fired when a static <script>
element finishes executing its script
beforescriptexecute
Non-standard
Fired when a static <script>
is about to start executing.
securitypolicyviolation
Fired when a content security policy is violated.
scroll
Fired when the document view or an element has been scrolled.
visibilitychange
Fired when the content of a tab has become visible or has been hidden.
wheel
Fired when the user rotates a wheel button on a pointing device (typically a mouse).
animationcancel
Fired when an animation unexpectedly aborts.
animationend
Fired when an animation has completed normally.
animationiteration
Fired when an animation iteration has completed.
animationstart
Fired when an animation starts.
copy
Fired when the user initiates a copy action through the browser's user interface.
cut
Fired when the user initiates a cut action through the browser's user interface.
paste
Fired when the user initiates a paste action through the browser's user interface.
drag
Fired every few hundred milliseconds as an element or text selection is being dragged by the user.
dragend
Fired when a drag operation is being ended (by releasing a mouse button or hitting the escape key).
dragenter
Fired when a dragged element or text selection enters a valid drop target.
dragleave
Fired when a dragged element or text selection leaves a valid drop target.
dragover
Fired when an element or text selection is being dragged over a valid drop target (every few hundred milliseconds).
dragstart
Fired when the user starts dragging an element or text selection.
drop
Fired when an element or text selection is dropped on a valid drop target.
fullscreenchange
Fired when the Document
transitions into or out of fullscreen mode.
fullscreenerror
Fired if an error occurs while attempting to switch into or out of fullscreen mode.
keydown
Fired when a key is pressed.
keypress
Deprecated
Fired when a key that produces a character value is pressed down.
keyup
Fired when a key is released.
DOMContentLoaded
Fired when the document has been completely loaded and parsed, without waiting for stylesheets, images, and subframes to finish loading.
readystatechange
Fired when the readyState
attribute of a document has changed.
gotpointercapture
Fired when an element captures a pointer using setPointerCapture()
.
lostpointercapture
Fired when a captured pointer is released.
pointercancel
Fired when a pointer event is canceled.
pointerdown
Fired when a pointer becomes active.
pointerenter
Fired when a pointer is moved into the hit test boundaries of an element or one of its descendants.
pointerleave
Fired when a pointer is moved out of the hit test boundaries of an element.
pointerlockchange
Fired when the pointer is locked/unlocked.
pointerlockerror
Fired when locking the pointer failed.
pointermove
Fired when a pointer changes coordinates.
pointerout
Fired when a pointer is moved out of the hit test boundaries of an element (among other reasons).
pointerover
Fired when a pointer is moved into an element's hit test boundaries.
pointerup
Fired when a pointer is no longer active.
selectionchange
Fired when the current text selection on a document is changed.
touchcancel
Fired when one or more touch points have been disrupted in an implementation-specific manner (for example, too many touch points are created).
touchend
Fired when one or more touch points are removed from the touch surface.
touchmove
Fired when one or more touch points are moved along the touch surface.
touchstart
Fired when one or more touch points are placed on the touch surface.
transitioncancel
Fired when a CSS transition is canceled.
transitionend
Fired when a CSS transition has completed.
transitionrun
Fired when a CSS transition is first created.
transitionstart
Fired when a CSS transition has actually started.