@@ -1047,7 +1047,10 @@ example.org#%#//scriptlet('trusted-set-constant', property, value[, stack])
10471047
10481048- ` property ` — required, path to a property (joined with ` . ` if needed). The property must be attached to ` window ` .
10491049- ` value ` — required, an arbitrary value to be set; value type is being inferred from the argument,
1050- e.g '500' will be set as number; to set string type value wrap argument into another pair of quotes: ` '"500"' ` ;
1050+ e.g '500' will be set as number; simple strings that do not match
1051+ other types are automatically set as strings, e.g 'yes', 'no', 'allow';
1052+ to set string type value that looks like other types,
1053+ wrap argument into another pair of quotes, e.g. ` '"500"' ` for a string;
10511054- ` stack ` — optional, string or regular expression that must match the current function call stack trace;
10521055 if regular expression is invalid it will be skipped
10531056
@@ -1077,6 +1080,12 @@ example.org#%#//scriptlet('trusted-set-constant', property, value[, stack])
10771080 ! Set array or object as property value, argument should be a JSON string
10781081 example.org#%#//scriptlet('trusted-set-constant', 'click_r', '[1,"string"]')
10791082 example.org#%#//scriptlet('trusted-set-constant', 'click_r', '{"aaa":123,"bbb":{"ccc":"string"}}')
1083+
1084+ ! Set simple string value without quotes
1085+ example.org#%#//scriptlet('trusted-set-constant', 'test', 'no')
1086+
1087+ ✔ window.test === 'no'
1088+ ✔ typeof window.test === 'string'
10801089 ```
10811090
108210911. Use script stack matching to set value
0 commit comments