Open Bug 45424 Opened 22 years ago Updated 4 years ago
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 right now. This is a blocker for the Theme Builder. Any ideas? Thanks pete
Status: NEW → RESOLVED
Closed: 22 years ago
Resolution: --- → INVALID
Here is a better discription: http://bugzilla.mozilla.org/show_bug.cgi?id=7639 I was asked to file this bug. I am just not explaining what i need properly. Thanks pete
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 http://www.w3.org/TR/DOM-Level-2/css.html#CSS-DocumentCSS 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...
Status: RESOLVED → REOPENED
Resolution: INVALID → ---
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'); doc.getOverrideStyle(foo, 'hover'); or doc.getOverrideStyle(foo, 'active'); 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. pete
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. pete
It's listed here among the document class methods. http://lxr.mozilla.org/seamonkey/source/dom/src/coreDOM/nsJSDocument.cpp#1418 pete
Status: REOPENED → ASSIGNED
Summary: need to set alternative pseudo styles on xul elements → implement getOverrideStyle()
Target Milestone: --- → Future
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. pete
Updating QA Contact to firstname.lastname@example.org
QA Contact: paw → pmac
Joe - 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
Component: Themes → 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...
QA Contact: pmac → ian
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. ;-) --pete
Removing nsbeta1 nomination -- there was a misunderstanding and some "approved out features" were nominated by mistake! Sorry!
assigning to myself
Assignee: waterson → petejc
Status: ASSIGNED → NEW
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. Thanks --pete
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 moved)
Target Milestone: mozilla1.0 → mozilla1.0.1
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.  http://www.w3.org/TR/smil-animation/#AnimationSandwichModel  http://lists.w3.org/Archives/Public/www-style/2003Nov/0013.html  http://lists.w3.org/Archives/Public/www-style/2003Nov/0041.html
(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.)
Bulk priority change, per :mdaly
Priority: P3 → P5
You need to log in before you can comment on or make changes to this bug.