scalatags icon indicating copy to clipboard operation
scalatags copied to clipboard

Distinguish SVG attributes that do not overlap with HTML attributes

Open deterdw opened this issue 10 years ago • 0 comments

This simple change creates a SVGOnlyAttrs trait that contains all the attributes that are unique to SVG (in the sense of not being members of the Attrs trait). The existing SVGAttrs trait is then formed by extending this trait with the few overlapping members.

In this way SVGAttrs remains fully backwards-compatible, but we are able to define a single object to hold all attributes, e.g. (where ST is scalatags.Text):

object * extends ST.Cap with ST.Attrs with ST.SvgOnlyAttrs

with is useful when working with SVG embedded in HTML. (One can alias all tags as <, all styles as ^ and all attributes as *, for example.)

deterdw avatar May 30 '15 14:05 deterdw