Some things are unclear to me:
var myDiv = document.getElementById("myDiv");
var computedStyle = window.getComputedStyle(myDiv);
1) Isn't it possible to directly get global border color of a div if there is only one color, the same for each side:
computedStyle.getPropertyValue("border-color");
Instead of doing:
computedStyle.getPropertyValue("border-left-color");
OR
computedStyle.getPropertyValue("border-right-color");
OR
computedStyle.getPropertyValue("border-top-color");
...
2) When having style properties in a CSS file, they are only accessible through the getComputedStyle method and not via the style property like style properties defined inline, via a style attribute in the div, I'm right?
myDiv.style.getPropertyValue("border-left-color");
This will not work.
3) If we want to set a style property, we have to use the style attribute of the element, is it not possible using the computed style object?
computedStyle.setProperty("border-color", "yellowgreen", null);
I thought using the style attribute was the "old way to do", like using the inline style attribute or using object.style.property = "value" to set a style property in Javascript.
Thanks.
jsFiddle: http://jsfiddle.net/pgtFR/12/