package brr

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

Document objects

type t = El.document

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

val as_target : t -> Ev.target

as_target d is the document as an event target.

Element lookups

val find_el_by_id : t -> Jstr.t -> El.t option

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

val find_els_by_name : t -> Jstr.t -> El.t list

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

val root : t -> El.t

root d is the document's root element.

val body : t -> 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.

val head : t -> El.t

head d is the document's head element.

val active_el : t -> El.t option

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

Properties

val referrer : t -> Jstr.t

referrer d is the referrer.

val title : t -> Jstr.t

title d is the document title.

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

set_title d t sets the document title.

module Visibility_state : sig ... end

Visibility state enumeration.

val 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

val pointer_lock_element : t -> El.t option

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

val 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.

val fullscreen_available : t -> bool

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

val fullscreen_element : t -> El.t option

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

val exit_fullscreen : t -> unit Fut.or_error

exit_fullscreen d exits fullscreen mode.

OCaml

Innovation. Community. Security.