DOM: HTMLElement.className implementation doesn't match DOM Spec

VERIFIED INVALID

Status

()

Core
DOM
P3
major
VERIFIED INVALID
19 years ago
18 years ago

People

(Reporter: ckritzer (gone), Assigned: vidur (gone))

Tracking

Trunk
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

19 years ago
For 04.21.99 build on MacOS 8.5.1, Win95, and RedHat Linux 5.2:

1) The HTML listed below will not return the string "TheClassHTMLElement"; it
will return nothing instead.  If you change the object 'className' to 'class' in
the BODY tag, it will return/display the associated string.  According to the DOM
Spec, the HTML 4.0 class object has been renamed to className in order to avoid
conflicts.

So what?

The DOM Spec implementation of the HTML 4.0 'class' object should be 'className',
but is not.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<HTML>
<HEAD>
	<TITLE>classNameBug.html</TITLE>
</HEAD>
<BODY className="TheClassHTMLElement">
	<SCRIPT TYPE="text/javascript">
		document.write(document.firstChild.firstChild.nextSibling.className);
	</SCRIPT>
</BODY>
</HTML>

Updated

19 years ago
QA Contact: 4015 → 4120
(Assignee)

Updated

19 years ago
Status: NEW → RESOLVED
Last Resolved: 19 years ago
Resolution: --- → INVALID
(Assignee)

Comment 1

19 years ago
Actually, this does works as spec'd. The DOM spec does not change HTML. The
expectation is that you should still use the CLASS attribute for HTML, but
access and modify it through the DOM using the "className" property.
(Reporter)

Updated

19 years ago
Status: RESOLVED → VERIFIED
(Reporter)

Comment 2

19 years ago
Ahhhhh....okay, I get it.  I was looking at this from the incorrect angle.  Thank
you Vidur.
You need to log in before you can comment on or make changes to this bug.