DOMLint
I have seen JSLint , JavaScript Lint , JSON Lint and jQuery Lint .
Today I came across DOM Lint in this jQuery thread .
I never really thought it before but what if the name of a form is getElementById.
<form name="getElementById">
...
</form>
How about addEventListener as the id of a div.
<div id="addEventListener"> ... </div>
I am quoting Dave here. He explained the problem very well.
I strongly recommend against using using name/id attributes that are identical to the elements or properties. Specifically, don’t name an input element “select”, “id”, “name”, “form”, “action”, “method”, “value”, or any other name that is documented to be used by form or input elements. Here is why. The form element allows you to access its inputs by saying formname.inputname. So if you have an input named “myinput” you can use form.myinput to access it. But what if you name an input “id”? Now when you say form.id do you mean the “id” property of the form, or do you mean the “id” input inside the form?
If you run into those cases then you can use DOMLint . Source code is on github and here is the initial announcement .