Skip to content

Commit d06747a

Browse files
committed
Keep hidden elements if any descendant enables visibility
1 parent 9d67586 commit d06747a

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

plugins/removeHiddenElems.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,9 @@ exports.fn = function (item, params) {
5252
// https://www.w3schools.com/cssref/pr_class_visibility.asp
5353
if (
5454
params.isHidden &&
55-
item.hasAttr('visibility', 'hidden')
55+
item.hasAttr('visibility', 'hidden') &&
56+
// keep if any descendant enables visibility
57+
item.querySelector('[visibility=visible]') == null
5658
) return false;
5759

5860
// display="none"

test/plugins/removeHiddenElems.12.svg

Lines changed: 20 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)