mirror of
https://github.com/tusen-ai/naive-ui.git
synced 2024-12-27 05:00:48 +08:00
13 lines
305 B
JavaScript
13 lines
305 B
JavaScript
/**
|
|
* Returns the parentNode or the host of the element until document
|
|
* @method
|
|
* @param {Element} element
|
|
* @returns {Element} parent
|
|
*/
|
|
export default function getParentNode (element) {
|
|
if (element.nodeName === '#document') {
|
|
return element
|
|
}
|
|
return element.parentNode || element.host
|
|
}
|