« Return to Thread: Including other JS files and using "class" and custom styles

Re: Including other JS files and using "class" and custom styles

by Anthony Lieuallen :: Rate this Message:

Reply to Author | View in Thread

On 8/4/2006 9:42 AM, Stefano POGLIANI wrote:
> Do you have an example of use of "className" in Javascript?

Uh..
var div=document.createElement('div');
div.className='foo';

> also, as I read the "Dive into GM" page, it seems that if the newly
> defined "class" gets added an  "! important;" at the end, the definition
> overrides the previous one.

The "! important" clause relates to specificity:
http://www.w3.org/TR/CSS21/cascade.html#specificity
It makes that rule "more specific" than anything else.

> Could this approach be used to "sort of" RESET any stylesheet attribute
> that would apply to the elements I am defining in my page?

There's a GM api to do this .. I think it's only in CVS versions at this
point.  I can't remember its name, but someone will come up with it.

> As to the XUL question. I was wondering if, for instance, with GM I
> could create a little XUL container which could, then, be embedded in
> soething like the "All-in-One Sidebar" extension.

Can't say, for sure.
_______________________________________________
Greasemonkey mailing list
Greasemonkey@...
http://mozdev.org/mailman/listinfo/greasemonkey

 « Return to Thread: Including other JS files and using "class" and custom styles