Closed
Description
Dear Developers,
color.toRgbString() is supposed to be compatible with the jQuery.css(), however it does not return an easily comparable value.
In fact, jQuery.css("color") returns colors as "rgb(xxx, xxx, xxx)" while .toRgbString() return the same as "rgb(xxx,xxx,xxx)" without spaces! This makes impossible to easily compare colors as strings without workarounds such as $("<div>").css("color", color.toRgbString()).css("color"). This is especially important when comparing miscellaneous CSS proprieties.
Example code where I needed to use the workaround to make things work seamlessly:
$("#element").click(function() {
$(this).animate(
{
"backgroundColor": "red",
"width", "+=100"
}, {
duration: 1000,
step(val, fx) {
// some code here
if( $("<div>").css(fx.prop, fx.end.toString()).css(fx.prop) == check[fx.prop]) { ... }
/* instead of the expected:
* if(fx.end.toString() == check[fx.prop]) { ... }
*/
// more code here
}
})
});
It would be great if this little bug could be fixed.
Thank you for your great work,
Warmest Regards.
Metadata
Metadata
Assignees
Labels
No labels