MCPcopy Create free account
hub / github.com/ChinaGodMan/UserScripts / myCreateEle

Function myCreateEle

smart-translator-tool/smart-translator-tool.user.js:667–677  ·  view source on GitHub ↗
(option, mountE)

Source from the content-addressed store, hash-verified

665 * 传入配置信息创建元素并返回DOM对象
666*/
667const myCreateEle = (option, mountE) => {
668 let e = document.createElement(option.el || 'div')
669 option.className && e.classList.add(option.className)
670 for (let p in (option.props || {})) {
671 e.setAttribute(p, option.props[p])
672 }
673 e.textContent = option.text || ''
674 e.style.cssText = option.style || ''
675 mountE && mountE.appendChild(e)
676 return e
677}
678
679// 初始生成元素
680const initLoadElement = () => {

Callers 2

initLoadElementFunction · 0.85
showMessageFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected