Documentation
¶
Index ¶
- Variables
- type AddClasses
- type All
- type Append
- type Clear
- type Delta
- type Document
- type First
- type FirstChild
- type HTML
- type HTMLSource
- type InsertAfter
- type InsertBefore
- type LastChild
- type List
- type NextSibling
- type Parent
- type Prepend
- type PrevSibling
- type Remove
- type Replace
- type ReplaceAttr
- type RmAttr
- type RmClasses
- type RmStyles
- type Root
- type Selector
- type SetAttr
- type SetStyles
Constants ¶
This section is empty.
Variables ¶
var Body = S("body")
Body matches the body element
var Head = S("head")
Head matches the head element
Functions ¶
This section is empty.
Types ¶
type AddClasses ¶
type AddClasses struct {
Classes string
}
AddClasses adds provided classes to matching elements
func (AddClasses) Apply ¶
func (a AddClasses) Apply(d Document)
Apply applies the delta to the provided elements
func (AddClasses) MarshalJSON ¶
func (a AddClasses) MarshalJSON() ([]byte, error)
MarshalJSON marshals the delta to JSON format
type All ¶
All applies given delta to all matching elements
func (All) MarshalJSON ¶
MarshalJSON marshals the delta to JSON format
type Append ¶
type Append struct {
HTMLSource
}
Append appends the provided HTML to matching elements
func (Append) MarshalJSON ¶
MarshalJSON marshals the delta to JSON format
type Clear ¶
type Clear struct{}
Clear empties matching elements
func (Clear) MarshalJSON ¶
MarshalJSON marshals the delta to JSON format
type Document ¶
type Document struct {
// contains filtered or unexported fields
}
func NewDocument ¶
func NewDocument() Document
type First ¶
First applies given delta to the first matching element
func (First) MarshalJSON ¶
MarshalJSON marshals the delta to JSON format
type FirstChild ¶
type FirstChild struct {
Delta
}
FirstChild applies given delta to the first child element
func (FirstChild) Apply ¶
func (fc FirstChild) Apply(d Document)
Apply applies the delta to the provided elements
func (FirstChild) MarshalJSON ¶
func (fc FirstChild) MarshalJSON() ([]byte, error)
MarshalJSON marshals the delta to JSON format
type HTML ¶
type HTML struct {
HTMLSource
}
HTML sets the inner HTML of matching elements
func (HTML) MarshalJSON ¶
MarshalJSON marshals the delta to JSON format
type HTMLSource ¶
HTMLSource represents an HTML source
func HTMLFromString ¶
func HTMLFromString(html string) HTMLSource
HTMLFromString builds an HTMLSource from a string
func HTMLFromStringFunc ¶
func HTMLFromStringFunc(reader func() string) HTMLSource
HTMLFromStringFunc builds an HTMLSource from a string function
type InsertAfter ¶
type InsertAfter struct {
HTMLSource
}
InsertAfter inserts the provided HTML after matching elements
func (InsertAfter) Apply ¶
func (i InsertAfter) Apply(d Document)
Apply applies the delta to the provided elements
func (InsertAfter) MarshalJSON ¶
func (i InsertAfter) MarshalJSON() ([]byte, error)
MarshalJSON marshals the delta to JSON format
type InsertBefore ¶
type InsertBefore struct {
HTMLSource
}
InsertBefore inserts the provided HTML before matching elements
func (InsertBefore) Apply ¶
func (i InsertBefore) Apply(d Document)
Apply applies the delta to the provided elements
func (InsertBefore) MarshalJSON ¶
func (i InsertBefore) MarshalJSON() ([]byte, error)
MarshalJSON marshals the delta to JSON format
type LastChild ¶
type LastChild struct {
Delta
}
LastChild applies given delta to the last child element
func (LastChild) MarshalJSON ¶
MarshalJSON marshals the delta to JSON format
type List ¶
type List struct {
Deltas []Delta
}
List holds a list of deltas
func (List) MarshalJSON ¶
MarshalJSON marshals the delta to JSON format
func (*List) UnmarshalJSON ¶
UnmarshalJSON sets *l to the unmarshalled list of deltas
type NextSibling ¶
type NextSibling struct {
Delta
}
NextSibling applies given delta to the next sibling
func (NextSibling) Apply ¶
func (ns NextSibling) Apply(d Document)
Apply applies the delta to the provided elements
func (NextSibling) MarshalJSON ¶
func (ns NextSibling) MarshalJSON() ([]byte, error)
MarshalJSON marshals the delta to JSON format
type Parent ¶
type Parent struct {
Delta
}
Parent applies given delta to the parent element
func (Parent) MarshalJSON ¶
MarshalJSON marshals the delta to JSON format
type Prepend ¶
type Prepend struct {
HTMLSource
}
Prepend prepends the provided HTML to matching elements
func (Prepend) MarshalJSON ¶
MarshalJSON marshals the delta to JSON format
type PrevSibling ¶
type PrevSibling struct {
Delta
}
PrevSibling applies given delta to the previous sibling
func (PrevSibling) Apply ¶
func (ps PrevSibling) Apply(d Document)
Apply applies the delta to the provided elements
func (PrevSibling) MarshalJSON ¶
func (ps PrevSibling) MarshalJSON() ([]byte, error)
MarshalJSON marshals the delta to JSON format
type Remove ¶
type Remove struct{}
Remove removes matching elements
func (Remove) MarshalJSON ¶
MarshalJSON marshals the delta to JSON format
type Replace ¶
type Replace struct {
HTMLSource
}
Replace replaces matching elements with the provided content
func (Replace) MarshalJSON ¶
MarshalJSON marshals the delta to JSON format
type ReplaceAttr ¶
ReplaceAttr replaces the attributes of matching elements
func (ReplaceAttr) Apply ¶
func (r ReplaceAttr) Apply(d Document)
Apply applies the delta to the provided elements
func (ReplaceAttr) MarshalJSON ¶
func (r ReplaceAttr) MarshalJSON() ([]byte, error)
MarshalJSON marshals the delta to JSON format
type RmAttr ¶
type RmAttr struct {
Attributes []string
}
RmAttr removes provided attributes
func (RmAttr) MarshalJSON ¶
MarshalJSON marshals the delta to JSON format
type RmClasses ¶
type RmClasses struct {
Classes string
}
RmClasses removes provided classes from matching elements
func (RmClasses) MarshalJSON ¶
MarshalJSON marshals the delta to JSON format
type RmStyles ¶
type RmStyles struct {
Styles []string
}
RmStyles removes provided CSS properties from matching elements
func (RmStyles) MarshalJSON ¶
MarshalJSON marshals the delta to JSON format
type Root ¶
type Root struct {
Delta
}
Root applies given delta to the root of the document
func (Root) MarshalJSON ¶
MarshalJSON marshals the delta to JSON format
type SetAttr ¶
SetAttr sets provided attributes to provided values
func (SetAttr) MarshalJSON ¶
MarshalJSON marshals the delta to JSON format
Source Files
¶
- addClasses.go
- all.go
- append.go
- clear.go
- delta.go
- document.go
- first.go
- firstChild.go
- html.go
- htmlReader.go
- insertAfter.go
- insertBefore.go
- labels.go
- lastChild.go
- list.go
- nextSibling.go
- parent.go
- prepend.go
- prevSibling.go
- remove.go
- replace.go
- replaceAttr.go
- rmAttr.go
- rmClasses.go
- rmStyles.go
- root.go
- selector.go
- setAttr.go
- setStyles.go
- util.go