mirror of
https://github.com/transloadit/uppy.git
synced 2026-07-29 21:13:21 +00:00
19 lines
362 B
JavaScript
19 lines
362 B
JavaScript
import isDOMElement from './isDOMElement.js'
|
|
|
|
/**
|
|
* Find a DOM element.
|
|
*
|
|
* @param {Node|string} element
|
|
* @returns {Node|null}
|
|
*/
|
|
export default function findDOMElement (element, context = document) {
|
|
if (typeof element === 'string') {
|
|
return context.querySelector(element)
|
|
}
|
|
|
|
if (isDOMElement(element)) {
|
|
return element
|
|
}
|
|
|
|
return null
|
|
}
|