mirror of
https://github.com/crazy-max/diun.git
synced 2024-12-22 19:38:28 +00:00
27 lines
519 B
Go
27 lines
519 B
Go
package css
|
|
|
|
import (
|
|
"fmt"
|
|
)
|
|
|
|
type CSSStyleDeclaration struct {
|
|
Property string
|
|
Value string
|
|
Important int
|
|
}
|
|
|
|
func NewCSSStyleDeclaration(property, value string, important int) *CSSStyleDeclaration {
|
|
return &CSSStyleDeclaration{
|
|
Property: property,
|
|
Value: value,
|
|
Important: important,
|
|
}
|
|
}
|
|
|
|
func (decl *CSSStyleDeclaration) Text() string {
|
|
if decl.Important == 1 {
|
|
return fmt.Sprintf("%s: %s !important", decl.Property, decl.Value)
|
|
}
|
|
return fmt.Sprintf("%s: %s", decl.Property, decl.Value)
|
|
}
|