mirror of
https://github.com/tusen-ai/naive-ui.git
synced 2024-12-21 04:50:14 +08:00
13 lines
285 B
JavaScript
13 lines
285 B
JavaScript
/**
|
|
* Returns the parentNode or the host of the element
|
|
* @method
|
|
* @param {Element} element
|
|
* @returns {Element} parent
|
|
*/
|
|
export default function getParentNode (element) {
|
|
if (element.nodeName === 'HTML') {
|
|
return element
|
|
}
|
|
return element.parentNode || element.host
|
|
}
|