Skip to content

Commit

Permalink
fix docs for both set-attr scriptlets
Browse files Browse the repository at this point in the history
  • Loading branch information
stanislav-atr committed Feb 2, 2024
1 parent d607ad5 commit 8e47996
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 13 deletions.
16 changes: 11 additions & 5 deletions src/scriptlets/set-attr.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,22 @@ import {
*
* ```html
* <!-- before -->
* <a class="class">Some text</div>
* <div>
* <a>Another text</a>
* <a class="class">Some text</a>
* </div>
*
* <!-- after -->
* <a class="class" test-attribute="0">Some text</div>
* <div>
* <a>Another text</a>
* <a class="class" test-attribute="0">Some text</a>
* </div>
* ```
*
* 1. Set attribute without value
*
* ```adblock
* example.org#%#//scriptlet('set-attr', 'div.class > a.class', 'test-attribute')
* example.org#%#//scriptlet('set-attr', 'a.class', 'test-attribute')
* ```
*
* ```html
Expand All @@ -66,7 +72,7 @@ import {
* 1. Set attribute value to `TRUE`
*
* ```adblock
* example.org#%#//scriptlet('set-attr', 'div.class > a.class', 'test-attribute', 'TRUE')
* example.org#%#//scriptlet('set-attr', 'a.class', 'test-attribute', 'TRUE')
* ```
*
* ```html
Expand All @@ -80,7 +86,7 @@ import {
* 1. Set attribute value to `fAlse`
*
* ```adblock
* example.org#%#//scriptlet('set-attr', 'div.class > a.class', 'test-attribute', 'fAlse')
* example.org#%#//scriptlet('set-attr', 'a.class', 'test-attribute', 'fAlse')
* ```
*
* ```html
Expand Down
22 changes: 14 additions & 8 deletions src/scriptlets/trusted-set-attr.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,21 +32,27 @@ import {
* 1. Set attribute by selector
*
* ```adblock
* example.org#%#//scriptlet('trusted-set-attr', 'div.class > a.class', 'test-attribute', '0')
* example.org#%#//scriptlet('trusted-set-attr', 'div.class > a.class', 'test-attribute', '[true, true]')
* ```
*
* ```html
* <!-- before -->
* <a class="class">Some text</div>
* <div>
* <a>Another text</a>
* <a class="class">Some text</a>
* </div>
*
* <!-- after -->
* <a class="class" test-attribute="0">Some text</div>
* <div>
* <a>Another text</a>
* <a class="class" test-attribute="[true, true]">Some text</a>
* </div>
* ```
*
* 1. Set attribute without value
*
* ```adblock
* example.org#%#//scriptlet('trusted-set-attr', 'div.class > a.class', 'test-attribute')
* example.org#%#//scriptlet('trusted-set-attr', 'a.class', 'test-attribute')
* ```
*
* ```html
Expand All @@ -60,29 +66,29 @@ import {
* 1. Set attribute value to `MTIzNTY=`
*
* ```adblock
* example.org#%#//scriptlet('trusted-set-attr', 'div.class > a.class', 'test-attribute', 'MTIzNTY=')
* example.org#%#//scriptlet('trusted-set-attr', 'a.class', 'test-attribute', 'MTIzNTY=')
* ```
*
* ```html
* <!-- before -->
* <a class="class">Some text</div>
*
* <!-- after -->
* <a class="class" test-attribute="TRUE">Some text</div>
* <a class="class" test-attribute="MTIzNTY=">Some text</div>
* ```
*
* 1. Set attribute value to `{ playback: false }`
*
* ```adblock
* example.org#%#//scriptlet('trusted-set-attr', 'div.class > a.class', 'test-attribute', '{ playback: false }')
* example.org#%#//scriptlet('trusted-set-attr', 'a.class', 'test-attribute', '{ playback: false }')
* ```
*
* ```html
* <!-- before -->
* <a class="class">Some text</div>
*
* <!-- after -->
* <a class="class" test-attribute="fAlse">Some text</div>
* <a class="class" test-attribute="{ playback: false }">Some text</div>
* ```
*
* @added unknown.
Expand Down

0 comments on commit 8e47996

Please sign in to comment.