(elem *VDomElem, params map[string]any, elemPath []string)
| 296 | } |
| 297 | |
| 298 | func fixupStyleAttributes(elem *VDomElem, params map[string]any, elemPath []string) { |
| 299 | if elem == nil { |
| 300 | return |
| 301 | } |
| 302 | // call fixStyleAttribute, and walk children |
| 303 | elemCountMap := make(map[string]int) |
| 304 | if len(elemPath) == 0 { |
| 305 | elemPath = append(elemPath, elem.Tag) |
| 306 | } |
| 307 | fixStyleAttribute(elem, params, elemPath) |
| 308 | for i := range elem.Children { |
| 309 | child := &elem.Children[i] |
| 310 | elemCountMap[child.Tag]++ |
| 311 | subPath := child.Tag |
| 312 | if elemCountMap[child.Tag] > 1 { |
| 313 | subPath = fmt.Sprintf("%s[%d]", child.Tag, elemCountMap[child.Tag]) |
| 314 | } |
| 315 | elemPath = append(elemPath, subPath) |
| 316 | fixupStyleAttributes(&elem.Children[i], params, elemPath) |
| 317 | elemPath = elemPath[:len(elemPath)-1] |
| 318 | } |
| 319 | } |
| 320 | |
| 321 | func Bind(htmlStr string, params map[string]any) *VDomElem { |
| 322 | htmlStr = processWhitespace(htmlStr) |
no test coverage detected