jsdom

package
v4.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 5, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Rendered for js/wasm

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewWASMDOMNode

func NewWASMDOMNode(parseValue js.Value) runtime.DOMNode

NewWASMDOMNode wraps a raw js.Value as a runtime.DOMNode.

Types

type WASMBrowserState

type WASMBrowserState struct {
	// contains filtered or unexported fields
}

WASMBrowserState implements runtime.BrowserState for browser/WASM.

func NewWASMBrowserState

func NewWASMBrowserState() *WASMBrowserState

NewWASMBrowserState creates a browser state adapter backed by window and history.

func (*WASMBrowserState) GetCurrentPath

func (parseB *WASMBrowserState) GetCurrentPath() string

func (*WASMBrowserState) GetHash

func (parseB *WASMBrowserState) GetHash() string

func (*WASMBrowserState) GetItem

func (parseB *WASMBrowserState) GetItem(parseKey string) (string, bool)

func (*WASMBrowserState) OnPopState

func (parseB *WASMBrowserState) OnPopState(parseCallback func(path string))

func (*WASMBrowserState) PushState

func (parseB *WASMBrowserState) PushState(parseState interface{}, parseTitle, parseUrl string)

func (*WASMBrowserState) Reload

func (parseB *WASMBrowserState) Reload()

func (*WASMBrowserState) RemoveItem

func (parseB *WASMBrowserState) RemoveItem(parseKey string)

func (*WASMBrowserState) ReplaceState

func (parseB *WASMBrowserState) ReplaceState(parseState interface{}, parseTitle, parseUrl string)

func (*WASMBrowserState) SetHash

func (parseB *WASMBrowserState) SetHash(parseHash string)

func (*WASMBrowserState) SetItem

func (parseB *WASMBrowserState) SetItem(parseKey, parseValue string) error

type WASMDOMAdapter

type WASMDOMAdapter struct {
	// contains filtered or unexported fields
}

WASMDOMAdapter implements runtime.DOMAdapter for browser/WASM.

func NewWASMDOMAdapter

func NewWASMDOMAdapter() *WASMDOMAdapter

NewWASMDOMAdapter creates a DOM adapter backed by the browser document.

func (*WASMDOMAdapter) AddClass

func (parseA *WASMDOMAdapter) AddClass(parseNode runtime.DOMNode, parseClassName string)

func (*WASMDOMAdapter) AddPassiveEventListener

func (parseA *WASMDOMAdapter) AddPassiveEventListener(parseNode runtime.DOMNode, parseEventType string, parseHandler any)

func (*WASMDOMAdapter) AppendChild

func (parseA *WASMDOMAdapter) AppendChild(parseParent, parseChild runtime.DOMNode)

func (*WASMDOMAdapter) BatchSetAttributes

func (parseA *WASMDOMAdapter) BatchSetAttributes(parseNode runtime.DOMNode, parseAttrs map[string]string)

BatchSetAttributes sets multiple attributes without paying one extra Go callback hop.

func (*WASMDOMAdapter) BeginAttrUpdateBatch added in v4.2.0

func (parseA *WASMDOMAdapter) BeginAttrUpdateBatch()

BeginAttrUpdateBatch starts buffering attribute writes for the current commit. Reads of attributes must not occur until EndAttrUpdateBatch.

func (*WASMDOMAdapter) BeginBatch

func (parseA *WASMDOMAdapter) BeginBatch(parseParent runtime.DOMNode)

BeginBatch starts batching DOM operations for a parent node

func (*WASMDOMAdapter) CreateElement

func (parseA *WASMDOMAdapter) CreateElement(parseTag string) runtime.DOMNode

func (*WASMDOMAdapter) CreateHTMLFragment added in v4.2.0

func (parseA *WASMDOMAdapter) CreateHTMLFragment(parseHTML string) runtime.DOMNode

CreateHTMLFragment parses several serialized sibling subtrees through the shared template element in one bridge call and returns the template CONTENT node; its children are the parsed roots (still detached — walking then appending them moves each out of the fragment).

func (*WASMDOMAdapter) CreateHTMLSubtree added in v4.1.0

func (parseA *WASMDOMAdapter) CreateHTMLSubtree(parseHTML string) runtime.DOMNode

CreateHTMLSubtree parses one serialized HTML subtree through the shared template element in a single bridge call and returns its root node (still detached; appending it later moves it out of the template content).

func (*WASMDOMAdapter) CreatePreparedElement

func (parseA *WASMDOMAdapter) CreatePreparedElement(parseTag string, parseAttrs []runtime.HostAttr, parseText string) runtime.DOMNode

CreatePreparedElement creates one compact host element using one conservative template fast path when it is safe to do so.

func (*WASMDOMAdapter) CreateTextNode

func (parseA *WASMDOMAdapter) CreateTextNode(parseText string) runtime.DOMNode

func (*WASMDOMAdapter) EndAttrUpdateBatch added in v4.2.0

func (parseA *WASMDOMAdapter) EndAttrUpdateBatch()

EndAttrUpdateBatch applies all buffered attribute writes in one bridge call. Idempotent; safe to call defensively.

func (*WASMDOMAdapter) EndBatch

func (parseA *WASMDOMAdapter) EndBatch()

EndBatch commits all batched operations

func (*WASMDOMAdapter) GetAttribute

func (parseA *WASMDOMAdapter) GetAttribute(parseNode runtime.DOMNode, parseName string) string

GetAttribute reports one attribute value from one wasm DOM node.

func (*WASMDOMAdapter) GetChildren

func (parseA *WASMDOMAdapter) GetChildren(parseNode runtime.DOMNode) []runtime.DOMNode

func (*WASMDOMAdapter) GetElementById

func (parseA *WASMDOMAdapter) GetElementById(parseId string) runtime.DOMNode

func (*WASMDOMAdapter) GetElementsByClassName

func (parseA *WASMDOMAdapter) GetElementsByClassName(parseClassName string) []runtime.DOMNode

func (*WASMDOMAdapter) GetElementsByTagName

func (parseA *WASMDOMAdapter) GetElementsByTagName(parseTagName string) []runtime.DOMNode

func (*WASMDOMAdapter) GetFirstChild

func (parseA *WASMDOMAdapter) GetFirstChild(parseNode runtime.DOMNode) runtime.DOMNode

func (*WASMDOMAdapter) GetInnerHTML

func (parseA *WASMDOMAdapter) GetInnerHTML(parseNode runtime.DOMNode) string

func (*WASMDOMAdapter) GetNextSibling

func (parseA *WASMDOMAdapter) GetNextSibling(parseNode runtime.DOMNode) runtime.DOMNode

func (*WASMDOMAdapter) GetParent

func (parseA *WASMDOMAdapter) GetParent(parseNode runtime.DOMNode) runtime.DOMNode

func (*WASMDOMAdapter) GetProperty

func (parseA *WASMDOMAdapter) GetProperty(parseNode runtime.DOMNode, parseName string) interface{}

func (*WASMDOMAdapter) GetTextContent

func (parseA *WASMDOMAdapter) GetTextContent(parseNode runtime.DOMNode) string

func (*WASMDOMAdapter) InsertBefore

func (parseA *WASMDOMAdapter) InsertBefore(parseParent, parseNewNode, parseReferenceNode runtime.DOMNode)

func (*WASMDOMAdapter) QuerySelector

func (parseA *WASMDOMAdapter) QuerySelector(parseSelector string) interface{}

func (*WASMDOMAdapter) QuerySelectorAll

func (parseA *WASMDOMAdapter) QuerySelectorAll(parseSelector string) []runtime.DOMNode

func (*WASMDOMAdapter) RemoveAttribute

func (parseA *WASMDOMAdapter) RemoveAttribute(parseNode runtime.DOMNode, parseName string)

func (*WASMDOMAdapter) RemoveChild

func (parseA *WASMDOMAdapter) RemoveChild(parseParent, parseChild runtime.DOMNode)

func (*WASMDOMAdapter) RemoveClass

func (parseA *WASMDOMAdapter) RemoveClass(parseNode runtime.DOMNode, parseClassName string)

func (*WASMDOMAdapter) RemovePassiveEventListener

func (parseA *WASMDOMAdapter) RemovePassiveEventListener(parseNode runtime.DOMNode, parseEventType string, parseHandler any)

func (*WASMDOMAdapter) ReplaceChild

func (parseA *WASMDOMAdapter) ReplaceChild(parseParent, parseNewNode, parseOldNode runtime.DOMNode)

func (*WASMDOMAdapter) ReplaceChildren

func (parseA *WASMDOMAdapter) ReplaceChildren(parseParent runtime.DOMNode, parseChildren []runtime.DOMNode)

ReplaceChildren replaces one parent child list in one DOM bridge call.

func (*WASMDOMAdapter) ResolveNode

