How to workaround Safari marginRight issue
Hi everyone,
we're facing a specific issue in jQuery UI, which has been reported by
a couple of users, and I debugged it to find out it's specifically
related to webkit:
If a non-floating element has a margin or margin-right value set via
stylesheets, this value is ignored in the computed style ($().css
('marginRight')), and instead, the offset between the element and it's
(offset) parent to the right is returned.
It's a major bug, and causes issues everywhere we're using marginRight
(for example, the containment option in Draggables). Is this something
we should build a workaround for, and is there really a possibility
for a workaround, other than parsing the stylesheets by hand?
In case you're wondering, here's how to easily reproduce it: Paste the
following into a HTML file:
<style>
.test {
width:100px;
height:100px;
background-color:green;
margin: 5px;
margin-right: 5px;
}
</style>
<div class='test'></div>
now type $('.test').css('marginRight') into the console.