getAttribute() always non-null

Maciej Stachowiak mjs at apple.com
Tue Dec 6 02:44:54 GMT 2005


On Nov 20, 2005, at 12:44 PM, Maksim Orlovich wrote:

>
>> I tracked it down to:
>>
>> target.getAttribute('href') != null
>>
>> Looks like output from getAttribute() is always non-null breaking S5.
>
> <snip> The reason KHTML does that is that the DOM specification  
> requires
> returning empty strings, not null. Unfortunately, the only other  
> browser to
> actually behave like that is Opera. And, as you saw, the web  
> requires it,
> for example current Yahoo Mail. At any rate, there is a patch for  
> this at
> #116413; I was going to try to commit it for 3.5.1, after  
> discussion w/more
> maintainer-type folks. But since you brought it up --- David, Harri  
> -- what
> do you think? This shows up on one of the official DOM testcases,  
> and some
> of our own (as well as mozilla's, where it's marked FAIL, but WONTFIX)
>

I recently suggested on the w3c DOM list that maybe this should be  
changed in the spec, since major browsers return null in this case  
and even Opera is planning to change to this behavior since a lot of  
things on the web depend on it. However, they were not very receptive:

http://lists.w3.org/Archives/Public/www-dom/2005OctDec/thread.html

There's a similar issue with the spec requiring WRONG_DOCUMENT_ERR in  
certain cases where many browsers will actually adopt the node.

I might write these things up and propose them to whatwg if the w3c  
continues not to be receptive.

Regards,
Maciej





More information about the kfm-devel mailing list