MCPcopy Index your code
hub / github.com/wavetermdev/waveterm / fixupStyleAttributes

Function fixupStyleAttributes

pkg/vdom/vdom_html.go:298–319  ·  view source on GitHub ↗
(elem *VDomElem, params map[string]any, elemPath []string)

Source from the content-addressed store, hash-verified

296}
297
298func 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
321func Bind(htmlStr string, params map[string]any) *VDomElem {
322 htmlStr = processWhitespace(htmlStr)

Callers 1

BindFunction · 0.85

Calls 1

fixStyleAttributeFunction · 0.85

Tested by

no test coverage detected