I have the following code:
updateColors = function() {
  $(".color-preview").each(function() {
    return $(this).css('background-color', $(this).data('color'));
  });
  return null;
};
I put a breakpoint on the 3rd line, and type the following into the console:
> this
<div class="color-preview" data-observer="{"attr":"data-color", "observe":"btn_col"}" data-color="#ffff00" style="background-color: rgb(153, 0, 255);"></div>
> $(this).data('color')
"#9900ff"
As you can see, the actual element's data-color is #ffff00. However, jQuery's .data() method is returning #9900ff, which was the value of the element's data-color, but has been changed (and using the breakpoint, I can see that yes it has already changed).
 
     
    