Bug 83602 - Unspecified DOM attributes without defaults not DOM Level 2 compliant
Summary: Unspecified DOM attributes without defaults not DOM Level 2 compliant
Status: RESOLVED FIXED
Alias: None
Product: konqueror
Classification: Applications
Component: khtml ecma (show other bugs)
Version: unspecified
Platform: RedHat Enterprise Linux Linux
: NOR normal
Target Milestone: ---
Assignee: Konqueror Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-06-18 18:28 UTC by Unknown
Modified: 2004-10-11 13:23 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Unknown 2004-06-18 18:28:18 UTC
Version:           3.2.2-4 (using KDE KDE 3.2.2)
Installed from:    RedHat RPMs
OS:                Linux

The DOM Level 2 HTML specification says:  "The return value of an attribute that is unspecified and does not have a default value is the empty string if the return type is a DOMString, false if the return type is a boolean and 0 if the return type is a number."
http://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-642250288

Konqueror is not compliant, and does return null instead of the empty string for example in the following:
<a href="#" onclick="alert(this.className);return false">test</a>
Comment 1 Unknown 2004-06-18 18:31:31 UTC
Forgot to add that the getAttribute() method in Konq is DOM compliant, it does return the empty string for nonexisting attributes.  It's the "property attributes" which have this bug.
Comment 2 Yan Morin 2004-10-11 01:26:05 UTC
In this file:
http://webcvs.kde.org/cgi-bin/cvsweb.cgi/kdelibs/khtml/ecma/kjs_html.cpp?rev=1.272

Change:
  case ElementLang:
    return getString(element.lang());
  case ElementDir:
    return getString(element.dir());
  case ElementClassName:
    return getString(element.className());

to this:
  case ElementLang:
    return String(element.lang());
  case ElementDir:
    return String(element.dir());
  case ElementClassName:
    return String(element.className());
Comment 3 Harri Porten 2004-10-11 13:23:59 UTC
We we discussing this issue for quite a while already. Thanks for the pointer
to the spec. Fixed in CVS HEAD now.