- Sep 1, 2006
There is no YUI pre-canned solution for this currently, but I've thought about supplementing Dom.getStyle for backgroundColor to account for this. If you think this would be a useful enhancement, please add a feature request: http://sourceforge.net/tracker/?group_id=165715&atid=836479.
Your approach of crawling the parentNodes and using Dom.getStyle() to find a value other than 'transparent' will work to get the inherited color, except for Safari, which returns "rgba(0, 0, 0, 0)" for transparent, so you'll have to test for that as well. In the case where no backgroundColor is found, you may want to provide a default color.
Joseph Woolley wrote:
Thank you for your reply and the tip! Works great!
Now, I’m wondering if there is a YAHOO-ish way to obtain THE background color, taking into account the parent nodes; meaning, if the style ‘background-color’ is transparent, walk up the parentNode(s) until a non-transparent color specification is found.
Sent: Thursday, August 31, 2006 10:59 PM
My last post had no body it seems? I guess the rich-text editor
doesn't work in firefox 2 beta. Any you can try this:
YAHOO.util.Dom. setSyle(' background- color', '');
Using dashes is IE friendly and the Dom class "camelizes" them for
- << Previous post in topic Next post in topic >>