AdguardTeam / Scriptlets

AdGuard scriptlets library
GNU General Public License v3.0
138 stars 27 forks source link

Fix 'set-attr' scriptlet — value cannot be set to '0' and '32767' #425

Closed AdamWr closed 1 month ago

AdamWr commented 2 months ago

Steps to reproduce:

  1. Add this rule:
    example.org#%#//scriptlet('set-attr', 'h1', 'data-ad-status', '0')
  2. Go to - https://example.org/

h1 element should has data-ad-status attribute, but if value is 0 then it doesn't work (it works fine if it's set to 1).

Probably problem is here: https://github.com/AdguardTeam/Scriptlets/blob/ce952deb39d278816be12ffcc902a5b281c7641f/src/scriptlets/set-attr.js#L131 Previously it was possible to use 0 as value, but now it doesn't work.