Fix initialization of wp-emoji in IE8.

Props pento, azaozz. Fixes #31701.

git-svn-id: https://develop.svn.wordpress.org/trunk@31898 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Ozz 2015-03-26 02:39:46 +00:00
parent 359ba47700
commit 2c2a69c2a7
1 changed files with 5 additions and 3 deletions

View File

@ -30,6 +30,8 @@
*/ */
replaceEmoji = false, replaceEmoji = false,
isIE8 = window.navigator.userAgent.indexOf( 'IE 8' ) !== -1,
// Private // Private
twemoji, timer, twemoji, timer,
count = 0; count = 0;
@ -46,7 +48,7 @@
return; return;
} }
// Still waiting. // Still waiting.
window.clearTimeout( timer ); window.clearTimeout( timer );
timer = window.setTimeout( load, 50 ); timer = window.setTimeout( load, 50 );
count++; count++;
@ -131,7 +133,7 @@
// Load when the readyState changes to 'interactive', not 'complete'. // Load when the readyState changes to 'interactive', not 'complete'.
function onLoad() { function onLoad() {
if ( 'interactive' === document.readyState ) { if ( ( ! isIE8 && 'interactive' === document.readyState ) || ( isIE8 && 'complete' === document.readyState ) ) {
load(); load();
} }
} }
@ -144,7 +146,7 @@
supportsFlagEmoji = window._wpemojiSettings.supports.flag; supportsFlagEmoji = window._wpemojiSettings.supports.flag;
replaceEmoji = ! supportsEmoji || ! supportsFlagEmoji; replaceEmoji = ! supportsEmoji || ! supportsFlagEmoji;
if ( 'loading' == document.readyState ) { if ( ( ! isIE8 && 'loading' === document.readyState ) || ( isIE8 && 'complete' !== document.readyState ) ) {
if ( document.addEventListener ) { if ( document.addEventListener ) {
document.addEventListener( 'readystatechange', onLoad, false ); document.addEventListener( 'readystatechange', onLoad, false );
} else if ( document.attachEvent ) { } else if ( document.attachEvent ) {