mirror of
https://github.com/gorhill/uBlock.git
synced 2024-11-16 23:42:39 +01:00
About unstable browser APIs in scriptlet injection
parent
021c626465
commit
7f28e1fafa
@ -15,15 +15,16 @@
|
|||||||
|
|
||||||
|
|
||||||
## General purpose scriptlets
|
## General purpose scriptlets
|
||||||
- most script relies on `Object` _properties_ ([_methods_](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object#Methods_of_the_Object_constructor)), altering them may not be the best idea (you should know what you are doing).
|
- Most scriptlet relies on `Object` _properties_ ([_methods_](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object#Methods_of_the_Object_constructor)), altering them may not be the best idea (you should know what you are doing).
|
||||||
- "optional" for "string/_regular expression_" parameter defaults to "catch all" (`/.?/`) if not specified.
|
- Some properties related more to browser APIs rather than JS language builtins can behave in unexpected way. For example browser can override them without scriptlet noticing this. Keep this in mind when using them in scriptlet injection filers.
|
||||||
- "string" parameter means plain character(s)/word(s), quotes will be taken literally, commas [must be escaped](https://github.com/uBlockOrigin/uAssets/commit/2bec415a9bc4f81b29be3bf083ef1a20552f39db#commitcomment-29327114) in regex literals: `/foo\x2cbar\u002cbaz/`, after [1.22.0](https://github.com/gorhill/uBlock/commit/d67340f14db6ce5b446ef0ff4586b5e4d31f1086#diff-b03ba512faa0934947e57d28dc99b43bL242) commas can be escaped by backslash character (`foo\,bar`)
|
- "Optional" for "string/_regular expression_" parameter defaults to "catch all" (`/.?/`) if not specified.
|
||||||
- "regular expression" parameter means JavaScript [regular expression literal](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions#Writing_a_regular_expression_pattern)
|
- "String" parameter means plain character(s)/word(s), quotes will be taken literally, commas [must be escaped](https://github.com/uBlockOrigin/uAssets/commit/2bec415a9bc4f81b29be3bf083ef1a20552f39db#commitcomment-29327114) in regex literals: `/foo\x2cbar\u002cbaz/`, after [1.22.0](https://github.com/gorhill/uBlock/commit/d67340f14db6ce5b446ef0ff4586b5e4d31f1086#diff-b03ba512faa0934947e57d28dc99b43bL242) commas can be escaped by backslash character (`foo\,bar`).
|
||||||
- mime type is `application/javascript` if not present
|
- "Regular expression" parameter means JavaScript [regular expression literal](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions#Writing_a_regular_expression_pattern).
|
||||||
- You can use the short alias form when available for scriptlet name
|
- Mime type is `application/javascript` if not present.
|
||||||
- You should omit the `.js` from the scriptlet name in scriptlet injection filters (eventually in some future this will be the official way to do this)
|
- You can use the short alias form when available for scriptlet name.
|
||||||
|
- You should omit the `.js` from the scriptlet name in scriptlet injection filters (eventually in some future this will be the official way to do this).
|
||||||
- Do **not** skip `.js` when the scriptlet is used with `redirect=`, only when used in `+js(...)`.
|
- Do **not** skip `.js` when the scriptlet is used with `redirect=`, only when used in `+js(...)`.
|
||||||
- crossed out resources are deprecated/removed.
|
- Crossed out resources are deprecated/removed.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user