...

View Full Version : Unique ID's



Mr J
12-26-2006, 06:33 PM
Are the following id's considered to be unique?

id="myDiv"

id="mydiv"

_Aerospace_Eng_
12-26-2006, 06:43 PM
In javascript they seem to be but from an html stand point, they can't be in the same document as html considers them the same.

Mr J
12-26-2006, 06:47 PM
I thought it might be something on those lines

IE7 treats them both as the same whereas Firefox conciders them both unique

felgall
12-26-2006, 07:24 PM
HTML is NOT case sensitive and so if the page is HTML then they are the same.

XHTML is case sensitive and so if your page is defined and served as XHTML then they would be two different ids. IE doesn't support XHTML served as XHTML though and so the only way to get XHTML to work with IE is to serve it as HTML.

Arbitrator
12-27-2006, 09:16 PM
HTML is NOT case sensitive and so if the page is HTML then they are the same.According to the relevant part (http://www.w3.org/TR/html401/struct/global.html#adef-id) of the HTML 4.01 specification, the value of the id attribute is case‐sensitive. That seems to mean case‐insensitive handling is a bug in Internet Explorer up to version 7; this seems to be confirmed here (http://www.webdevout.net/browser_support_html.php#support-html401-attrscore) and here (http://devedge-temp.mozilla.org/viewsource/2001/css-class-id/). According to the second secondary source, Mr Jís example code would also be invalid if both IDs were used in the same document because case‐insensitive matches are not permitted for names and IDs.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum