MCPcopy Create free account
hub / github.com/cogentcore/core / getAttr

Function getAttr

htmlcore/handler.go:299–307  ·  view source on GitHub ↗

getAttr gets the given attribute from the given node, returning "" if the attribute is not found.

(n *html.Node, attr string)

Source from the content-addressed store, hash-verified

297// getAttr gets the given attribute from the given node, returning ""
298// if the attribute is not found.
299func getAttr(n *html.Node, attr string) string {
300 res := ""
301 for _, a := range n.Attr {
302 if a.Key == attr {
303 res = a.Val
304 }
305 }
306 return res
307}
308
309// hasAttr returns whether the given node has the given attribute defined.
310func hasAttr(n *html.Node, attr string) bool {

Callers 1

handleElementFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected