blob: ccbbc54a394219b6f91dd62034896cd5fa4afe3d (
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
|
import Doc from '../../elements/Doc.js'
import { globals } from '../../utils/window.js'
export default function parser () {
// Reuse cached element if possible
if (!parser.nodes) {
let svg = new Doc().size(2, 0)
svg.node.cssText = [
'opacity: 0',
'position: absolute',
'left: -100%',
'top: -100%',
'overflow: hidden'
].join(';')
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
}
|