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

:not() selector not working #923

Closed
markreg opened this issue Nov 8, 2015 · 12 comments
Closed

:not() selector not working #923

markreg opened this issue Nov 8, 2015 · 12 comments
Labels

Comments

@markreg
Copy link

markreg commented Nov 8, 2015

:not() selector doesn't function in custom filters list. I'm trying to block a class except for an element with the same class yet with a child div with a specific id.

@Betsy25
Copy link

Betsy25 commented Nov 8, 2015

care to share the specific filter ?

@gorhill gorhill added the invalid label Nov 8, 2015
@gorhill
Copy link
Owner

gorhill commented Nov 8, 2015

https://github.com/gorhill/uBlock/blob/master/CONTRIBUTING.md.

Absolutely no details to substantiate :not-based selector not working. Will reopen when provided and if there is really an issue.

@gorhill gorhill closed this as completed Nov 8, 2015
@markreg
Copy link
Author

markreg commented Nov 9, 2015

It doesn't work on www.investopedia.com##.pg-wrapper:not(.pg-wrapper > #Content).

In order to circumvent ad blockers the site randomly selects which of the 101 .pg-wrapper blanks it selects to add the content related divs to. Plus it randomly selects a few of the other .pg-wrappers for ad windows which is the object of elimination by the dynamic filter.

@gorhill
Copy link
Owner

gorhill commented Nov 9, 2015

It doesn't work on www.investopedia.com##.pg-wrapper:not(.pg-wrapper > #Content).

Not a valid selector. Try in the browser console:

document.querySelector('.pg-wrapper:not(.pg-wrapper > #Content)');
Uncaught DOMException: Failed to execute 'querySelector' on 'Document': '.pg-wrapper:not(.pg-wrapper > #Content)' is not a valid selector.(…)

Valid:

document.querySelector('.pg-wrapper:not(#Content)');

@gorhill
Copy link
Owner

gorhill commented Nov 9, 2015

Maybe it's what you wanted: www.investopedia.com##.pg-wrapper > div:not(#Content) ?

@gorhill
Copy link
Owner

gorhill commented Nov 9, 2015

By the way, if you block inline scripts for the site, the DOM is saner -- no tons of .pg-wrapper elements.

@markreg
Copy link
Author

markreg commented Nov 9, 2015

Ah, I realize my mistake. There's no parent selector yet.

Where would the option to block inline-scripts be exactly? That might take care of the problem too.

@Betsy25
Copy link

Betsy25 commented Nov 9, 2015

Ah, I realize my mistake. There's no parent selector yet.

Where would the option to block inline-scripts be exactly? That might take care of the problem too.

Click the + in front of the "requests blocked" string to enable advanced mode, then :
Screenshot

  • remember to make the setting permanent, by clicking the big lock icon after you blocked inline scripting for that site.

See -> https://github.com/gorhill/uBlock/wiki/Dynamic-filtering:-quick-guide

@lewisje
Copy link

lewisje commented Nov 9, 2015

By the way, when the "parent selector" does appear, it will be known as :has() following the example of jQuery; then you could do something like :not(:has()) I think.

@markreg
Copy link
Author

markreg commented Nov 13, 2015

@Betsy25 When I block inline scripts it stops the inline script for the video player as well. Is there a way to make an exception for the player?

@gorhill
Copy link
Owner

gorhill commented Nov 13, 2015

For whatever reason, with Firefox there is no need to block inline scripts, and videos play fine.

gorhill added a commit that referenced this issue Nov 17, 2015
@lolom
Copy link

lolom commented Dec 16, 2015

Try this.

investopedia.com#IFRAME[id$="google_ads_iframe"]

gorhill added a commit to uBlockOrigin/uAssets that referenced this issue Apr 1, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants