Documentation ¶
Overview ¶
Package dom provides APIs for interacting with the DOM.
Index ¶
- Variables
- type DOM
- func (d *DOM) AppendChild(parent, child *js.Object, populate func(child *js.Object))
- func (d *DOM) Close(o *js.Object)
- func (d *DOM) DoClick(o *js.Object)
- func (d *DOM) DoDOMContentLoaded()
- func (d *DOM) GetElement(id string) *js.Object
- func (d *DOM) NewElement(tag string) *js.Object
- func (d *DOM) NewText(text string) *js.Object
- func (d *DOM) OnClick(o *js.Object, callback func())
- func (d *DOM) OnDOMContentLoaded(callback func())
- func (d *DOM) RemoveChildren(p *js.Object)
- func (d *DOM) RemoveEventListeners(o *js.Object) *js.Object
- func (d *DOM) SetValue(o *js.Object, value string)
- func (d *DOM) ShowModal(o *js.Object)
- func (d *DOM) TextContent(o *js.Object) string
- func (d *DOM) Value(o *js.Object) string
Constants ¶
This section is empty.
Variables ¶
var ( // Doc is the default 'document' object. This should be used for regular // code. See NewDocForTesting() for a Document object that can be used in // unit tests. Doc = js.Global.Get("document") )
Functions ¶
This section is empty.
Types ¶
type DOM ¶
type DOM struct {
// contains filtered or unexported fields
}
DOM provides an API for interacting with the DOM for a Document.
func (*DOM) AppendChild ¶
AppendChild adds the child object. If non-nil, the populate() function is invoked on the child to initialize it.
func (*DOM) DoClick ¶
DoClick simulates a click. Any callback registered by OnClick() will be invoked.
func (*DOM) DoDOMContentLoaded ¶
func (d *DOM) DoDOMContentLoaded()
DoDOMContentLoaded simulates the DOMContentLoaded event. Any callback registered by OnDOMContentLoaded() will be invoked.
func (*DOM) GetElement ¶
GetElement returns the element with the specified ID.
func (*DOM) NewElement ¶
NewElement returns a new element with the specified tag (e.g., 'tr', 'td').
func (*DOM) OnClick ¶
OnClick registers a callback to be invoked when the specified object is clicked.
func (*DOM) OnDOMContentLoaded ¶
func (d *DOM) OnDOMContentLoaded(callback func())
OnDOMContentLoaded registers a callback to be invoked when the DOM has finished loading.
func (*DOM) RemoveChildren ¶
RemoveChildren removes all children of the specified node.
func (*DOM) RemoveEventListeners ¶ added in v0.0.8
RemoveEventListeners removes all event listeners from an object and its children. This is accomplished by cloning the object, which has the side effect of *not* cloning the event listeners. The newly-created object is returned.
func (*DOM) TextContent ¶
TextContent returns the text content of the specified object (and its children).