AdguardTeam / Scriptlets

AdGuard scriptlets library
GNU General Public License v3.0
148 stars 29 forks source link

Fix 'trusted-create-element' — do not add element on every DOM changes #450

Closed AdamWr closed 2 days ago

AdamWr commented 1 month ago

Currently element is added every time when there is change in DOM.

Steps to reproduce:

  1. Add these rules:
    example.org#%#//scriptlet('trusted-create-element', 'body', 'a')
    example.org#%#//scriptlet('trusted-create-element', 'body', 'div')
  2. Go to - https://example.org/

Website is unresponsive because elements are added in the loop.


Consider also a case when one element is added inside another:

example.org#%#//scriptlet('trusted-create-element', 'body', 'foo')
example.org#%#//scriptlet('trusted-create-element', 'body > foo', 'bar')