A perfect replica (hopefully) of the jQuery .css() method
testNode.css("color","blue") //use it with two string arguments!
testNode.css({color:"red"}) //use it with an object!
testNode.css("color") //make it return the value of a property
It's even chainable!
Credit to @atk for the great minifiing tips!
Shortened string detection using coercion:
''+a===a
instead oftypeof a=='string'
Update: even shorter version by using negative string detection and non-parsing of number object 0:
function(a,i,n){for(n in''+a!==a?a:0)this.style[n]=a[n];return n||i?((this.style[a]=i),this):this.style[a]}
However, you are aware that this will only get inline styles, not currentStyle (IE) nor getComputedStyle (W3C) informations?