publisher: Collect transition attributes as classes

Fixes #7509
This commit is contained in:
Bjørn Erik Pedersen
2020-07-23 14:18:13 +02:00
parent 45c665d396
commit 00e00da233
2 changed files with 3 additions and 1 deletions

View File

@@ -220,6 +220,7 @@ func isQuote(b byte) bool {
var (
htmlJsonFixer = strings.NewReplacer(", ", "\n")
jsonAttrRe = regexp.MustCompile(`'?(.*?)'?:.*`)
classAttrRe = regexp.MustCompile(`(?i)^class$|transition`)
)
func parseHTMLElement(elStr string) (el htmlElement) {
@@ -242,7 +243,7 @@ func parseHTMLElement(elStr string) (el htmlElement) {
// There should be only one, but one never knows...
el.IDs = append(el.IDs, a.Val)
default:
if strings.EqualFold(a.Key, "class") {
if classAttrRe.MatchString(a.Key) {
el.Classes = append(el.Classes, strings.Fields(a.Val)...)
} else {
key := strings.ToLower(a.Key)