MCPcopy
hub / github.com/tdewolff/canvas / parseStyleAttribute

Method parseStyleAttribute

svg.go:837–853  ·  view source on GitHub ↗
(style string)

Source from the content-addressed store, hash-verified

835}
836
837func (svg *svgParser) parseStyleAttribute(style string) []cssProperty {
838 props := []cssProperty{}
839 p := css.NewParser(parse.NewInput(bytes.NewBufferString(style)), true)
840 for {
841 gt, _, data := p.Next()
842 if gt == css.ErrorGrammar {
843 break
844 } else if gt == css.DeclarationGrammar {
845 val := strings.Builder{}
846 for _, t := range p.Values() {
847 val.Write(t.Data)
848 }
849 props = append(props, cssProperty{string(data), val.String()})
850 }
851 }
852 return props
853}
854
855func (svg *svgParser) setStyling(props []cssProperty) {
856 // apply CSS from <style>

Callers 1

setStylingMethod · 0.95

Calls 4

WriteMethod · 0.80
NextMethod · 0.45
ValuesMethod · 0.45
StringMethod · 0.45

Tested by

no test coverage detected