diff --git a/src/wp-includes/js/wp-emoji-loader.js b/src/wp-includes/js/wp-emoji-loader.js index 015ebc9125..ea8ad8209a 100755 --- a/src/wp-includes/js/wp-emoji-loader.js +++ b/src/wp-includes/js/wp-emoji-loader.js @@ -14,7 +14,7 @@ var canvas = document.createElement( 'canvas' ), context = canvas.getContext && canvas.getContext( '2d' ), stringFromCharCode = String.fromCharCode, - tone; + tonedata, tone, tone2; if ( ! context || ! context.fillText ) { return false; @@ -48,10 +48,15 @@ * compares if the emoji rendering has changed. */ context.fillText( stringFromCharCode( 55356, 57221 ), 0, 0 ); - tone = context.getImageData( 16, 16, 1, 1 ).data.toString(); + tonedata = context.getImageData( 16, 16, 1, 1 ).data; + context.fillText( stringFromCharCode( 55356, 57221, 55356, 57343 ), 0, 0 ); - // Chrome has issues comparing arrays, so we compare it as a string, instead. - return tone !== context.getImageData( 16, 16, 1, 1 ).data.toString(); + // Chrome has issues comparing arrays, and Safari has issues converting arrays to strings. + // So, we create our own string and compare that, instead. + tonedata = context.getImageData( 16, 16, 1, 1 ).data; + tone2 = tonedata[0] + ',' + tonedata[1] + ',' + tonedata[2] + ',' + tonedata[3]; + + return tone !== tone2; case 'simple': /* * This creates a smiling emoji, and checks to see if there is any image data in the