I need some way to dynamically set alternative pseudo styles
ex: hover, active etc . . .
the style property for xul element objects i don't think will give me this.
It just when implemented, give me the "normal" style rules. Which i don't need
This is a blocker for the Theme Builder.
Here is a better discription:
I was asked to file this bug. I am just not explaining what i need properly.
How do you want to set them? If the element has an ID or a class (which you
can give it dynamically) you could dynamically add a rule to a stylesheet. I
think that's the only way right now, and the only way within any standards.
Pete, answering your questions in bug 7639: Yes, this can be done with
document.getOverrideStyle(), look at
with getOverrideStyle() you can access the override style, pseudo or not, for
any element, what you get is a CSSStyleDeclaration, i.e. same as you get through
element.style so yes, you can both set and get values from the override style.
Please note that the delcaration you get from getOverrideStyle() is for one
element only, i.e. if you have other elements with the same name their style
should remain uneffected by any changes made to the override style...
Waterson, I think this is a valid bug, but this should most likely be futured...
Yea, thanks Johnny, i was reading it over.
getOverrideStyle(in Element elt,in DOMString pseudoElt);
I would call it like this:
var doc = document;
var foo = doc.getElementById('someID');
And then to set it, i would do:
doc.getOverrideStyle(foo, 'hover') = "color: red;"
If this is correct, then yes this is EXACTLY what i need.
I am assumeing that this is a top level dom call similar to getElementByID().
I am willing to help out any way i can to get this implemented.
Tim Hill posted the correct usage in the layout ng:
styledecl = document.getOverrideStyle(element, "hover");
styledecl.setProperty("background-color", "black", "");
styledecl.setProperty("color", "white", "");
This is definitely what i'm looking for.
Yes, here is a test case from xul.
id = "stop-button"
class = "button-toolbar-1 top"
onclick = "var foo = document.getOverrideStyle(this,'hover');"/>
line 0: uncaught exception: [Exception... "Object is of wrong type" code:
"1002" nsresult: "0x805303ea (NS_ERROR_DOM_WRONG_TYPE_ERR)" location:
It's listed here among the document class methods.
Hey Chris, is this in any way possible to implement from JS?
If so i would definately have a go at it.
If the interfaces that contain all of the css style rules etc . . are scriptable
then you never know what could happen.
Updating QA Contact to email@example.com
This is preventing Alphanumerica from being able to implement the import theme
functionality we wanted in the themebuilder tool. Right now the modern theme is
hardcoded in and is the only starting point. Any ideas?
Todd, this is just one of the many DOM Level 2 things that aren't implemented
but would be nice to have... you'd probably have to bug trudelle to find
someone to implement it if they have the time, which is probably not likely at
the moment given the current priorities.
Peter (Trudelle) - is this even a possibility for 6.5? Is there anyone outside
of your group that could possibly implement it?
Themes Triage Team changing to DOM Level 2
*** Bug 62695 has been marked as a duplicate of this bug. ***
Taking QA Contact on all open or unverified DOM Style bugs...
Todd, Joe - Would love to help out, but we are swamped. (& please note that DOM
level 2 is not our area anyway)
I started looking into this and Johnny S is helping me out.
I just don't have any time. Arg!
I really hope to resume in a week or two.
There is only so much i can do in that hour ride on the train home. ;-)
Nominating this bug for nsbeta1 on behalf of firstname.lastname@example.org.
Removing nsbeta1 nomination -- there was a misunderstanding and some "approved
out features" were nominated by mistake! Sorry!
assigning to myself
pete are u working on this implementation ?? i cold not find any implementation
of nsDOMDocumentStyle also and hence nsDOMDocumentCSS has not been implement. I
would like to help in getting this working.. let me know if you need help
I have this on my bug list. I will let you know when i get to it.
Bugs targeted at mozilla1.0 without the mozilla1.0 keyword moved to mozilla1.0.1
(you can query for this string to delete spam or retrieve the list of bugs I've
XMLDocument or Window so it is possible to programmatically *set* style on
Element nodes. It is currently possible to *get* style on such nodes using
getComputedStyle from the ViewCSS interface (implemented by Window).
Does getOverrideStyle() should accept pseudo-classes (hover,
activates...) in second argument ?
DOM CSS say (for getComputedStyle() and getOverrideStyle()):
"pseudoElt of type DOMString
The pseudo-element or null if none."
FWIW, this feature -- getOverrideStyle() -- is probably needed to support SVG/SMIL Animation of CSS properties.
Quoting the SMIL Animation Specification:
"When animation is applied to CSS properties of a particular element, the base value to be animated is read using the (readonly) getComputedStyle() method on that element. The values produced by the animation are written into an override stylesheet for that element, which may be obtained using the getOverrideStyle() method. These new values then affect the cascade and are reflected in a new computed value (and thus, modified presentation)."
Also, FWIW -- the above paragraph is a bit vague on whether or not a change to getOverrideStyle() should modify the output of getComputedStyle(). But per discussion on www-style (, ) it sounds like it *is* supposed to modify the computed style.
(In reply to Daniel Holbert [:dholbert] from comment #27)
> FWIW, this feature -- getOverrideStyle() -- is probably needed to support
> SVG/SMIL Animation of CSS properties.
(Just to follow up on this -- we didn't end up needing this for SMIL -- we ended up going with a custom SMIL-specific override stylesheet that's not exposed via the DOM at all. For reference, see bug 474049 comment 10, first bullet-point.)