Javascript Pet Peeves

For some reason people when writing javascript always seem to do 2 things that just drive me nuts!


One they camel case some html attributes like onChange , onClick .onMouseOver all html elements and attributes should be in lowercase

http://www.w3schools.com/html/html_elements.asp


http://www.w3.org/TR/xhtml1/#h-4.2



And they prepend their function with javascript: which is only useful in very few cases
http://jibbering.com/faq/#FAQ4_24



So you get this awful monstrosity that looks like onClick="javascript:doSomething()" when the proper way is to write it onclick="doSomething()"



I'll agree that it isn't a huge deal in most cases but there is a right and wrong way to do somethings and wish people would do it the right way, oh well I guess thats why they call it a Pet Peeve.

1 Comment:

  1. Dimitri Gielis said...
    Congratulations with your new blog Carl! ... and yes the above is so true ;-)

Post a Comment