Am 15.04.2013 07:54, schrieb Ben:
Thank you.
Two more questions: Do I have to append a ";" at the end of a document.querySeleector()
statement?

For the last statement of a block (i. e. the whole script or within "{ }"), you needn't use the ; However it is always highly recommended to getting used to end all commands with ; Just because you might want to extend the script and it's easy to forget it then.

The same is for CSS rules.

You should also try to get used to brackets in JS. Although "if (test) doSomething else doSomethingElse" works fine, using "if (test) { doSomething; } else { doSomethingElse; } is a much better style.

"!important" makes a rule override some otherwise higher statement. It is for example useful if you write something like:

a:link { color: red; }
a:focus { color: blue; }
a:hover { color: green; }
a:active { color: orange; }

that would put your "a" elements in various colours depending on their states.

div#navigation { color: white !important; }

would ensure that the div element with id "navigation" (and due to inheritance of styles all its child elements) have a white font colour.

div#navigation a.currentPage { color: black !important; }

could the re-override the rule to make the link with the class "currentPage" black again or something. Which rule overrides which other rules is decided by 1) important-flag, 2) selector, and 3) position in CSS file.

The hierarchy/precedence is described here:
http://www.w3.org/TR/CSS2/cascade.html

Chris

Assume I put the document.querySeleector()  statement at the end of a GM
script (e.g. after other GM_addStyle() statements):
Do I have to add an "!important;" postfix to this statement?

--
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to