Performance optimisation, only work in webkit