mw.loader: Use requestAnimationFrame for addEmbeddedCSS()
authorTimo Tijhof <krinklemail@gmail.com>
Tue, 30 Aug 2016 04:07:52 +0000 (21:07 -0700)
committerKrinkle <krinklemail@gmail.com>
Wed, 31 Aug 2016 00:39:43 +0000 (00:39 +0000)
commit3ef8d8a418579b51e8e6aa777fec373c17782b91
treee16b1da82df311a9a409e155dc5755367f588ea2
parent2bdd56e89334d85c48753b0052b0a94689dd584b
mw.loader: Use requestAnimationFrame for addEmbeddedCSS()

setTimeout is fairly inefficient for this purpose as it tends to schedule for
further in the future than rAF would. And even then, it happens at a bad time
for the browser with regards to style changes.

Instead, use rAF, which typically executes earlier and at the point where the
browser is expecting style changes.

This makes top and bottom modules finish execution earlier by having their
styles applied sooner.

Change-Id: Ie4e7464aa811fa8ea4e4f115696f0bddbd28737b
resources/src/mediawiki/mediawiki.js