dom

package
v0.0.0-...-76d4100 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Document = &document{
		root: &element{
			nodeType: DOCUMENT_NODE,
		},
	}
)

Functions

func RenderToHTML

func RenderToHTML(w io.Writer, n Element)

func UnWrap

func UnWrap(v interface{}) interface{}

Types

type Doc

type Doc interface {
	JSObject

	CreateElement(tagName string) Element
	CreateTextNode(tagName string) Element
	QuerySelector(id string) Element
}

type Element

type Element interface {
	Node

	GetAttributeNames() []string
	SetAttribute(k string, v interface{})
	GetAttribute(k string) interface{}
	RemoveAttribute(k string)
}

Element https://developer.mozilla.org/en-US/docs/Web/API/Element

type ElementList

type ElementList []Element

func (ElementList) Each

func (list ElementList) Each(fn func(n Element))

type Event

type Event interface {
	JSObject

	Target() EventTarget
	PreventDefault()
	StopImmediatePropagation()
	StopPropagation()
}

Event https://developer.mozilla.org/en-US/docs/Web/API/Event

type EventTarget

type EventTarget interface {
	AddEventListener(eventName string, listener func(event Event), args ...interface{})
	RemoveEventListener(eventName string, listener func(event Event), args ...interface{})
	DispatchEvent(event Event)
}

EventTarget https://developer.mozilla.org/en-US/docs/Web/API/EventTarget

type JSObject

type JSObject interface {
	Get(propName string) interface{}
	Set(propName string, v interface{})
}

type Node

type Node interface {
	JSObject

	EventTarget

	NodeType() NodeType
	NodeName() string

	OwnerDocument() Doc

	ParentNode() Node
	FirstChild() Node
	LastChild() Node
	PreviousSibling() Node
	NextSibling() Node

	TextContent() string
	SetTextContent(textContent string)

	InsertBefore(newChild, referenceNode Node) Node
	RemoveChild(n Node) Node
	AppendChild(n Node)
}

Node https://developer.mozilla.org/en-US/docs/Web/API/Node

type NodeType

type NodeType uint32
const (
	ERROR_NODE NodeType = iota
	ELEMENT_NODE
	ATTRIBUTE_NODE
	TEXT_NODE
	CDATA_SECTION_NODE
	ENTITY_REFERENCE_NODE
	ENTITY_NODE
	PROCESSING_INSTRUCTION_NODE
	COMMENT_NODE
	DOCUMENT_NODE
	DOCUMENT_TYPE_NODE
	DOCUMENT_FRAGMENT_NODE
	NOTATION_NODE
)

https://developer.mozilla.org/en-US/docs/Web/API/Node

Jump to

Keyboard shortcuts

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