Can we use:
var rect = element.getBoundingClientRect();
var sideSpaceLeft = rect.left;
var sideSpaceRight = rect.right;
var headerWidth = rect.right - rect.left;

Is it going to work ?