Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JavaScript/HTML in UPPER or lower case?

Is it better for sake of compatibility/JIT-Compiling performance to use UPPER CASE or lower case, in JS/HTML? For eg:

 <DIV> my content </DIV>
 <div> my content </div>

 ALERT(DOCUMENT.LOCATION);
 alert(document.location);

This is not a newbie question, I know lowercase is the de-facto standard. But since I've seen some uppercase JS+HTML, I was wondering which would be better to write in. (like SQL is fully uppercase?)

like image 792
Robin Rodricks Avatar asked Dec 22 '22 11:12

Robin Rodricks


1 Answers

I don't think it'd make a difference, speed-wise.

XHTML: Lowercase tags is what the W3C specified.

JavaScript: It probably wouldn't work, because I have never seen anyone's code use all caps in JS.

SQL is fully uppercase to differentiate the actions, functions, etc from the actual data. You can use lowercase, but it becomes less readable (to some, me included).

IMO, wading through a heap of uppercase tags is less readable than lowercase tags. I'd say user agents don't care what case the tags are. Here's a little bit of history: when I made a website in 1999, uppercase tags were the standard.

You can still find some dodgy non updated websites out there that still write

'Use <B></B> to make text bold'

like image 92
alex Avatar answered Dec 28 '22 22:12

alex