mirror of
https://github.com/twbs/bootstrap.git
synced 2025-08-07 22:26:57 +02:00
Refactor isVisible
helper, fixing false positives from deep nesting or alternate means (#33960)
This commit is contained in:
@@ -159,20 +159,11 @@ const typeCheckConfig = (componentName, config, configTypes) => {
|
||||
}
|
||||
|
||||
const isVisible = element => {
|
||||
if (!element) {
|
||||
if (!isElement(element) || element.getClientRects().length === 0) {
|
||||
return false
|
||||
}
|
||||
|
||||
if (element.style && element.parentNode && element.parentNode.style) {
|
||||
const elementStyle = getComputedStyle(element)
|
||||
const parentNodeStyle = getComputedStyle(element.parentNode)
|
||||
|
||||
return elementStyle.display !== 'none' &&
|
||||
parentNodeStyle.display !== 'none' &&
|
||||
elementStyle.visibility !== 'hidden'
|
||||
}
|
||||
|
||||
return false
|
||||
return getComputedStyle(element).getPropertyValue('visibility') === 'visible'
|
||||
}
|
||||
|
||||
const isDisabled = element => {
|
||||
|
Reference in New Issue
Block a user