lewik
05/20/2018, 8:44 AMinline fun Document.createSVG(tagName: String) =
createElementNS("<http://www.w3.org/2000/svg>", tagName)
fun svgG() = document.createSVG("g").unsafeCast<SVGGElement>()
fun svgLine() = document.createSVG("line").unsafeCast<SVGLineElement>()
val g = svgG().apply {
setAttribute("id", id)
}
g.appendChild(svgLine().apply {
setAttribute("x1", "11")
setAttribute("y1", "11")
setAttribute("x2", "3")
setAttribute("y2", "11")
setAttribute("stroke", color)
setAttribute("stroke-width", "2")
setAttribute("stroke-linecap", "round")
})
Is not funny. Can't check attribute names (