Skip to content

Commit

Permalink
update description
Browse files Browse the repository at this point in the history
  • Loading branch information
slavaleleka committed Feb 9, 2024
1 parent f9bbc33 commit ca379d7
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/scriptlets/trusted-create-element.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ import type { ParsedAttributePair } from '../helpers/attribute-utils';
*
* - `parentSelector` — required, CSS selector of the parent element to append the created element to.
* - `tagName` — required, tag name of the created element.
* - `attributePairs` — optional, space-separated list of attribute name and value pairs separated by `|`.
* - `attributePairs` — optional, space-separated list of attribute name and value pairs separated by `=`.
* Value can be omitted. If value is set, it should be wrapped in quotes.
* If quotes are needed inside value, they should be escaped with backslash.
* Defaults to no attributes.
* - `textContent` — optional, text content of the created element. Defaults to empty string.
* - `cleanupDelayMs` — optional, delay in milliseconds before the created element is removed from the DOM.
Expand All @@ -35,7 +37,7 @@ import type { ParsedAttributePair } from '../helpers/attribute-utils';
* 1. Create a div element with a single attribute
*
* ```adblock
* example.com#%#//scriptlet('trusted-create-element', 'body', 'div', 'data-cur|1')
* example.com#%#//scriptlet('trusted-create-element', 'body', 'div', 'data-cur="1"')
* ```
*
* 1. Create a div element with text content
Expand All @@ -47,7 +49,13 @@ import type { ParsedAttributePair } from '../helpers/attribute-utils';
* 1. Create a button element with multiple attributes, including attribute without value, and text content
*
* ```adblock
* example.com#%#//scriptlet('trusted-create-element', 'body', 'button', 'disabled aria-hidden|true style|width:0px', 'Press here') <!-- markdownlint-disable-line line-length -->
* example.com#%#//scriptlet('trusted-create-element', 'body', 'button', 'disabled aria-hidden="true" style="width: 0px"', 'Press here') <!-- markdownlint-disable-line line-length -->
* ```
*
* 1. Create a button element with an attribute whose value contains quotes
*
* ```adblock
* example.com#%#//scriptlet('trusted-create-element', 'body', 'button', 'data="a\\"quote"')
* ```
*
* 1. Create a paragraph element with text content and remove it after 5 seconds
Expand Down

0 comments on commit ca379d7

Please sign in to comment.