diff --git a/css/rule.go b/css/rule.go index b5a44b5..53b47ad 100644 --- a/css/rule.go +++ b/css/rule.go @@ -20,7 +20,7 @@ const ( // At Rules than have Rules inside their block instead of Declarations var atRulesWithRulesBlock = []string{ - "@document", "@font-feature-values", "@keyframes", "@media", "@supports", + "@document", "@font-feature-values", "@keyframes", "@media", "@supports", "@-webkit-keyframes", "@-moz-keyframes", } // Rule represents a parsed CSS rule diff --git a/parser/parser.go b/parser/parser.go index 6c4917c..b4012f8 100644 --- a/parser/parser.go +++ b/parser/parser.go @@ -8,7 +8,7 @@ import ( "github.com/gorilla/css/scanner" - "github.com/aymerick/douceur/css" + "github.com/redforks/douceur/css" ) const ( diff --git a/parser/parser_test.go b/parser/parser_test.go index adc0396..8c47ad4 100644 --- a/parser/parser_test.go +++ b/parser/parser_test.go @@ -5,7 +5,7 @@ import ( "strings" "testing" - "github.com/aymerick/douceur/css" + "github.com/redforks/douceur/css" ) func MustParse(t *testing.T, txt string, nbRules int) *css.Stylesheet { @@ -445,6 +445,68 @@ func TestAtRuleKeyframes(t *testing.T) { MustEqualCSS(t, stylesheet.String(), expectedOutput) } +func TestAtRuleWebkitKeyframes(t *testing.T) { + input := `@-webkit-keyframes identifier { + 0% { top: 0; left: 0; } + 100% { top: 100px; left: 100%; } +}` + expectedRule := &css.Rule{ + Kind: css.AtRule, + Name: "@-webkit-keyframes", + Prelude: "identifier", + Rules: []*css.Rule{ + { + Kind: css.QualifiedRule, + Prelude: "0%", + Selectors: []string{"0%"}, + Declarations: []*css.Declaration{ + { + Property: "top", + Value: "0", + }, + { + Property: "left", + Value: "0", + }, + }, + }, + { + Kind: css.QualifiedRule, + Prelude: "100%", + Selectors: []string{"100%"}, + Declarations: []*css.Declaration{ + { + Property: "top", + Value: "100px", + }, + { + Property: "left", + Value: "100%", + }, + }, + }, + }, + } + + expectedOutput := `@-webkit-keyframes identifier { + 0% { + top: 0; + left: 0; + } + 100% { + top: 100px; + left: 100%; + } +}` + + stylesheet := MustParse(t, input, 1) + rule := stylesheet.Rules[0] + + MustEqualRule(t, rule, expectedRule) + + MustEqualCSS(t, stylesheet.String(), expectedOutput) +} + func TestAtRuleMedia(t *testing.T) { input := `@media screen, print { body { line-height: 1.2 }