sounds like IE8 has changed their implementation, which may force a change in
code. can you provide a simple test case? i'm not able to launch jsUnit at the
moment in IE8 or even firefox, which doesn't bode well for rooting out defects.
the MS docs are not helpful since they don't explain the consequences of using
each method (e.g. does calling removeAttribute set the value to null or an
undefined value, the latter being my expectation).
which version of the script are you using? have you updated to 4.0.0 available
at
http://code.google.com/p/javascript-form-validation/source/browse/trunk/validati\
on.js? as you can tell from history, this script hasn't been updated in quite a
while, but i don't even see a setProperty method.
when it comes to getting and setting DOM properties, i would recommend doing it
directly:
element.fooProperty = "";
alert(element.fooProperty);
--- In validation@yahoogroups.com, "krispy_builder" <krispy_builder@...> wrote:
>
> 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
>