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

question: css selector matching based on content (RegEx) #1091

Closed
atomGit opened this issue Oct 29, 2020 · 8 comments
Closed

question: css selector matching based on content (RegEx) #1091

atomGit opened this issue Oct 29, 2020 · 8 comments

Comments

@atomGit
Copy link

atomGit commented Oct 29, 2020

the goal is to force default font settings globally without setting browser.display.use_document_fonts to '0' (fingerprinting issues when combined with RFP), so i'm trying to this with css and that's not working spectacularly well, so is something like this possible? ...

*:contains("[a-zA-Z]") {
    font-family: sans-serif !important;
    font-size: 1em !important;
}
@eight04
Copy link
Collaborator

eight04 commented Oct 30, 2020

Nope. Next time you should probably post this question on Stackoverflow since this has nothing to do with stylus extension.

Also, I don't understand why not just use * to match all elements.

@tophf
Copy link
Member

tophf commented Oct 30, 2020

Nope, CSS doesn't have :contains() selector. It's a jQuery thing which means it's a JS thing, not CSS.

@tophf tophf closed this as completed Oct 30, 2020
@midenok
Copy link

midenok commented Dec 10, 2023

@tophf If it doesn't work with CSS Stylus should support XPath/JQuery, because it is very important for many websites.

@tophf
Copy link
Member

tophf commented Dec 10, 2023

No, it shouldn't. Our extension injects pure CSS to ensure high performance, which is impossible to do with jQuery/xpath as we would have to observe the entire DOM using MutationObserver and apply each selector via JS to retain the cascade order, not just the non-standard selectors.

@midenok
Copy link

midenok commented Dec 10, 2023

That can be enabled on per-site basis.

@tophf
Copy link
Member

tophf commented Dec 10, 2023

That's not what our extension is about. We won't support technologies that add huge overhead to pages. There are other extensions that support JS injection so try suggesting the idea to their authors.

@midenok
Copy link

midenok commented Dec 10, 2023

Currently only CSS is almost unusable as most advanced sites use dynamic obfuscation. You should reconsider better usability for your plugin. Maybe merging with other JS injection plugins. But of course this is big deal, so I'm not insisting.

@tophf
Copy link
Member

tophf commented Dec 10, 2023

No, you'll have to make an extension or a userscript. Our eventual goal is to remove all JS content scripts and switch to a pure CSS method of injection when it's developed by browser, similarly to chrome.userScripts API.

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

No branches or pull requests

4 participants