com-lihaoyi / scalatags

ScalaTags is a small XML/HTML construction library for Scala.
https://com-lihaoyi.github.io/scalatags/
MIT License
758 stars 117 forks source link

SVG attrs namespaces #111

Closed Starzu closed 8 years ago

lihaoyi commented 8 years ago

Can someone explain to me what this is about? I know nothing about XML and namespaces...

Starzu commented 8 years ago

xlink:href attribute needs a namespace to work with external SVG files. Following example doesn't work without this PR.

ul(
  li(
    a(href := "#")(
      i(svg(xmlns := "http://www.w3.org/2000/svg", 
            xmlnsXlink := "http://www.w3.org/1999/xlink", 
            viewBox := "0 0 20 20")(
        use(xLinkHref := "external_sprite.svg#id")
      )),
      span("text")
    ))).render
lihaoyi commented 8 years ago

Ok, looks good, thanks!