I'm having a couple of problems with IE8
Storing a blank string using setProperty(). This doesn't seem to round-trip
correctly. I have changed setProperty() to store a bogus value if the "value"
parameter is a blank string, and getProperty() to convert that bogus value back
to blank string.
Also, in setProperty() if "value" is NULL then I'm using removeAttribute()
instead of setAttribute().
However, my larger problem is with getProperty() when the property is of type
Boolean and value False. IE8 getAttribute() seems to be returning "false" as a
String, rather than a Boolean. I have put a watch on the Attribute in IE8
debugger, and that definitely shows a value of false, with a type of "Boolean",
so I have no idea why getAttribute() returns a string.
Microsoft DOCs suggest getAttribute() should return a Variant of either String,
Integer, or Boolean
http://msdn.microsoft.com/en-us/library/ms536429(VS.85).aspx
If anyone can confirm this I'd appreciate it (as it would rule out there being
something else goofy in my code!)
I'd also appreciate knowing why getProperty() first retrieves the property with:
returnValue = object[property];
and then if returnValue is "Off", and the browser supports getAttribute() - i.e.
this line of code:
if (!propertyOn(returnValue) && object.getAttribute)
then getAtribute() is used to retrieve the property, i.e.
returnValue = object.getAttribute(property);
I'm not very good at JavaScript, but doesn't that just do the same thing as the
earlier
returnValue = object[property];
?? with the possible exception of case insensitive test for getAttribute() (and
the only place I have found, so far, where that might be an issue is the
getProperty() on "maxlength" - which should probably be "maxLength" to match
case-sensitively)
If so my plan would be to get rid of the getAttribute() line and rely on the
earlier returnValue=object[property]; code, but I am anxious in case there is
some subtle situation where getAttribute() adds some value, in some browsers,
because then I'll need to find a different solution!
Many thanks,
Kris