dom

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package dom はWebGoスクリプト向けのDOM APIを提供する。

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

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

API は1ページのDocumentへアクセスする。

func New

func New(document *dommodel.Document, dispatcher *events.Dispatcher, onMutation func()) *API

New はDocumentに結び付いたDOM APIを生成する。

func (*API) CreateElement

func (api *API) CreateElement(tagName string) *Element

CreateElement はDocumentが所有する未接続の要素を作成する。

func (*API) CreateTextNode added in v0.14.0

func (api *API) CreateTextNode(value string) *Element

CreateTextNode creates a bounded detached text node owned by the Document.

func (*API) ElementByNodeID added in v0.14.0

func (api *API) ElementByNodeID(id dommodel.NodeID) *Element

ElementByNodeID returns a connected node handle by its document-scoped identity.

func (*API) GetElementByID

func (api *API) GetElementByID(id string) *Element

GetElementByID は指定したidを持つ最初の要素を返す。

func (*API) GetElementsByClassName added in v0.14.0

func (api *API) GetElementsByClassName(classNames string) []*Element

GetElementsByClassName returns a bounded static collection for class tokens.

func (*API) GetElementsByTagName added in v0.14.0

func (api *API) GetElementsByTagName(tagName string) []*Element

GetElementsByTagName returns a bounded static collection for a tag name.

func (*API) QuerySelector

func (api *API) QuerySelector(selector string) *Element

QuerySelector は対応する単純セレクターに最初に一致する要素を返す。

func (*API) QuerySelectorAll added in v0.14.0

func (api *API) QuerySelectorAll(selector string) []*Element

QuerySelectorAll returns a bounded static collection for a supported selector.

type Element

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

Element はDocument内の要素をNodeIDで参照する。

func (*Element) AddClass

func (element *Element) AddClass(className string) bool

AddClass は重複を避けてクラスを追加する。

func (*Element) AddEventListener added in v0.13.0

func (element *Element) AddEventListener(eventType string, handler func(Event)) bool

AddEventListener はJavaScript hostを含むRuntime adapter向けに対応Eventを登録する。

func (*Element) AddEventListenerWithCapture added in v0.14.0

func (element *Element) AddEventListenerWithCapture(eventType string, capture bool, handler func(Event)) events.ListenerID

AddEventListenerWithCapture registers a removable listener with propagation options.

func (*Element) Append added in v0.14.0

func (element *Element) Append(children ...*Element) bool

Append moves nodes to the end of this element's child list.

func (*Element) AppendChild

func (element *Element) AppendChild(child *Element) bool

AppendChild は未接続の子要素を接続済みの要素の末尾へ追加する。

func (*Element) Children added in v0.14.0

func (element *Element) Children() []*Element

Children returns a bounded static collection of direct element children.

func (*Element) ClassName added in v0.14.0

func (element *Element) ClassName() string

ClassName returns the normalized class attribute string.

func (*Element) ContainsClass added in v0.14.0

func (element *Element) ContainsClass(className string) bool

ContainsClass reports whether className is present.

func (*Element) GetAttribute

func (element *Element) GetAttribute(name string) (string, bool)

GetAttribute は要素に設定された属性値を返す。

func (*Element) ID added in v0.13.0

func (element *Element) ID() dommodel.NodeID

ID はElementが参照するPage内Node IDを返す。

func (*Element) IDValue added in v0.14.0

func (element *Element) IDValue() string

IDValue returns the id attribute.

func (*Element) InnerHTML added in v0.14.0

func (element *Element) InnerHTML() string

InnerHTML serializes this element's children.

func (*Element) OnBlur added in v0.8.0

func (element *Element) OnBlur(handler func(Event))

OnBlur は要素がfocusを失ったハンドラーを登録する。

func (*Element) OnChange

func (element *Element) OnChange(handler func(Event))

OnChange は入力の編集確定ハンドラーを登録する。

func (*Element) OnClick

func (element *Element) OnClick(handler func())

OnClick は要素のクリックイベントへハンドラーを登録する。

func (*Element) OnClickEvent

func (element *Element) OnClickEvent(handler func(Event))

OnClickEvent はクリックイベント情報を受け取るハンドラーを登録する。

func (*Element) OnFocus added in v0.8.0

func (element *Element) OnFocus(handler func(Event))

