blob: 1ccd9090a1a936eb048cb2e98bef5db20cadea7a [file] [log] [blame] [edit]
package inliner
import "github.com/chris-ramon/douceur/css"
// StyleDeclaration represents a style declaration
type StyleDeclaration struct {
StyleRule *StyleRule
Declaration *css.Declaration
}
// NewStyleDeclaration instanciates a new StyleDeclaration
func NewStyleDeclaration(styleRule *StyleRule, declaration *css.Declaration) *StyleDeclaration {
return &StyleDeclaration{
StyleRule: styleRule,
Declaration: declaration,
}
}
// Specificity computes style declaration specificity
func (styleDecl *StyleDeclaration) Specificity() int {
if styleDecl.Declaration.Important {
return 10000
}
return styleDecl.StyleRule.Specificity
}