Closed Bug 5386 Opened 25 years ago Closed 25 years ago

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

Categories

(Core :: DOM: Core & HTML, defect, P3)

defect

Tracking

()

VERIFIED INVALID

People

(Reporter: ckritzer, Assigned: vidur)

Details

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>
QA Contact: 4015 → 4120
Status: NEW → RESOLVED
Closed: 25 years ago
Resolution: --- → INVALID
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.
Status: RESOLVED → VERIFIED
Ahhhhh....okay, I get it.  I was looking at this from the incorrect angle.  Thank
you Vidur.
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.