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?
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With