jijopaulose / gwtquery

Automatically exported from code.google.com/p/gwtquery
MIT License
0 stars 0 forks source link

fadeIn() shouldn't rely on "display: none" #184

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I was trying to fade in an element that was styled like this

  .elem {
    opacity: 0;
  }

and was wondering why fade in just didn't work. As I found out GwtQuery expects 
the element to be hidden with "display: none".

  .elem {
    display: none;
  }

In PropertiesAnimation#computeFxNumericProp() there's the condition

  if (("show".equals(val) && !hidden) || ("hide").equals(val) && hidden) {
    return null;
  }

which is true when "display: none" is missing so it returns early and the 
animation never starts. Also when the element is styled like

  .elem {
    opacity: 0;
    display: none;
  }

the animation works but as soon as the animation is complete the element 
disappears again. This is because GwtQuery removes "opacity" from the "style" 
attribute of the element once the animation has finished. Imho "opacity: 1" 
should be kept in "style". Afaik jQuery does it that way.

The same goes for fadeOut() of course and other property-based animations.

GwtQuery version: 1.4.0-SNAPSHOT

Original issue reported on code.google.com by sj1...@gmail.com on 18 Jun 2013 at 4:39

GoogleCodeExporter commented 9 years ago
Thanks for reporting. I've migrated this issue to github : 
https://github.com/gwtquery/gwtquery/issues/215
Please follow the issue there.

Original comment by julien.d...@gmail.com on 14 Jul 2013 at 11:23