فهرست منبع

:art: Improve parsing tree https://ld246.com/article/1722826829447

Daniel 11 ماه پیش
والد
کامیت
30115901bd
1فایلهای تغییر یافته به همراه6 افزوده شده و 0 حذف شده
  1. 6 0
      kernel/filesys/json_parser.go

+ 6 - 0
kernel/filesys/json_parser.go

@@ -113,6 +113,12 @@ func genTreeByJSON(node *ast.Node, tree *parse.Tree, idMap *map[string]bool, nee
 			node.Children = nil
 		}
 
+		if node.ID != node.IALAttr("id") {
+			//某些情况下会导致 ID 和属性 id 不相同 https://ld246.com/article/1722826829447
+			*needFix = true
+			node.SetIALAttr("id", node.ID)
+		}
+
 		switch node.Type {
 		case ast.NodeList:
 			if 1 > len(node.Children) {