class dom::Doc

sys::Obj
  dom::Doc

@Js

Source

Doc models the DOM document object.

See pod doc for details.

activeElem

Elem? activeElem()

Source

Get the currently focused element, or null for none.

addCookie

Void addCookie(Cookie c)

Source

Add a cookie to this session.

body

Elem body()

Source

Get the body element.

cookies

Str:Str cookies()

Source

Map of cookie values keyed by cookie name. The cookies map is readonly and case insensitive.

createElem

Elem createElem(Str tagName, [Str:Str]? attrib := null, Uri? ns := null)

Source

Create a new element with the given tag name. If the attrib map is specified, set the new elements attributes to the given values. Optionally a namespace for the element can be specified with ns.

elemById

Elem? elemById(Str id)

Source

Get the element with this id, or null if no element is found with this id.

exec

Bool exec(Str name, Bool defUi := false, Obj? val := null)

Source

When a HTML document has been switched to designMode, the document object exposes the exec method which allows one to run commands to manipulate the contents of the editable region.

  • name: the command name to execute
  • defUi: flag to indicate if default user interface is shown
  • val: optional value for commands that take an argument

Elem head()

Source

Get the head element.

onEvent

Func onEvent(Str type, Bool useCapture, |Event| handler)

Source

Attach an event handler for the given event on this document. Returns callback function instance.

out

WebOutStream out()

Source

Return a WebOutStream for writing content into this document. You should call close on the stream when done writing to notify browser load is complete.

querySelector

Elem? querySelector(Str selectors)

Source

Returns the first element within the document (using depth-first pre-order traversal of the document's nodes) that matches the specified group of selectors, or null if none found.

querySelectorAll

Elem[] querySelectorAll(Str selectors)

Source

Returns a list of the elements within the document (using depth-first pre-order traversal of the document's nodes) that match the specified group of selectors.

removeEvent

Void removeEvent(Str type, Bool useCapture, Func handler)

Source

Remove the given event handler from this document. If this handler was not registered, this method does nothing.

title

Str title

Source

The title of this document.