-
Notifications
You must be signed in to change notification settings - Fork 22
Make ":after" and ":before" selectable in the element picker #233
Comments
It's because querying for pseudo elements returns no elements. This will require special handling / injecting styles blindly. |
You really should use DevTools if you need to create a filter that's not trivial. The problem with implementing pseudo elements selection in the Element Picker is that I don't see a way to calculate the bounding rectangle of the element. I know DevTools is able to do that, but I think they are using internal APIs. |
DevTools can totally select pseudo elements. Can someone investigate what black magic they are using? |
Your example does not work in Firefox, but this can be used https://makandracards.com/makandra/58174-how-to-access-before-after-pseudo-element-styles-with-javascript
Needs more magic for x/y |
Was this reported to upstream issues tracker before? |
|
If by "cost" he means computation costs, then I disagree. You don't need to scan the pseudo elements of everything, only those that match the selector before However, implementing this is by no mean easy, and it'll cost a lot of time. Since I pretty much never use the element picker, I don't really feel like implementing this. Personally I just use DevTools, which can select pseudo elements without any hassle. |
As of uBlock Origin 1.18.17b11 I have found through random filter creation that the element picker will actually create and preview pseudo-element filters when you combine multiple class selections in the element picker filter box with at least one non pseudo-element and apply a e.g. combination filter From what I have tested for, this seems to work when there is a combined filter for multiple classes separated by commas on the same line with a Test Link Use element picker and add the following filter to filter line Pseudo-element filter is able to be created from Element Picker and you also get the benefit of previewing the filter before adding to 'My Filters'. Additionally, the order of when the pseudo-element is used in the element picker filter box also doesn't seem to matter so Posting this here as an FYI since gorhill#2515 & gorhill#2825 are closed for commenting, maybe someone will find this post via those links and find this helpful. |
Describe the issue (Required)
When writing an entry that includes :before or :after into the element picker's text box, the element picker is unable to recognise the element and will refuse to make the Create button clickable.
Screenshots (Required)
Screenshot of console (Required, press
F12
to open the console)Reproduction Steps (Optional if trivial)
https://www.aftenbladet.no/lokalt/i/zLBMXb/Var-obs-nar-du-parkerer-pa-disse-stedene
as the example.##.overlay-wrap:before
aftenbladet.no##.overlay-wrap:before
into My Filters.Anything else you believe to be useful (Optional)
As for my use, :after and :before entries are particularly important when writing entries for Norwegian newssites, most of whom uses a subscription system, as well as article previews that are a few lines long and which gradually become more blurry by the end of the preview.
I would be surprised if this issue doesn't apply to uBlock Origin as well, but as I am chiefly using Nano Adblocker on my main browser, I decided to try to report it here first.
Environment (Required)
Your filter lists (Required)
Your custom filters (Required if you have any)
https://raw.githubusercontent.com/DandelionSprout/adfilt/master/a.txt
The text was updated successfully, but these errors were encountered: