代码拉取完成,页面将自动刷新
import getStyles from './getStyles'
import browser from './browser'
/**
* 用来检测 DOM 元素是否为布局和包含块
* ========================================================================
* @method isContainingBlock
* @since 1.9.0
* @see https://developer.mozilla.org/zh-CN/docs/Web/CSS/Containing_block#identifying_the_containing_block
* @see https://github.com/floating-ui/floating-ui
* @param {HTMLElement} el
* @return {Boolean}
*/
const isContainingBlock = (el) => {
const isFirefox = browser().name === 'Firefox'
const css = getStyles(el)
// 这里并没有详尽列举所有属性,但涵盖了创建包含块的最常见的CSS属性。
return (
css.transform !== 'none' ||
css.perspective !== 'none' ||
// @ts-ignore (TS 4.1 compat)
css.contain === 'paint' ||
['transform', 'perspective'].includes(css.willChange) ||
(isFirefox && css.willChange === 'filter') ||
(isFirefox && (css.filter ? css.filter !== 'none' : false))
)
}
export default isContainingBlock
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。