Skip to content

Commit

Permalink
Keep hidden elements if any descendant enables visibility
Browse files Browse the repository at this point in the history
  • Loading branch information
TrySound committed Feb 24, 2021
1 parent 9d67586 commit d06747a
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
4 changes: 3 additions & 1 deletion plugins/removeHiddenElems.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ exports.fn = function (item, params) {
// https://www.w3schools.com/cssref/pr_class_visibility.asp
if (
params.isHidden &&
item.hasAttr('visibility', 'hidden')
item.hasAttr('visibility', 'hidden') &&
// keep if any descendant enables visibility
item.querySelector('[visibility=visible]') == null
) return false;

// display="none"
Expand Down
20 changes: 20 additions & 0 deletions test/plugins/removeHiddenElems.12.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit d06747a

Please sign in to comment.