setting css property to empty string from script

When you have overrided the value of an element's CSS attribute
through script, then you can reset the attribute back to the 
value governed by style declarations by assigning the empty 
string. Example (see *):

  <style type='text/css'>
    span {border: 1px solid red}
  </style>
  <span id=myspan>lorem ipsum</span>

  e = document.getElementById("myspan");
  window.getComputedStyle(e,"").borderLeftWidth
  -> "1px"

  e.style.borderLeftWidth = 2;
  window.getComputedStyle(e,"").borderLeftWidth
  -> "2px"

* e.style.borderLeftWidth = "";
* window.getComputedStyle(e,"").borderLeftWidth
* -> "1px"

Is this behaviour specified by any standard, or is it just a
convention implemented by UAs? (I don't find it but maybe I am
not looking in the right places.)

Best regards
Mike Wilson

Received on Friday, 6 March 2009 16:51:55 UTC