24 lines
411 B
JavaScript
24 lines
411 B
JavaScript
/**
|
|
* {}
|
|
* @author yutent<yutent.io@gmail.com>
|
|
* @date 2024/03/26 10:07:25
|
|
*/
|
|
|
|
import { $, h, type } from './utils.js'
|
|
import { xmlns, doc, win } from './lib/constants.js'
|
|
|
|
import { Component } from './elem.js'
|
|
|
|
export function createSvg(el) {
|
|
if (el) {
|
|
if (type(el) === 'string') {
|
|
el = $(el)
|
|
}
|
|
h(el, { xmlns })
|
|
} else {
|
|
el = h('svg', { xmlns })
|
|
}
|
|
|
|
return new Component(el)
|
|
}
|