From 75b039345425bcd309d8fa6c4fe8b77231b450ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A9ry=20Debongnie?= Date: Sun, 12 Nov 2017 22:02:16 +0100 Subject: [PATCH] [FIX] web: remove slow css rule We do not take CSS seriously enough, but it has an impact on rendering speed. The rule removed in this commit slowed down the Qunit JS test suite by a considerable amount: With a fresh db with no extra addon installed, community version: - in chrome, before this commit: 103.2s, with this commit: 54.8s - in firefox, before this commit: 194.9s, with this commit: 117.7s This is due to the way rendering is done in web browser. They start checking css rules from the right, so the *:nth-last-child(2) rule was checked for every element in the dom, each time it was added/modified. Note that the rule just above (*:first-child) had no noticeable impact, but I still think that the universal css selector should still be avoided in general. The fun part is that I did not find the place where this rule was supposed to be applied. I assume that it is just a dead rule. If this is not the case, we can reintroduce the margin-top with the class mt0, applied on the specific element. --- addons/web/static/src/less/rainbow.less | 3 --- 1 file changed, 3 deletions(-) diff --git a/addons/web/static/src/less/rainbow.less b/addons/web/static/src/less/rainbow.less index ec5a701d31d..2342a7f2718 100644 --- a/addons/web/static/src/less/rainbow.less +++ b/addons/web/static/src/less/rainbow.less @@ -147,9 +147,6 @@ *:first-child { margin-top: 0; } - *:nth-last-child(2) { - margin-bottom: 0; - } } .o_reward_msg_content {