elements

package
v0.0.0-...-e7b361f Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2018 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package elements provides a data structure for representing HTML elements.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Element

type Element struct {
	Attributes map[string]string
	Children   []*Element
	HasEndTag  bool
	TagName    string
	Text       string
}

func (*Element) AddAttributeValue

func (e *Element) AddAttributeValue(name, value string) *Element

AddAttributeValue appends value to the named attribute’s value, separated by a space. If the attribute does not exist, it is created first. This method is chainable.

func (*Element) Html

func (e *Element) Html() template.HTML

Html is the same as String, but the HTML code can be used in templates.

func (*Element) SetAttributeValue

func (e *Element) SetAttributeValue(name, value string) *Element

SetAttributeValue replaces the value of the named attribute with the provided one. If the attribute does not exist, it is created first. This method is chainable.

func (*Element) String

func (e *Element) String() string

String returns the element as HTML code.

Jump to

Keyboard shortcuts

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