Loading ...
Sorry, an error occurred while loading the content.

4526Re: [ydn-javascript] Re: Method to "clear" backgroundColor in IE?

Expand Messages
  • Matt Sweeney
    Sep 1, 2006
      Hi Joe,

      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.


      I have a javascript function for this in my tools.js, but I’ve only tested it with FF and IE.


      // Joe


      From: ydn-javascript@yahoogroups.com [mailto: ydn-javascript@yahoogroups.com ] On Behalf Of Jack Slocum
      Sent: Thursday, August 31, 2006 10:59 PM
      To: ydn-javascript@yahoogroups.com
      Subject: [ydn-javascript] Re: Method to "clear" backgroundColor in IE?


      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

    • Show all 9 messages in this topic