Entries tagged ‘dom’

Computed style values for clip:rect() are different in WebKit compared to Gecko and Opera. Given this test code:

<div id="test" style="clip:rect(0, 50px, 50px, 0);width:100px;height:100px;position:absolute;background:red"></div>
<script>
window.onload = function(){
  alert(window.getComputedStyle(document.getElementById("test"), null).clip);
};
</script>

You get:

  • WebKit: rect(0px 50px 50px 0px)
  • Opera: rect(0px, 50px, 50px, 0px)
  • Gecko: rect(0px, 50px, 50px, 0px)

Nothing I couldn’t fix in the regular expression I was using to split the values, but an odd difference nonetheless.