{"action":"published","release":{"url":"https://api.github.com/repos/gorhill/uBlock/releases/3640765","assets_url":"https://api.github.com/repos/gorhill/uBlock/releases/3640765/assets","upload_url":"https://uploads.github.com/repos/gorhill/uBlock/releases/3640765/assets{?name,label}","html_url":"https://github.com/gorhill/uBlock/releases/tag/1.7.7b12","id":3640765,"tag_name":"1.7.7b12","target_commitish":"master","name":"1.7.7b12","draft":false,"author":{"login":"gorhill","id":585534,"avatar_url":"https://avatars.githubusercontent.com/u/585534?v=3","gravatar_id":"","url":"https://api.github.com/users/gorhill","html_url":"https://github.com/gorhill","followers_url":"https://api.github.com/users/gorhill/followers","following_url":"https://api.github.com/users/gorhill/following{/other_user}","gists_url":"https://api.github.com/users/gorhill/gists{/gist_id}","starred_url":"https://api.github.com/users/gorhill/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gorhill/subscriptions","organizations_url":"https://api.github.com/users/gorhill/orgs","repos_url":"https://api.github.com/users/gorhill/repos","events_url":"https://api.github.com/users/gorhill/events{/privacy}","received_events_url":"https://api.github.com/users/gorhill/received_events","type":"User","site_admin":false},"prerelease":true,"created_at":"2016-07-12T17:29:30Z","published_at":"2016-07-12T17:33:13Z","assets":[],"tarball_url":"https://api.github.com/repos/gorhill/uBlock/tarball/1.7.7b12","zipball_url":"https://api.github.com/repos/gorhill/uBlock/zipball/1.7.7b12","body":"#### New:\r\n\r\nNew cosmetic filtering operators:\r\n\r\n##### `:has()`\r\n\r\nThis is a planned CSS4 operator, but no browser supports it yet. I decided to go ahead and implement it so that it can already be used. See [The Relational Pseudo-class: `:has()`](https://drafts.csswg.org/selectors/#relational) in the Selector Level 4/Editor's Draft.\r\n\r\nuBO's implementation is simplified so as to ensure performance. The `:has` operator **must** be used with at least one hostname (it must be _specific_), and must be of the form (example):\r\n\r\n    yandex.ru##.serp-item:has(.label_color_yellow)\r\n\r\nIn this example, `yandex.ru` is the hostname. The part preceding `:has(...)` -- `.serp-item` above -- is the DOM node which will be targeted (i.e. hidden by uBO), and must be a valid CSS expression. The part inside the `:has` parentheses -- `.label_color_yellow` above -- must be a valid CSS expression, and is the condition that must be fulfilled -- i.e. in the above example, nodes which have a class `serp-item` will be hidden if and only if they have a descendant with class `label_color_yellow`.\r\n\r\n***\r\n\r\n##### `:xpath()`\r\n\r\nThis new cosmetic filter operator is to support and leverage the power of [XPaths](https://en.wikipedia.org/wiki/XPath). The `:xpath()` operator must always be used in a _specific_ cosmetic filter, i.e. they must apply to at least one hostname or entity. An example of its use (to solve a real reported case) for [this web page](http://forum.pcastuces.com/envahi_par_des_popup-f25s77301.htm):\r\n\r\n    forum.pcastuces.com##:xpath(/html/body/table//tr[@class=\"formsubtitle2\"][.//text()=\"Publicité\"])\r\n    forum.pcastuces.com##:xpath(/html/body/table//tr[@class=\"formsubtitle2\"][.//text()=\"Publicité\"]/following-sibling::tr[1])\r\n\r\nNotice how these xpath-based cosmetic filters allows to uniquely solve the issue here, by filtering based on the _text content_ of the child nodes in the DOM. This is not possible with standard ABP-compatible filtering syntax. (Use the per-site switch to toggle cosmetic filtering on/off to more easily see the effect of these filters on the page).\r\n\r\n***\r\n\r\n##### `:style()`\r\n\r\nRelated issue: [Support cosmetic filters with explicit style properties](https://github.com/gorhill/uBlock/issues/781).\r\n\r\nBy default, the implicit purpose of cosmetic filters is to hide unwanted DOM elements. However sometimes it may be useful to re-style a specific DOM element on a page rather than hide it. Here is an [recent example](https://github.com/uBlockOrigin/uAssets/issues/71#issuecomment-229503444) of such cases. This is the purpose of the new `:style`-based selector. The syntax is as follow:\r\n\r\n    example.com##h1:style(background-color: blue !important)\r\n\r\nSo mainly it's exactly the same syntax of plain cosmetic filters, except that the `:style(...)` suffix is appended at the end. The content in the parentheses must be one or more [CSS property declarations](https://developer.mozilla.org/en-US/docs/Web/CSS/Syntax) (separated by the standard `;`).\r\n\r\nAs with the other new cosmetic filtering selectors, the `:style` can be used only for _specific_ cosmetic filters, i.e. there must be a hostname of entity specified for the filter.\r\n\r\nAdguard [already support such feature](https://adguard.com/en/filterrules.html#cssInjection), although using a different syntax. However uBO is able to transparently convert and make use of the Adguard's \"CSS injection rules\" if ever you use an Adguard filter list in uBO (well, this essentially means you can use Adguard's syntax in uBO if you prefer).\r\n\r\nFor example, [Adguard English filter](https://adguard.com/en/filters.html#english) contains ~50 styling filters, [Adguard Russian filter list](https://adguard.com/en/filters.html#russian) contains ~250 styling filters, etc. Note that often styling filters are used to foil anti-blocker mechanism on web pages. Given this, you may want to benefit from [Adguard's filter lists](https://adguard.com/en/filters.html):\r\n\r\n![a](https://cloud.githubusercontent.com/assets/585534/16540886/2905a580-4042-11e6-9c68-7e18a645dea1.png)\r\n\r\n***\r\n\r\nThese new operators are to be used only for cosmetic filtering cases which are hard to crack -- more and more of these are surfacing (for example DOM elements with random class or id values).\r\n\r\nWhen it comes to cosmetic filtering, preferably, always favor a plain old CSS3-based cosmetic filter, since they can be used in a declarative way, inside a `style` tag. But there are cases where no CSS3-based expression will work, and in such case consider these new `:has` and `:xpath` operators.\r\n\r\nNote that unlike `:has`,  `:xpath` is not a valid CSS4 expression, so they will always be enforced in a non-declarative way (in other word, javascript is doing the filtering, through [`document.evaluate`](https://developer.mozilla.org/en/docs/Web/API/Document/evaluate)).\r\n\r\nThese new cosmetic filtering operators can be \"excepted\" like any other standard CSS3-based cosmetic filter using the usual `#@#` prompt. Such exception cosmetic filters do not have to be _specific_ however, i.e. you do not have to associate them to a specific hostname/entity.\r\n\r\n***\r\n\r\n#### Closed as fixed:\r\n\r\n##### Firefox\r\n\r\n- uMatrix's fix to [issue #540](https://github.com/gorhill/uMatrix/issues/540) has been imported into uBO.\r\n\r\n##### Core\r\n\r\n- Fixed a static filtering issue [reported in EasyList forum](https://forums.lanik.us/viewtopic.php?f=23&t=31223#p97204).\r\n- [Separator `^` is being stripped off filters](https://github.com/gorhill/uBlock/issues/1757)\r\n\r\n***"}}
{"actor":{"display_login":"gorhill"}}