Santhosh has uploaded a new change for review. https://gerrit.wikimedia.org/r/107028
Change subject: Wait till rendering thread completion before applying webfonts ...................................................................... Wait till rendering thread completion before applying webfonts So that the fontfamily values are always 'seen' by the webfonts jquery plugin. Missing this was causing incorrect behavior -overriding the fontfamiliy from css- in random cases. Bug: 59958 Change-Id: I2da436caa618bc2318e20e3c0492a6bf1c03e162 --- M resources/js/ext.uls.webfonts.js 1 file changed, 15 insertions(+), 8 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/UniversalLanguageSelector refs/changes/28/107028/1 diff --git a/resources/js/ext.uls.webfonts.js b/resources/js/ext.uls.webfonts.js index 03e1c32..1db31a0 100644 --- a/resources/js/ext.uls.webfonts.js +++ b/resources/js/ext.uls.webfonts.js @@ -84,14 +84,21 @@ return excludes; }() ) } ); - $( 'body' ).webfonts(); - // Load the css required for Autonym font. Note that this wont download the font. - // Browsers are smart enough to delay it till some element with this font-family - // become visible. For eg: If there is a popup div with an element with class - // 'autonym', without explicitly calling .webfonts() on it, Autonym font will not - // be applied in general. But we ensure that css is ready so that automatically - // the font get applied to such future elements. - $( 'body' ).data( 'webfonts' ).load( 'Autonym' ); + + setTimeout( function() { + // Pause the JavaScript execution to let the rendering threads catch up. + // This is important because webfonts behaviour depends on the fontfamily + // attribute values set by stylesheets. + $( 'body' ).webfonts(); + + // Load the css required for Autonym font. Note that this wont download the font. + // Browsers are smart enough to delay it till some element with this font-family + // become visible. For eg: If there is a popup div with an element with class + // 'autonym', without explicitly calling .webfonts() on it, Autonym font will not + // be applied in general. But we ensure that css is ready so that automatically + // the font get applied to such future elements. + $( 'body' ).data( 'webfonts' ).load( 'Autonym' ); + }, 0 ); }; $( document ).ready( function () { -- To view, visit https://gerrit.wikimedia.org/r/107028 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I2da436caa618bc2318e20e3c0492a6bf1c03e162 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/UniversalLanguageSelector Gerrit-Branch: master Gerrit-Owner: Santhosh <santhosh.thottin...@gmail.com> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits