reconcile

package module
v0.0.0-...-1487767 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2017 License: BSD-3-Clause Imports: 7 Imported by: 1

README

Reconcile

Go Report Card

The reconcile package is used for DOM reconcilation in Isomorphic Go web applications.

License

Reconcile is licensed under the BSD License. Read the LICENSE file for more information.

Documentation

Index

Constants

View Source
const (
	ElementNodeType = iota
	CommentNodeType
	TextNodeType
)
View Source
const (
	SetNodeAttributeAction = iota
	RemoveNodeAttributeAction
	RemoveNodeAction
	ReplaceNodeAction
	AppendChildNodeAction
)

Variables

This section is empty.

Functions

func IsEmptyElement

func IsEmptyElement(tag string) bool

Types

type Attribute

type Attribute struct {
	Name  string
	Value string
}

type Changes

type Changes []Reconciler

func (Changes) ApplyChanges

func (c Changes) ApplyChanges(rootElement dom.Element)

type DOMNode

type DOMNode struct {
	Positions
	NodeType      int
	Position      []int
	ParentNode    *DOMNode
	ChildNodes    []*DOMNode
	Contents      []byte
	Name          string
	Value         []byte
	IsSelfClosing bool
	Attributes    []Attribute
	// contains filtered or unexported fields
}

func NewDOMNode

func NewDOMNode(nodeType int) *DOMNode

func (*DOMNode) AttributesMap

func (dn *DOMNode) AttributesMap() map[string]string

func (*DOMNode) Create

func (dn *DOMNode) Create() dom.Node

func (*DOMNode) GetHTMLContents

func (dn *DOMNode) GetHTMLContents(innerContentsOnly bool) []byte

func (*DOMNode) IsEqual

func (dn *DOMNode) IsEqual(b DOMNode) bool

func (*DOMNode) Locate

func (dn *DOMNode) Locate(rootElement dom.Element) dom.Node

func (*DOMNode) String

func (dn *DOMNode) String() string

type ParseTree

type ParseTree struct {
	ChildNodes []*DOMNode
	// contains filtered or unexported fields
}

func NewParseTree

func NewParseTree(src []byte) (*ParseTree, error)

func (*ParseTree) Compare

func (t *ParseTree) Compare(other *ParseTree) (Changes, error)

func (*ParseTree) ReverseFind

func (pt *ParseTree) ReverseFind(m int, n int, b byte) (int, error)

type Positions

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

type ReconcileParams

type ReconcileParams struct {
}

type Reconciler

type Reconciler struct {
	ActionType     int
	ParentNode     *DOMNode
	ChildNode      *DOMNode
	ExistingNode   *DOMNode
	NewNode        *DOMNode
	AttributeName  string
	AttributeValue string
}

func (*Reconciler) AppendChildNode

func (r *Reconciler) AppendChildNode(rootElement dom.Element)

func (*Reconciler) ApplyChange

func (r *Reconciler) ApplyChange(rootElement dom.Element) error

func (*Reconciler) RemoveNode

func (r *Reconciler) RemoveNode(rootElement dom.Element)

func (*Reconciler) RemoveNodeAttribute

func (r *Reconciler) RemoveNodeAttribute(rootElement dom.Element)

func (*Reconciler) ReplaceNode

func (r *Reconciler) ReplaceNode(rootElement dom.Element)

func (*Reconciler) SetNodeAttribute

func (r *Reconciler) SetNodeAttribute(rootElement dom.Element)

Jump to

Keyboard shortcuts

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