div with style, no class
div with class, no style
IE5.5:
n.getAttribute('style') = object regardless of whether any inline
n.style = object regardless of whether any inline
n.className works, empty string if none
n.getAttribute('class') always returns null
n.getAttribute('className') works, empty string if none
n.missing = undefined, regardless of whether standard
n.getAttribute('missing') = null, regardless of whether standard
Mozilla:
n.getAttribute('style') = string if one, null if none
n.style = object regardless of whether any inline
n.className works, empty string if none
n.getAttribute('class') works, null if none
n.getAttribute('className') always returns null
n.missing = undefined, regardless of whether standard
n.getAttribute('missing') = null, regardless of whether standard
Opera:
n.getAttribute('style') = string if one, empty string if none
n.style = object regardless of whether any inline
n.className works, empty string if none
n.getAttribute('class') works, empty string if none
n.getAttribute('className') works, empty string if none
n.missing = undefined, regardless of whether standard
n.getAttribute('missing') = empty string, regardless of whether standard
Safari:
(identical to Mozilla)
n.getAttribute('style') = string if one, null if none
n.style = object regardless of whether any inline
n.className works, empty string if none
n.getAttribute('class') works, null if none
n.getAttribute('className') always returns null
n.missing = undefined, regardless of whether standard
n.getAttribute('missing') = null, regardless of whether standard
Conclusions:
supporting n.style.cssText: IE, Mozilla, Opera
set style by:
n.style = "color: red" none
n.setAttribute('style', 'color: red') Safari
n.style.backgroundColor = 'red' IE, Mozilla, Opera, Safari
n.style.setProperty('background-color','red',null) Mozilla, Opera, Safari
n.style.setAttribute('backgroundColor','red') IE
get style by:
n.style.getPropertyValue('background-color') Mozilla, Opera, Safari
n.style.getAttribute('backgroundColor') IE
getting attributes (with xhtml with doc type)
case-sensitive getAttribute: Opera (bug in Opera 7.10)
case-insensitive getAttribute: Mozilla, IE, Safari
expando attributes for non-standard atts: Safari (case-insensitive), IE (case-sensitive, no hyphen)
n.attributes('whatever') is cis and returns an Attr Mozilla
long attribute names work Mozilla, IE, Opera
underscore attribute names work Mozilla, IE, Opera