Ticket #7912 (closed bug: fixed)
$.fx.prototype.cur() is incompatible with cssHooks
|Reported by:||anonymous||Owned by:|
To calculate the start value of a property being animated, $.fn.animate() uses $.fx.prototype.cur(). This function then tries to access the DOM property first and, should it fail, falls back to $.css(), which is cssHooks aware. Unfortunately, the value returned by $.css() is invariably parsed as a Float, which breaks values for properties such as color, transform, gradient, etc.
var r = parseFloat( jQuery.css( this.elem, this.prop ) ); return r || 0;
Currently, cssHooks workaround this problem by re-calculating the start value on the very first step of the animation, see color.js and transform.js examples. Obviously, this solution is neither clean nor efficient.
Before returning the value, cur() could simply do the following:
var r = jQuery.css( this.elem, this.prop ), parsed = parseFloat(r); return isNaN(parsed)? r : parsed;
But there's probably a good reason for it to currently return 0 when parseFloat fails. I need help finding this reason so that I can fix this bug.
- Keywords needsreview added
- Priority changed from undecided to high
- Component changed from unfiled to css
- Keywords needsreview removed
- Component changed from css to effects
- Milestone changed from 1.next to 1.5.1
- Status changed from open to closed
- Resolution set to fixed