If I put a made-up attribute on an element then element.madeUpAttribute should return false. (It does in modern browsers.)
However in IE8- it returns the attribute value, acting just like: element.getAttribute('madeUpAttribute').
Any way to make it return the attribute value only if the attribute is supported by the browser?
Thanks guys!
[update]
Here’s a demo: http://jsfiddle.net/Daniel_Hug/rWz2n/
This is what it looks like in IE8:
Checking, whether some feature is supported with
'madeUpAttribute' in elementdoes the trick in several cases for me.Actaually you may try to check element’s prototype.
There’s no prototype for DOM objects in older IE, but there’s one interesting ancient feature
This will work for the first assignment, though. After property is set, it is considered, that it do exists.