OnFocus は要素がfocusを得たハンドラーを登録する。

func (*Element) OnInput

func (element *Element) OnInput(handler func(Event))

OnInput はユーザー操作による入力値変更のハンドラーを登録する。

func (*Element) OnMouseEnter

func (element *Element) OnMouseEnter(handler func(Event))

OnMouseEnter はポインターが要素へ入ったときのハンドラーを登録する。

func (*Element) OnMouseLeave

func (element *Element) OnMouseLeave(handler func(Event))

OnMouseLeave はポインターが要素から外れたときのハンドラーを登録する。

func (*Element) OnReset added in v0.8.0

func (element *Element) OnReset(handler func(Event))

OnReset はformのresetハンドラーを登録する。

func (*Element) OnSubmit

func (element *Element) OnSubmit(handler func(Event))

OnSubmit はformの送信操作ハンドラーを登録する。

func (*Element) ParentElement added in v0.14.0

func (element *Element) ParentElement() *Element

ParentElement returns the connected element parent, excluding the Document node.

func (*Element) Prepend added in v0.14.0

func (element *Element) Prepend(children ...*Element) bool

Prepend moves nodes to the beginning of this element's child list.

func (*Element) Remove

func (element *Element) Remove() bool

Remove は要素自身とその子孫をDocumentから削除する。

func (*Element) RemoveChild added in v0.14.0

func (element *Element) RemoveChild(child *Element) bool

RemoveChild detaches a direct child while retaining its Runtime identity.

func (*Element) RemoveClass

func (element *Element) RemoveClass(className string) bool

RemoveClass は指定したクラスを要素から削除する。

func (*Element) RemoveEventListener added in v0.14.0

func (element *Element) RemoveEventListener(eventType string, id events.ListenerID) bool

RemoveEventListener removes one listener token returned by AddEventListenerWithCapture.

func (*Element) ReplaceChildren added in v0.14.0

func (element *Element) ReplaceChildren(children ...*Element) bool

ReplaceChildren atomically replaces this element's children with supplied nodes.

func (*Element) Reset added in v0.8.0

func (element *Element) Reset() bool

Reset restores this form's controls to their default state.

func (*Element) SetAttribute

func (element *Element) SetAttribute(name, value string) bool

SetAttribute は要素の属性値を変更する。

func (*Element) SetClassName added in v0.14.0

func (element *Element) SetClassName(value string) bool

SetClassName updates the class attribute.

func (*Element) SetIDValue added in v0.14.0

func (element *Element) SetIDValue(value string) bool

SetIDValue updates the id attribute.

func (*Element) SetInnerHTML added in v0.14.0

func (element *Element) SetInnerHTML(value string) bool

SetInnerHTML parses and atomically replaces a bounded HTML fragment.

func (*Element) SetText

func (element *Element) SetText(value string)

SetText は要素の内容を指定したテキストへ置き換える。

func (*Element) SetValue

func (element *Element) SetValue(value string) bool

SetValue はテキストinputの現在値を変更する。

func (*Element) TagName added in v0.14.0

func (element *Element) TagName() string

TagName returns the HTML tag name in ASCII uppercase.

func (*Element) Text

func (element *Element) Text() string

Text は要素と子孫のテキストを返す。

func (*Element) ToggleClass added in v0.14.0

func (element *Element) ToggleClass(className string, force *bool) bool

ToggleClass applies optional force and returns the resulting membership.

func (*Element) Value

func (element *Element) Value() string

Value はテキストinputの現在値を返す。

type Event

type Event struct {
	Type             string
	TargetID         string
	TargetNodeID     dommodel.NodeID
	CurrentTargetID  dommodel.NodeID
	Value            string
	X                float32
	Y                float32
	Bubbles          bool
	Cancelable       bool
	DefaultPrevented func() bool
	Phase            events.Phase
	// contains filtered or unexported fields
}

Event はWebGoへ公開するDOMイベント情報である。

func (Event) PreventDefault added in v0.8.0

func (event Event) PreventDefault()

PreventDefault cancels a cancelable browser default action such as form submission.

func (Event) StopPropagation added in v0.14.0

func (event Event) StopPropagation()

StopPropagation prevents this event from reaching later nodes on its path.

Jump to

Keyboard shortcuts

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