func (parseA *WASMDOMAdapter) ResolveNode(parseValue interface{}) runtime.DOMNode

func (*WASMDOMAdapter) SetAttribute

func (parseA *WASMDOMAdapter) SetAttribute(parseNode runtime.DOMNode, parseName, parseValue string)

func (*WASMDOMAdapter) SetProperty

func (parseA *WASMDOMAdapter) SetProperty(parseNode runtime.DOMNode, parseName string, parseValue interface{})

func (*WASMDOMAdapter) SetStyle

func (parseA *WASMDOMAdapter) SetStyle(parseNode runtime.DOMNode, parseProperty, parseValue string)

func (*WASMDOMAdapter) SetStyles

func (parseA *WASMDOMAdapter) SetStyles(parseNode runtime.DOMNode, parseStyles map[string]string)

func (*WASMDOMAdapter) SetTextContent

func (parseA *WASMDOMAdapter) SetTextContent(parseNode runtime.DOMNode, parseText string)

func (*WASMDOMAdapter) ToggleClass

func (parseA *WASMDOMAdapter) ToggleClass(parseNode runtime.DOMNode, parseClassName string)

func (*WASMDOMAdapter) WrapFunction

func (parseA *WASMDOMAdapter) WrapFunction(parseFn interface{}) interface{}

type WASMDOMNode

type WASMDOMNode struct {
	// contains filtered or unexported fields
}

WASMDOMNode wraps a js.Value representing a DOM node.

func (*WASMDOMNode) Blur

func (parseN *WASMDOMNode) Blur()

Blur implements runtime.Blurrer by calling the element's blur() method.

func (*WASMDOMNode) Click

func (parseN *WASMDOMNode) Click()

Click implements runtime.Clicker by calling the element's click() method (synthesizes a click).

func (*WASMDOMNode) Equals

func (parseN *WASMDOMNode) Equals(parseOther runtime.DOMNode) bool

func (*WASMDOMNode) Focus

func (parseN *WASMDOMNode) Focus()

Focus implements runtime.Focuser by calling the element's focus() method. It is a no-op when the underlying value is absent or not focusable.

func (*WASMDOMNode) IsNull

func (parseN *WASMDOMNode) IsNull() bool

func (*WASMDOMNode) ScrollIntoView

func (parseN *WASMDOMNode) ScrollIntoView(parseBehavior string)

ScrollIntoView implements runtime.ScrollIntoViewer. An empty behavior uses the browser default; "smooth"/"instant"/"auto" map to scrollIntoView({behavior}).

func (*WASMDOMNode) Value

func (parseN *WASMDOMNode) Value() js.Value

type WASMEventAdapter

type WASMEventAdapter struct {
	// contains filtered or unexported fields
}

WASMEventAdapter implements runtime.EventAdapter for browser/WASM.

func NewWASMEventAdapter

func NewWASMEventAdapter() *WASMEventAdapter

NewWASMEventAdapter creates an event adapter backed by browser DOM listeners.

func (*WASMEventAdapter) AddEventListener

func (parseA *WASMEventAdapter) AddEventListener(parseNode runtime.DOMNode, parseEventType string, parseHandler runtime.EventHandler)

func (*WASMEventAdapter) CreateEventHandler

func (parseA *WASMEventAdapter) CreateEventHandler(parseFn func(runtime.Event)) runtime.EventHandler

func (*WASMEventAdapter) ReleaseEventHandler

func (parseA *WASMEventAdapter) ReleaseEventHandler(parseHandler runtime.EventHandler)

func (*WASMEventAdapter) RemoveEventListener

func (parseA *WASMEventAdapter) RemoveEventListener(parseNode runtime.DOMNode, parseEventType string, parseHandler runtime.EventHandler)

type WASMScheduler

type WASMScheduler struct {
	// contains filtered or unexported fields
}

WASMScheduler implements runtime.Scheduler for browser/WASM.

func NewWASMScheduler

func NewWASMScheduler() *WASMScheduler

NewWASMScheduler creates a scheduler backed by browser idle callbacks and timeouts.

func (*WASMScheduler) CancelIdleCallback

func (parseS *WASMScheduler) CancelIdleCallback(parseId interface{})

func (*WASMScheduler) RequestIdleCallback

func (parseS *WASMScheduler) RequestIdleCallback(parseCallback func(runtime.Deadline))

func (*WASMScheduler) SetTimeout

func (parseS *WASMScheduler) SetTimeout(parseCallback func(), parseDelay int)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL