Is there an order of attributes which make the DOM queries faster? For example in the beginning\end of the element.
When I traverse the DOM up will it be better to put the attributes in the end and the other way around when I traverse the DOM down?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
No, the browser parses the HTML and constructs the DOM. At that point the literal source of the page is not important anymore, thus DOM queries are not effected by the order.
However I personally like to put my id first, then class, then anything else. For readability.