- From: Ray Whitmer <rayw@netscape.com>
- Date: Fri, 19 May 2000 14:44:02 -0700
- To: kboone@ebt.com
- CC: "DOM (E-mail)" <www-dom@w3.org>
There is no way by calling getAttribute() to determine whether an attribute exists as an empty string or does not exist. Both cases return an empty string, not a null. getAttribute() != null will never happen in an implementation that follows the spec properly (I wrote one that didn't, and I expect others have, but it will have to be fixed...). You could test getAttributeNode() every time before getting the attribute and test that for null, but in a number of implementations, the attribute node never gets constructed unless it is explicitly referenced, so that causes significant extra work, just to discover whether the attribute existed or not. There's no "fixing" getAttribute at this point to make it return null if the attribute does not exist. It had to do with some environment or another, I don't remember which. Ray Whitmer ray@xmission.com "Keith W. Boone" wrote: > Alright, I'll bite. Give me a good use case for hasAttribute or > hasAttributeNS versus getAttribute() != null. I'm sure it has something to > do with ancient programming languages like C++ ;-) > > Keith
Received on Friday, 19 May 2000 17:43:57 UTC