     doc = domImplementation.createDocument SVGNS, 'svg'
     svg = doc.documentElement
     svg.setAttribute 'xmlns:xlink', XLINKNS unless Drawing.useHref
-    href = if Drawing.useHref then 'href' else 'xlink:href'
     svg.setAttribute 'version', '1.1'
     #svg.appendChild defs = doc.createElementNS SVGNS, 'defs'
     ## <style> tags for CSS

              when '.png', '.jpg', '.jpeg', '.gif'
                dirname: dirname
                svg: """
                  <image xlink:href="#{encodeURI data}"/>
                """
              when '.svg'
                dirname: path.dirname filename

        continue unless symbol?
        levels[symbol.zIndex] ?= []
        levels[symbol.zIndex].push use = doc.createElementNS SVGNS, 'use'
        use.setAttribute Drawing.hrefAttr(), '#' + symbol.id
        use.setAttribute 'x', x
        use.setAttribute 'y', y
        scaleX = scaleY = 1
