This is not a Greasemonkey issue. Check your code. You probably need
something like this:
var element = document.querySelector('img[width="600"]');
if (element) {
element.setAttribute('style', 'width: 50%; height: 50%');
}
On Thursday, January 16, 2014 2:03:07 PM UTC+1, Ben wrote:
>
> Hmm, that could be.
>
> How can I avoid this failure?
>
> It should be possible that GM proceed with the next statement if there is
> no such element.
>
> On Thursday, January 16, 2014 1:10:46 PM UTC+1, Klaus Johannes Rusch wrote:
>
>> On 2014-01-16 11:25, Ben Stover wrote:
>> > Much to my surprise I obeserved that all GM statements (e.g.
>> GM_addStyle) AFTER the first occurance of a
>> >
>> > document.querySelector(...)
>> >
>> > statements are NOT executed. e.g.
>> >
>> > document.querySelector('img[width="600"]').setAttribute('style','width:
>> 50%; height: 50%');
>> >
>> > When I put the same document.querySelector(...) at the endof the GM
>> script everything works fine.
>>
>> Could this be the result of document.querySelector('img[width="600"]')
>> not finding any elements, i.e. returning null?
>>
>>
>> --
>> Klaus Johannes Rusch
>> [email protected]
>> http://klausrusch.atmedia.net/
>>
>>
--
You received this message because you are subscribed to the Google Groups
"greasemonkey-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/greasemonkey-users.
For more options, visit https://groups.google.com/groups/opt_out.