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

HTML Filter with ^ has no effect #3562

Closed
theseer opened this issue Mar 1, 2018 · 5 comments
Closed

HTML Filter with ^ has no effect #3562

theseer opened this issue Mar 1, 2018 · 5 comments

Comments

@theseer
Copy link

theseer commented Mar 1, 2018

Based on the documentation for html-filters, the only syntactical difference to the cosmetic filters seems to be the ^-prefix.

It is my understanding that a match would remove the element specified from the html before the stream hits the rendering engine.

Yet, when adding a such a filter it does not seem to have any effect?
When omitting the ^-prefix, the element gets hidden as expected, so I assume the selector itself to be correct.

I'm not sure whether I'm doing something wrong and it's behaving as expected or this is a bug.

I tried this with my company website: https://thephp.cc/welcome with the following simple filter to hide respectively remove the Home link from the top menu bar.

The cosmetic filter thephp.cc##a:has-text(Home) works as expected, the a element gets hidden but remains in the dom. The html filter thephp.cc##^a:has-text(Home) though has no effect.

  • OS/version: Fedora 27
  • Browser/version: Firefox 58.0.2 (64-bit), Fedora build
  • uBlock Origin version: v1.15.11b5, also tried 1.15.10 before
@gorhill
Copy link
Owner

gorhill commented Mar 1, 2018

Thanks for reporting.

There is an error in the regex I use to detect content type -- the error occurs when the document type is application/xhtml+xml.

However, once I fixed the error, this uncovered another issue with the HTML filtering code which occurrs as a result of parsing the XHTML document served at https://thephp.cc/welcome as a HTML one. So this needs fixing too.

@gorhill gorhill closed this as completed in 8cf8706 Mar 1, 2018
@theseer
Copy link
Author

theseer commented Mar 1, 2018

That's what I call a quick fix. Thanks so much!

And also thanks for pointing out wrong mime type for our company website. Guess I have some fixing to do as well.

@gorhill
Copy link
Owner

gorhill commented Mar 1, 2018

Your mime type is fine, it's uBO which was not using it to pass to DOMParser, I was passing a hard coded text/html.

@ghost
Copy link

ghost commented Mar 5, 2018

@gorhill problem is not fixed on youtube.com and duckduckgo.com

@gorhill
Copy link
Owner

gorhill commented Mar 5, 2018

I am not aware of any issue with HTML filtering on youtube.com and duckduckgo.com. If you uncovered an issue with uBO, open a new issue with all the needed details for others to reproduce as required. Also, be sure to read the documentation before so that you understand what exactly is HTML filtering.

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

2 participants