blob: dfa7b7bd0984ef0a1f6a652d7febc592c2829569 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
import { globals } from '../../utils/window.js'
import { makeInstance } from '../../utils/adopter.js'
export default function parser () {
// Reuse cached element if possible
if (!parser.nodes) {
let svg = makeInstance().size(2, 0)
svg.node.style.cssText = [
'opacity: 0',
'position: absolute',
'left: -100%',
'top: -100%',
'overflow: hidden'
].join(';')
svg.attr('focusable', 'false')
let path = svg.path().node
parser.nodes = { svg, path }
}
if (!parser.nodes.svg.node.parentNode) {
let b = globals.document.body || globals.document.documentElement
parser.nodes.svg.addTo(b)
}
return parser.nodes
}
|