Re: Accessing Form attributes instead of elements

RobG
Mon, 24 Sep 2007 03:12:27 -0000

On Sep 22, 6:55 pm, Thomas Fuchs <tho...-9D208sng4xU@public.gmane.org>
wrote:
> Consider using Prototype''s readAttribute method instead. It
> automatically deals with cross-browser stupidities

readAttribute has its problems too.  Where an attribute value is
expected to be a string and has not been specified at all, IE returns
an empty string, other browsers return null.  So in IE you can''t tell
whether the attribute was not specified (which should return null), or
was specified and not given a value (which should return an empty
string).

As far as I know, the only way to fix that in IE is to parse the
element''s HTML to determine the correct response.

Also, when using readAttribute with the checked attribute and it has
been set, IE returns ''checked'', Firefox returns an empty
string.

So there are quite a few foibles that readAttribute does not deal
with.


--
Rob