3 Star 54 Fork 14

Yaohaixiao / dom.js

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
getOffsetParent.js 621 Bytes
一键复制 编辑 原始数据 按行查看 历史
Yaohaixiao 提交于 2023-10-12 16:04 . chore: 调整单测代码
import isElement from './isElement'
/**
* 返回一个指向最近的(指包含层级上的最近)包含该元素的定位元素。
* 当元素的 style.display 设置为 "none" 时,offsetParent 返回 null。
* ========================================================================
* @method getOffsetParent
* @see https://developer.mozilla.org/zh-CN/docs/Web/API/HTMLElement/offsetParent
* @param {HTMLElement} el
* @return {HTMLElement|null}
*/
const getOffsetParent = (el) => {
if (!isElement(el)) {
return null
}
return el.offsetParent
}
export default getOffsetParent
JavaScript
1
https://gitee.com/yaohaixiao/dom.js.git
git@gitee.com:yaohaixiao/dom.js.git
yaohaixiao
dom.js
dom.js
main

搜索帮助