pvdung / ourlibrary

Automatically exported from code.google.com/p/ourlibrary
0 stars 0 forks source link

setStyles wont set a style to 'none' #3

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. in side an event responder function
2. var theTarget = API.getEventTarget(e);
1. E(theTarget).setStyles({'background-color':'none','color':'none'});

What is the expected output? What do you see instead?
to set the element style attribute to 'background-color:none;color:none;'
as API.setAttribute(theTarget, 'style', 'background-color:none;color:none;'); 
will do.

What version of the product are you using? On what operating system?
Generated by My Library Builder v1.0  on Thu, 25 Mar 2010 17:54:42 UTC
Mac OS X 10.6.2

Please provide any additional information below.

Original issue reported on code.google.com by johnwloc...@gmail.com on 26 Mar 2010 at 3:34

GoogleCodeExporter commented 9 years ago
You must use the camel-case variation of style names (this is consistent 
throughout My 
Library.  I can change it to convert to camel-case (without introducing any 
real 
performance issues) if there is any call for it.  Personally, I've always 
preferred to 
use camel-case.

E(theTarget).setStyles({'backgroundColor':'none','color':'none'});

Original comment by dmark.ci...@gmail.com on 27 Mar 2010 at 6:28

GoogleCodeExporter commented 9 years ago
It doesn't work with camel case either.

E(theTarget).setStyles({"backgroundColor":"#33ffff","color":"#0000ff"});

this will not set the background color from #33ffff to none:
E(theTarget).setStyles({"backgroundColor":"none","color":"none"});

Original comment by johnwloc...@gmail.com on 27 Mar 2010 at 11:29

GoogleCodeExporter commented 9 years ago
Those aren't valid values for the color or background-color styles.

http://www.w3.org/TR/CSS2/colors.html#background-properties

Must be a valid color, "inherit" or "transparent".  You can do this:

.someclass {
  background: transparent none
}

...but that is shorthand for:-

.someclass {
  background-color: transparent;
  background-image: none
}

Original comment by dmark.ci...@gmail.com on 28 Mar 2010 at 5:11

GoogleCodeExporter commented 9 years ago
Well I'll be a son of a gun, none is invalid for background color. My goal is 
to remove the background-color 
property in a style attribute so as to let the definition of the CSS selector 
take over. I observed that setting it to 
'none' achieved this affect, but I'm learning not to rely on observation over 
standards specification.
How about a function to remove a style property?

Original comment by johnwloc...@gmail.com on 28 Mar 2010 at 5:56

GoogleCodeExporter commented 9 years ago
You can do that with setStyle/setStyles:-

E(theTarget).setStyles({"backgroundColor":"","color":""});

Original comment by dmark.ci...@gmail.com on 28 Mar 2010 at 6:03

GoogleCodeExporter commented 9 years ago
Excellent! Thanks for telling about this feature.

Original comment by johnwloc...@gmail.com on 28 Mar 2010 at 6:08

GoogleCodeExporter commented 9 years ago
No problem at all.  That's what I'm here for.  :)

Original comment by dmark.ci...@gmail.com on 28 Mar 2010 at 6:27