12 lines
248 B
JavaScript
12 lines
248 B
JavaScript
const cacheNode = {}
|
|
|
|
export function getCacheNode (el) {
|
|
if (typeof el === 'string') {
|
|
const selector = el
|
|
|
|
el = cacheNode[el] || document.querySelector(el)
|
|
if (!el) console.error('Cannot find element:', selector)
|
|
}
|
|
|
|
return el
|
|
}
|