Browse Source

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

Daniel 11 tháng trước cách đây
mục cha
commit
30115901bd
1 tập tin đã thay đổi với 6 bổ sung0 xóa
  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
 			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 {
 		switch node.Type {
 		case ast.NodeList:
 		case ast.NodeList:
 			if 1 > len(node.Children) {
 			if 1 > len(node.Children) {