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

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

Closed
zloyden opened this issue Mar 4, 2024 · 1 comment
Closed

Comments

@zloyden
Copy link

zloyden commented Mar 4, 2024

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 zloyden changed the title tv.rambler.ru - rules using ## does not apply to the site tv.rambler.ru - element hiding rules ##, #$# do not apply to the site Mar 4, 2024
@AdamWr
Copy link
Member

AdamWr commented Mar 4, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants