fix the bug in handling the replaceNodeUse attribute
This commit is contained in:
parent
31cf9061e8
commit
9bae50b500
2 changed files with 9 additions and 2 deletions
|
|
@ -135,8 +135,8 @@ func (data Data) replaceNodeUse(re *regexp.Regexp, node *html.Node) bool {
|
|||
|
||||
case html.ElementNode:
|
||||
for i := range node.Attr {
|
||||
// Keepwords
|
||||
if strings.HasPrefix(node.Attr[i].Key, "s:") || node.Attr[i].Key == "is" {
|
||||
|
||||
if (strings.HasPrefix(node.Attr[i].Key, "s:") || node.Attr[i].Key == "is") && !allowUsePropAttrs[node.Attr[i].Key] {
|
||||
continue
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -65,6 +65,13 @@ var keepWords = map[string]bool{
|
|||
"s:bind": true,
|
||||
}
|
||||
|
||||
var allowUsePropAttrs = map[string]bool{
|
||||
"s:if": true,
|
||||
"s:elif": true,
|
||||
"s:for": true,
|
||||
"s:click": true,
|
||||
}
|
||||
|
||||
var keepAttrs = map[string]bool{
|
||||
"s:ns": true,
|
||||
"s:cn": true,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue