Hacker News new | past | comments | ask | show | jobs | submit login

I'm pretty sure it does according to this wikipage[0]. It may not load _all_ the rules into every page, but it definitely does create a stylesheet and inject it into the page.

[0]: https://github.com/gorhill/uBlock/wiki/Cosmetic-filtering-in...




I can't see where on that page it talks about using style sheets. Last week I searched the µBlock sources for use of the nsIStyleSheetService, which is Gecko's internal interface for adding style sheets without manipulating individual documents, and the only use of that interface is for adding css/legacy-toolbar-button.css, which I assume is for some UI.


So, this might be a case of me assuming too much, but I basically read every instance of _cosmetic filters_ basically as _css styles_. There are a couple CSS files in the git repository that have "filter" in their names[0], but yeah I can't actually be 100% certain at a glance that they're using CSS and not manipulating the DOM with JS.

[0]: https://github.com/gorhill/uBlock/tree/master/src/css


I just did some poking around, and it looks like uBlock does insert a couple of <style> elements into the document. I'm not sure if this is how all style-based blocking is done in uBlock, but since these are document-level style sheets, they are not shared like user agent-level sheets are. (We will in the future be investigating whether we can share more data between common document-level style sheets across multiple documents, though.)




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: