Documentation ¶
Overview ¶
Package dom provides APIs for interacting with the DOM.
Index ¶
- func AppendChild(parent, child js.Value, populate func(child js.Value))
- func DefaultQueryString() string
- func DoClick(o js.Value)
- func ID(o js.Value) string
- func OnClick(o js.Value, callback func(ctx jsutil.AsyncContext, evt Event)) jsutil.CleanupFunc
- func OnSubmit(o js.Value, callback func(ctx jsutil.AsyncContext, evt Event)) jsutil.CleanupFunc
- func RemoveChildren(p js.Value)
- func SetValue(o js.Value, value string)
- func TextContent(o js.Value) string
- func Value(o js.Value) string
- type Dialog
- type Doc
- type Event
- type URLSearchParams
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AppendChild ¶ added in v0.0.23
AppendChild adds the child object. If non-nil, the populate() function is invoked on the child to initialize it.
func DefaultQueryString ¶ added in v0.0.12
func DefaultQueryString() string
DefaultQueryString returns the query string used to request the current document. This is likely not available during unit tests, but is available in normal operation.
func DoClick ¶ added in v0.0.23
DoClick simulates a click. Any callback registered by OnClick() will be invoked.
func OnClick ¶ added in v0.0.23
func OnClick(o js.Value, callback func(ctx jsutil.AsyncContext, evt Event)) jsutil.CleanupFunc
OnClick registers a callback to be invoked when the specified object is clicked.
func OnSubmit ¶ added in v0.0.23
func OnSubmit(o js.Value, callback func(ctx jsutil.AsyncContext, evt Event)) jsutil.CleanupFunc
OnSubmit registers a callback to be invoked when the specified form is submitted.
func RemoveChildren ¶ added in v0.0.23
RemoveChildren removes all children of the specified node.
func TextContent ¶ added in v0.0.23
TextContent returns the text content of the specified object (and its children).
Types ¶
type Dialog ¶ added in v0.0.23
type Dialog struct {
// contains filtered or unexported fields
}
Dialog represents an HTML dialog.
func (*Dialog) OnClose ¶ added in v0.0.23
func (d *Dialog) OnClose(callback func(ctx jsutil.AsyncContext, evt Event)) jsutil.CleanupFunc
OnClose registers the specified callback to be invoked when the dialog is closed. The returned function must be invoked to cleanup when it is no longer needed.
type Doc ¶
type Doc struct {
// contains filtered or unexported fields
}
Doc provides an API for interacting with the DOM for a Document.
func (*Doc) GetElement ¶ added in v0.0.23
GetElement returns the element with the specified ID.
func (*Doc) GetElementsByTag ¶ added in v0.0.23
GetElementsByTag returns the elements with the speciied tag.
func (*Doc) NewElement ¶ added in v0.0.23
NewElement returns a new element with the specified tag (e.g., 'tr', 'td').
func (*Doc) OnDOMContentLoaded ¶ added in v0.0.23
func (d *Doc) OnDOMContentLoaded(callback func(ctx jsutil.AsyncContext)) jsutil.CleanupFunc
OnDOMContentLoaded registers a callback to be invoked when the DOM has finished loading.
type URLSearchParams ¶ added in v0.0.12
type URLSearchParams struct {
// contains filtered or unexported fields
}
URLSearchParams is a thin wrapper around the URLSearchParams API. See https://url.spec.whatwg.org/#urlsearchparams.
func NewURLSearchParams ¶ added in v0.0.12
func NewURLSearchParams(queryString string) *URLSearchParams
NewURLSearchParams returns a URLSearchParams for the specified query string.
func (*URLSearchParams) Has ¶ added in v0.0.12
func (u *URLSearchParams) Has(param string) bool
Has indicates if the query string contains the specified parameter.