blob: 4f92657ffa42cf95df61e62c707a385d9a8d2110 (
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
30
|
import { globals } from '../../utils/window.js'
import { makeInstance } from '../../utils/adopter.js'
export default function parser () {
// Reuse cached element if possible
if (!parser.nodes) {
const svg = makeInstance().size(2, 0)
svg.node.style.cssText = [
'opacity: 0',
'position: absolute',
'left: -100%',
'top: -100%',
'overflow: hidden'
].join(';')
svg.attr('focusable', 'false')
svg.attr('aria-hidden', 'true')
const path = svg.path().node
parser.nodes = { svg, path }
}
if (!parser.nodes.svg.node.parentNode) {
const b = globals.document.body || globals.document.documentElement
parser.nodes.svg.addTo(b)
}
return parser.nodes
}
|