getElementById and case sensitivity

There is an inconsistant behavior in how the 2 major DOM implementations
(IE/Mozilla) treat cases in ID attributes when referencing elements with
getElementById.

Consider the following example:


<div id="crappeR">first</div>
<div id="crapper">second</div>
<script type="text/javascript">
alert( document.getElementById("crapper").innerHTML );
</script>


IE will disregard cases and display "first", while Mozilla will honor cases
and display "second".

The DOM Level 1 recommendation is not clear about which to use.

DOM Level 1:
getElementById(elementId) 
This method returns a Element.
The elementId parameter is of type DOMString. 

DOM Level 1 2nd Ed.:
getElementById(elementId) 
This method returns a Element object. 
The elementId parameter is of type String.


To settle any doubts I ask: Which behavior is correct?


Regards
Thor Larholm
Jubii A/S - Internet Programmer

Received on Monday, 1 July 2002 09:47:28 UTC