CoreLibs icon indicating copy to clipboard operation
CoreLibs copied to clipboard

tv.rambler.ru - element hiding rules `##`, `#$#` do not apply to the site

Open zloyden opened this issue 1 year ago • 1 comments

The problem is element hiding rules ##, #$# like the example below are not applied to the site.

tv.rambler.ru##body

To reproduce it:

  1. turn all filters off
  2. add the rule above to the user rules
  3. open the site tv.rambler.ru in any browser. You will see that the page is not hidden.
Screenshot:

image


Expected behaviour - element hiding rules must be applied.

zloyden avatar Mar 04 '24 12:03 zloyden

Regarding tv.rambler.ru, as far as I understand, the problem is that whole content is removed and then re-added (currently there is b.removeChild(b.documentElement) in https://tv.rambler.ru/static/js/desktop.vendors.9ea7661d.js) and it causes that style tag added by AdGuard is removed.


Another example. The same problem occurs if website remove and then re-add head tag. Steps to reproduce:

  1. Add this rule:
example.org##body
  1. Go to - https://example.org/
  2. Open browser console and run:
(() => {
  const head = document.head;
  const cloneHead = head.cloneNode(true);
  cloneHead.querySelectorAll('style[nonce][type="text/css"]').forEach(e => e.remove());
  document.documentElement.insertAdjacentElement('afterbegin', cloneHead);
  setTimeout(() => {
    head.remove();
  }, 500);
})();

Expected behavior Content is hidden by example.org##body

Actual behavior Style tag added by AdGuard is removed.

AdamWr avatar Mar 04 '24 12:03 AdamWr