vdom

package
v0.0.0-...-895f79d Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2015 License: BSD-2-Clause Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Deletion  ActionType = 0
	Insertion            = 1
	Move                 = 2
	Update               = 3
)

Variables

This section is empty.

Functions

func PerformDiff

func PerformDiff(a, b *Element, dNode DomNode, m TreeModifier)

PerformDiff calculates and performs operations on the DOM tree dNode to transform an old tree representation (b) to the new tree (a)

Types

type Action

type Action struct {
	Type    ActionType
	Index   int
	From    int
	Element DomNode
	Content Node
}

type ActionType

type ActionType int

type Attributes

type Attributes map[string]interface{}

type DomNode

type DomNode interface {
	Child(int) DomNode
}

type Element

type Element struct {
	Tag         string
	Attrs       Attributes
	Children    []Node
	EvtHandlers map[string]EvtHandler
	// contains filtered or unexported fields
}

func NewElement

func NewElement(tag string, attrs Attributes, children []Node) *Element

func (*Element) IsElement

func (t *Element) IsElement() bool

func (*Element) NodeData

func (t *Element) NodeData() string

type Event

type Event interface{}

type EvtHandler

type EvtHandler func(Event)

type Node

type Node interface {
	IsElement() bool
	NodeData() string
}

type TextNode

type TextNode struct {
	Data string
}

func NewTextNode

func NewTextNode(data string) *TextNode

func (*TextNode) IsElement

func (t *TextNode) IsElement() bool

func (*TextNode) NodeData

func (t *TextNode) NodeData() string

type TreeModifier

type TreeModifier interface {
	SetAttr(DomNode, string, interface{})
	RemoveAttr(DomNode, string)
	Do(DomNode, Action)
}

Directories

Path Synopsis
testjs

Jump to

Keyboard shortcuts

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