blob: 228e93f1501261b67ae5f160700dd819a5ccd4f4 (
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
31
32
33
34
|
import Dom from './Dom.js'
import { globals } from '../utils/window.js'
import { register } from '../utils/adopter.js'
import Svg from './Svg.js'
class Fragment extends Dom {
constructor (node = globals.document.createDocumentFragment()) {
super(node)
}
// Import / Export raw svg
svg (svgOrFn, outerHTML) {
if (svgOrFn === false) {
outerHTML = false
svgOrFn = null
}
// act as getter if no svg string is given
if (svgOrFn == null || typeof svgOrFn === 'function') {
const wrapper = new Svg()
wrapper.add(this.node.cloneNode(true))
return wrapper.svg(svgOrFn, false)
}
// Act as setter if we got a string
return super.svg(svgOrFn, false)
}
}
register(Fragment, 'Fragment')
export default Fragment
|