mirror of
https://github.com/NanmiCoder/cc-haha
synced 2026-07-16 13:03:31 +08:00
9 lines
280 B
TypeScript
9 lines
280 B
TypeScript
export function climb(el: Element): Element | null {
|
|
const p = el.parentElement
|
|
if (!p || p.tagName.toLowerCase() === 'body' || p.tagName.toLowerCase() === 'html') return null
|
|
return p
|
|
}
|
|
export function descend(el: Element): Element | null {
|
|
return el.firstElementChild
|
|
}
|