Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ignore elements in display: none parents #333

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

letynsoft
Copy link

This PR adds ability to ignore styles for elements that are contained in hidden elements.
There is a new configuration option 'tryParentsDisplayNone' (boolean, default: false - so it doesn't change the current behavior)

@letynsoft
Copy link
Author

Any news here?

Copy link
Owner

@pocketjoso pocketjoso left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the pull request and the reminder - I'm sorry about the delay, this one slipped under my radar.

Overall this look good.

One small thought:
Perhaps excludeSelectorsWithDisplayNoneParent is a more explicit prop name (albeit very long) - I think it's a bit better aligned with the other two props. Could you update? Can you also update the README at the same time, to document your new prop?

I'm also wondering if this might slow down the execution for pages with large DOM trees. As all nodes have the same top level parents, we're going to repeat checks on a lot of top level parent nodes.. I'm considering if it would be worth caching the response for the parents to avoid this.. but it depends on how much repetition we end up finding, and also the performance of the getComputedStyle call. I've never benchmarked this function call before, but it looks like it should be fast. So in the end, I'm OK starting like this, checking how it performs, and iterating if needed.

So if you can just update the prop name and the readme, then I'll merge this! 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants