Documentation ¶
Index ¶
- func Inherited(prop string) bool
- type AttributeSelector
- type BySpecificity
- type Color
- type Current
- type Declaration
- type EmLength
- type Identifier
- type List
- type LoadingStylesheet
- type LoadingStylesheets
- type Not
- type Number
- type NumberedPC
- type Origin
- type Percentage
- type PseudoClass
- type PxLength
- type QuotedString
- type Rule
- type Selector
- type SimplePC
- type SimpleSelector
- type Specificity
- type Stylesheet
- type Value
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AttributeSelector ¶
An AttributeSelector is the square-bracket-thing.
func (*AttributeSelector) String ¶
func (attr *AttributeSelector) String() string
type BySpecificity ¶
type BySpecificity []Selector
BySpecificity impelments sort.Interface
func (BySpecificity) Len ¶
func (s BySpecificity) Len() int
func (BySpecificity) Less ¶
func (s BySpecificity) Less(i, j int) bool
func (BySpecificity) Swap ¶
func (s BySpecificity) Swap(i, j int)
type Color ¶
type Color struct{ R, G, B, A uint8 }
A Color is any color, in RGBA format. It doesn't matter in which way the color was specified. The value 'transparent' is also a Color.
type Current ¶
type Current string
Current tells the user agent to look up another property. A typical use case is Current("color") as an initial value.
type Declaration ¶
A Declaration is a name-value pair, e.g. "position: fixed"
func ParseDeclarations ¶
func ParseDeclarations(r io.Reader) ([]Declaration, error)
ParseDeclarations parses a CSS declaration block, expands shorthand rules,
func (*Declaration) String ¶
func (decl *Declaration) String() string
type Identifier ¶
type Identifier string
An Identifier is any non-numeric, non-quoted word on the right side in a CSS declaration.
func (Identifier) String ¶
func (i Identifier) String() string
type LoadingStylesheet ¶
type LoadingStylesheet struct {
// contains filtered or unexported fields
}
func LoadStylesheet ¶
func LoadStylesheet(r io.Reader) LoadingStylesheet
func (*LoadingStylesheet) Get ¶
func (l *LoadingStylesheet) Get() *Stylesheet
type LoadingStylesheets ¶
type LoadingStylesheets []LoadingStylesheet
func (*LoadingStylesheets) Add ¶
func (l *LoadingStylesheets) Add(r io.Reader)
func (*LoadingStylesheets) Collect ¶
func (l *LoadingStylesheets) Collect() *Stylesheet
type Not ¶
type Not struct {
Sel *SimpleSelector
}
Not is the :not(...) pseudo class This type implements the PseudoClass interface.
type NumberedPC ¶
A NumberedPC is a pseudo class with an index, like :nth-child(an+b). This type implements the PseudoClass interface.
type Percentage ¶
type Percentage float64
A Percentage is any numeric value that was followed by a % sign.
func (Percentage) String ¶
func (p Percentage) String() string
type PseudoClass ¶
type PseudoClass interface {
// contains filtered or unexported methods
}
A PseudoClass is either a SimplePC or Not or a NumberedPC.
type QuotedString ¶
type QuotedString string
A QuotedString is a value like in font-face: "Times New Roman".
func (QuotedString) String ¶
func (s QuotedString) String() string
type Rule ¶
type Rule struct { Selectors []Selector Declarations []Declaration }
A Rule is a CSS rule.
type Selector ¶
type Selector struct { Final SimpleSelector Combinator rune Condition *Selector }
A Selector is a full CSS selector
func (*Selector) Specificity ¶
func (sel *Selector) Specificity() Specificity
Specificity calculates the selector's specificity.
type SimplePC ¶
type SimplePC string
A SimplePC is a pseudo class without an argument, e.g. :hover, :link. This type implements the PseudoClass interface.
type SimpleSelector ¶
type SimpleSelector struct { Tag string // empty for none ID string // ditto Class []string AttrSel []AttributeSelector PseudoClasses []PseudoClass PseudoElement string // non-empty if this is a pseudo-element; only valid for final (rightmost) selector }
A SimpleSelector is a selector without any combinators, e.g. div.foo#bar:hover
func (*SimpleSelector) Specificity ¶
func (sel *SimpleSelector) Specificity() Specificity
Specificity returns the specificity of the selector.
func (*SimpleSelector) String ¶
func (sel *SimpleSelector) String() string
type Specificity ¶
type Specificity struct{ A, B, C, D int }
Specificity as in http://www.w3.org/TR/CSS2/cascade.html#specificity
func (Specificity) Add ¶
func (a Specificity) Add(b Specificity) Specificity
Add adds two specificities.
func (Specificity) LessThan ¶
func (a Specificity) LessThan(b Specificity) bool
LessThan checks if a < b.
type Stylesheet ¶
A Stylesheet is a collection of rules.
func Parse ¶
func Parse(r io.Reader) (*Stylesheet, error)
Parse parses a complete CSS stylesheet. TODO either check for errors or don't return an error; probably not returning an error is better, since CSS simly ignores anything it doesn't understand.
func (*Stylesheet) String ¶
func (ss *Stylesheet) String() string