Documentation
¶
Index ¶
- func DumpDocument(d *Document, indent int, mark string)
- func DumpDocument2(d *Document, indent int, mark string)
- func DumpElement(e *Element, indent int, mark string)
- func IDDuplicateCheck(e *Element) error
- func IDHasBlankCheck(e *Element) error
- func IDMissingCheck(e *Element) error
- func Lf() string
- func Remove(n Node)
- type Attribute
- type Checker
- type Comment
- type Doctype
- type Document
- func (d *Document) Clone() *Document
- func (d *Document) InputText(selector string) []*Element
- func (d *Document) NodeType() html.NodeType
- func (d *Document) Query(selector string) []*Element
- func (d *Document) QuerySelector(selector *Selector) []*Element
- func (d *Document) Render(w io.Writer, checker ...Checker) error
- type Element
- func (e *Element) A(attrs ...Attribute) *Element
- func (e *Element) AppendC(childs ...ElementChild) *Element
- func (e *Element) C(childs ...ElementChild) *Element
- func (e *Element) ClearContents() *Element
- func (e *Element) Clone() *Element
- func (e *Element) GetAttr(key string) string
- func (e *Element) HasAttrValueLower(key, val string) bool
- func (e *Element) HasRoot(root *Element) bool
- func (e *Element) ID() string
- func (e *Element) InputText(selector string) []*Element
- func (e *Element) NodeType() html.NodeType
- func (e *Element) ParentElement() *Element
- func (e *Element) Query(selector string) []*Element
- func (e *Element) QuerySelector(selector *Selector) []*Element
- func (e *Element) RemoveAttr(key string) *Element
- func (e *Element) RemoveClass(class string) *Element
- func (e *Element) Render(w io.Writer, checker ...Checker) error
- func (e *Element) SetA(attr ...Attribute) *Element
- func (e *Element) SetBoolA(key string, v bool) *Element
- func (e *Element) SetClasses(classes ...string) *Element
- type ElementChild
- type Node
- type RawText
- type Selector
- type Text
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DumpDocument ¶
DumpDocument prints the node to the standard output.
func DumpDocument2 ¶
DumpNode2 prints the node to the standard output.
func DumpElement ¶
func IDDuplicateCheck ¶
IDDuplicateCheck checks if the node has duplicate id attributes.
func IDHasBlankCheck ¶
IDHasBlankCheck checks if the node has id with blank.
func IDMissingCheck ¶
IDMissingCheck checks if the node has id without value.
Types ¶
type Attribute ¶
type Comment ¶
func (*Comment) ParentElement ¶
type Document ¶
func (*Document) QuerySelector ¶
QeurySelector return the all nodes that match the selector.
type Element ¶
func ParseHTMLFragment ¶ added in v0.1.1
ParseHTMLFragment parses the HTML fragment with node context from the given reader.
func (*Element) A ¶
A replaces all attributes with the attributes specified in the arguments. If there are duplicate keys, it sets the latter value.
func (*Element) AppendC ¶
func (e *Element) AppendC(childs ...ElementChild) *Element
AppendC appends the given nodes to the children of the node.
func (*Element) C ¶
func (e *Element) C(childs ...ElementChild) *Element
C sets the children of the node to the given nodes.
func (*Element) ClearContents ¶
ClearContents removes all children of the node.
func (*Element) HasAttrValueLower ¶
HasAttrValue returns true if the node has an attribute with the given key and value.
func (*Element) ParentElement ¶
ParentElement returns the parent element of the node.
func (*Element) QuerySelector ¶
func (*Element) RemoveAttr ¶
RemoveAttr removes the attribute with the given key from the node.
func (*Element) RemoveClass ¶
RemoveClass removes the class from the class attribute of the node.
func (*Element) SetA ¶
SetA appends the given attributes to the attributes of the node. If keys are already in the attributes of the node, the values are overwritten.
func (*Element) SetBoolA ¶
SetBoolA appends the given boolean attributes to the attributes of the node or removes them.
func (*Element) SetClasses ¶
SetClasses sets the given class to the class attribute of the node. Class duplication check is performed.
type ElementChild ¶
type ElementChild interface {
ParentElement() *Element
}
type RawText ¶
func (*RawText) ParentElement ¶
type Selector ¶
func SelectorMustParse ¶
SelectorMustParse parses the given CSS selector and panics if it fails.
func SelectorParse ¶
SelectorParse parse the givent CSS selector