implement getOverrideStyle()
Categories
(Core :: DOM: CSS Object Model, defect, P5)
Tracking
()
People
(Reporter: pete, Unassigned)
References
Details
(Keywords: dom2, helpwanted)
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
Comment 2•24 years ago
|
||
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.
Comment 4•24 years ago
|
||
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...
Comment 5•24 years ago
|
||
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
Comment 6•24 years ago
|
||
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
Reporter | ||
Comment 7•24 years ago
|
||
Yes, here is a test case from xul. <button id = "stop-button" class = "button-toolbar-1 top" onclick = "var foo = document.getOverrideStyle(this,'hover');"/> result: JavaScript error: line 0: uncaught exception: [Exception... "Object is of wrong type" code: "1002" nsresult: "0x805303ea (NS_ERROR_DOM_WRONG_TYPE_ERR)" location: "<unknown>"]
Reporter | ||
Comment 8•24 years ago
|
||
It's listed here among the document class methods. http://lxr.mozilla.org/seamonkey/source/dom/src/coreDOM/nsJSDocument.cpp#1418 pete
Updated•24 years ago
|
Reporter | ||
Comment 9•24 years ago
|
||
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
Comment 11•24 years ago
|
||
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?
Comment 12•24 years ago
|
||
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.
Comment 13•24 years ago
|
||
Peter (Trudelle) - is this even a possibility for 6.5? Is there anyone outside of your group that could possibly implement it?
Comment 14•24 years ago
|
||
Themes Triage Team changing to DOM Level 2
Comment 15•24 years ago
|
||
*** Bug 62695 has been marked as a duplicate of this bug. ***
Updated•24 years ago
|
Comment 16•24 years ago
|
||
Taking QA Contact on all open or unverified DOM Style bugs...
Comment 17•24 years ago
|
||
Todd, Joe - Would love to help out, but we are swamped. (& please note that DOM level 2 is not our area anyway)
Reporter | ||
Comment 18•24 years ago
|
||
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
Comment 19•23 years ago
|
||
Nominating this bug for nsbeta1 on behalf of gerardok@netscape.com.
Comment 20•23 years ago
|
||
Removing nsbeta1 nomination -- there was a misunderstanding and some "approved out features" were nominated by mistake! Sorry!
Reporter | ||
Comment 21•23 years ago
|
||
assigning to myself
Reporter | ||
Updated•23 years ago
|
Comment 22•23 years ago
|
||
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
Reporter | ||
Comment 23•23 years ago
|
||
I have this on my bug list. I will let you know when i get to it. Thanks --pete
Reporter | ||
Updated•23 years ago
|
Reporter | ||
Updated•23 years ago
|
Comment 24•23 years ago
|
||
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)
Comment 25•20 years ago
|
||
In Seamonkey/Javascript, please implement the DocumentCSS interface on 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).
Comment 26•20 years ago
|
||
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."
Comment 27•16 years ago
|
||
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 ([2], [3]) it sounds like it *is* supposed to modify the computed style. [1] http://www.w3.org/TR/smil-animation/#AnimationSandwichModel [2] http://lists.w3.org/Archives/Public/www-style/2003Nov/0013.html [3] http://lists.w3.org/Archives/Public/www-style/2003Nov/0041.html
Updated•15 years ago
|
Comment 28•12 years ago
|
||
(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.)
Updated•10 years ago
|
Comment 30•2 years ago
|
||
The bug assignee is inactive on Bugzilla, so the assignee is being reset.
Comment 31•2 years ago
•
|
||
It looks like this API (and its "DocumentCSS" interface) ended up being dropped from the spec, as best I can tell?
There's no documentation on MDN or implementation data on caniuse.com; and I found this post suggesting we remove it from the CSSOM spec in 2007 (where it lived at that time):
https://lists.w3.org/Archives/Public/www-style/2007Feb/0150.html
and it looks like it was indeed removed later that year, in this commit:
https://github.com/w3c/csswg-drafts/commit/a6e57f9475885797a8dfb8a20fa1b962b607928a
and it's still gone in the current published version of CSSOM:
https://www.w3.org/TR/cssom-1/
Comment 32•2 years ago
|
||
Yes, mentioning of the "Overriding styles" and related concepts have been removed from the specs: https://github.com/w3c/csswg-drafts/issues/1385#issuecomment-341272054
Description
•