Assume I have a CSS instruction like:

p[style="margin: 4px 0;"] { font-size: 13px !important; line-height: 13px 
!important; }

How can I apply it in an GM script in the best (shortest) way? Is

try {
document.querySelector('p[style="margin: 4px 0;"]').setAttribute('style', 
'font-size: 13px !important; line-height: 13px !
important;');
} catch ( ignored ) {  }

the only way?

Do I have to append "!important" here or is this only necessary in pure/native 
CSS statements?

I prefer to use an GM instruction with GM_addStyle(). Can I use therefore a 
command similar to:

GM_addStyle("p[style="margin: 4px 0;"] { font-size: 13px !important; 
line-height: 13px !important; }");

This does not work. Do I have to mask the inner double quotes like in

GM_addStyle("p[style=\"margin: 4px 0;\"] { font-size: 13px !important; 
line-height: 13px !important; }");

Ben





-- 
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/d/optout.

Reply via email to