I have several different GM scripts executing on the same page (running via Tampermonkey, although similar behavior observed using Greasemonkey). The other scripts are utilizing GM API calls and are specified in their scripts using @grant (GM_xmlhttpRequest, GM_addStyle, GM_*Value calls). A new script I'm working on doesn't need access to any of these, and so I left the Tampermonkey new script default value of @grant none
.
Leaving @grant none
breaks the other scripts as well as some javascript/jquery content running on the page. Specifying no @grant at all allows everything to function as expected.
According to https://wiki.greasespot.net/@grant, when no @grant is specified, none is implied. Tampermonkey looks like it guesses what the script needs, so no idea what it's doing behind the scenes for this specific script (https://tampermonkey.net/documentation.php#_grant).
Any ideas as to the source of this wonkiness, or is it only wonky to me because I'm missing something here?
If example code is necessary, this is the gist of what I'm doing. It's really not complicated at all (reduced to just an example since this is internal code I'm working on):
var found = false;
$.each($('#id').children(),function(i,value){
if ($(value).text == 'my string'){
found = true;
}
});
if (found){
$('#id').append('<div></div>');
}
EDIT: If this is a bug, hopefully some traction here: https://forum.tampermonkey.net/viewtopic.php?f=17&t=2384