AdguardTeam / ExtendedCss

A TypeScript library for non-standard element selecting — :contains(), :matches-css(), etc., and applying CSS styles with extended properties.
GNU General Public License v3.0
61 stars 9 forks source link

Use p-limit npm package to exec selector simultaneously #181

Open piquark6046 opened 5 months ago

piquark6046 commented 5 months ago

If a selector without non-standard CSS properties matches huge amount of elements, large amount of CPU and memory resources are required to check the non-standard CSS properties. It means that checking process with non-standard CSS properties will take some times.

However, using p-limit npm package can execute a selector with non-standard CSS properties simultaneously according to navigator.hardwareConcurrency [^1]. It reduces the taking time to execute a selector to select the elements.

[^1]: Please note that some privacy protection features mock the property with a number lower than the actual number. (e.g., Brave web browser's fingerprinting blocking and Firefox's privacy.resistFingerprinting in about:config)