package quill

  1. Overview
  2. Docs

Module Brr_ext.DocumentSource

include module type of struct include Brr.Document end

The type for Document objects. See G.document for the global object.

Sourceval as_target : t -> Brr.Ev.target

as_target d is the document as an event target.

Element lookups

Sourceval find_el_by_id : t -> Jstr.t -> Brr.El.t option

find_el_by_id d id is the element of the document with id attribute equal to id (if any).

Sourceval find_els_by_name : t -> Jstr.t -> Brr.El.t list

find_els_by_name d n is the list of elements of the document with name attribute equal to n.

Sourceval root : t -> Brr.El.t

root d is the document's root element.

Sourceval body : t -> Brr.El.t

body d is the document's body element.

Warning. Technically this could be null if your script loads too early. It's a bit inconvenient to have it as an option though so we raise a JavaScript error if that happens; see here on the way to load your script so that it does not.

Sourceval head : t -> Brr.El.t

head d is the document's head element.

Sourceval active_el : t -> Brr.El.t option

active_el d is the document's active element, that is the one that has the focus (if any).

Properties

Sourceval referrer : t -> Jstr.t

referrer d is the referrer.

Sourceval title : t -> Jstr.t

title d is the document title.

Sourceval set_title : t -> Jstr.t -> unit

set_title d t sets the document title.

Sourcemodule Visibility_state = Brr.Document.Visibility_state

Visibility state enumeration.

Sourceval visibility_state : t -> Visibility_state.t

visibility_state d is the visibility state of d. Use the Ev.visibilitychange event to watch for changes.

Pointer locking

Sourceval pointer_lock_element : t -> Brr.El.t option

pointer_lock_element d is the element that currently locks the pointer (if any).

Sourceval exit_pointer_lock : t -> unit Fut.t

exit_pointer_lock d exits pointer lock mode. The future determines when the corresponding Ev.pointerlockchange on d has fired.

Fullscreen

Use El.request_fullscreen to get into fullscreen mode.

Sourceval fullscreen_available : t -> bool

fullscreen_available d is true if fullscreen functionality is supported and can be used.

Sourceval fullscreen_element : t -> Brr.El.t option

fullscreen_element d is the element that is being currently presented in fullscreen mode (if any).

Sourceval exit_fullscreen : t -> unit Fut.or_error

exit_fullscreen d exits fullscreen mode.

Sourceval create_range : Brr.Document.t -> Range.t
Sourceval get_selection : Brr.Document.t -> Selection.t option