开发者

Does the order of HTML attributes have any effect on performance?

开发者 https://www.devze.com 2023-03-08 03:13 出处:网络
Is there any reason that relates to parsing time, layout, rendering time, style application, etc. to have HTML attributes in a certain (or consistent) order?

Is there any reason that relates to parsing time, layout, rendering time, style application, etc. to have HTML attributes in a certain (or consistent) order?

The order of HTML attribute开发者_StackOverflow中文版s does not improve a page's compressibility significantly, and maintaining some order can make the markup easier for human readers to figure out (e.g. putting id first, starting <input>s with type, putting boolean attributes at the end of an opening tag) but I'd like to know if there are any performance reasons to consider attribute order.


None to speak of I don't think. All the properties within each tag have to be parsed and read before the tag can be properly understood by the browser.

As long as the code is syntax-error free and (obviously) the shorter the better.


It all depends on the layout engine, but i suspect it would be negligible. You should not be concerned with this.

0

精彩评论

暂无评论...
验证码 换一张
取 消