Ticket #37566: 37566.diff
| File 37566.diff, 2.4 KB (added by , 9 years ago) |
|---|
-
src/wp-includes/js/wp-emoji-loader.js
14 14 var canvas = document.createElement( 'canvas' ), 15 15 context = canvas.getContext && canvas.getContext( '2d' ), 16 16 stringFromCharCode = String.fromCharCode, 17 tonedata, tone, tone2;17 flag, flag2, tonedata, tone, tone2; 18 18 19 19 if ( ! context || ! context.fillText ) { 20 20 return false; … … 40 40 * to a larger image (4-5KB data URL). 41 41 */ 42 42 context.fillText( stringFromCharCode( 55356, 56806, 55356, 56826 ), 0, 0 ); 43 return canvas.toDataURL().length > 3000; 43 if ( canvas.toDataURL().length < 3000 ) { 44 return false; 45 } 46 47 context.clearRect( 0, 0, canvas.width, canvas.height ); 48 49 /* 50 * Test for rainbow flag compatibility. As the rainbow flag was added out of sequence with 51 * the usual Unicode release cycle, some browsers support it, and some don't, even if their 52 * Unicode support is up to date. 53 * 54 * To test for support, we try to render it, and compare the rendering to how it would look if 55 * the browser doesn't render it correctly (white flag emoji + rainbow emoji). 56 */ 57 context.fillText( stringFromCharCode( 55356, 57331, 65039, 8205, 55356, 57096 ), 0, 0 ); 58 flag = canvas.toDataURL(); 59 60 context.clearRect( 0, 0, canvas.width, canvas.height ); 61 62 context.fillText( stringFromCharCode( 55356, 57331, 55356, 57096 ), 0, 0 ); 63 flag2 = canvas.toDataURL(); 64 65 return flag !== flag2; 44 66 case 'diversity': 45 67 /* 46 68 * This tests if the browser supports the Emoji Diversity specification, by rendering an -
src/wp-includes/js/wp-emoji.js
180 180 return false; 181 181 } 182 182 183 if ( settings.supports.everythingExceptFlag && ! /^1f1(?:e[6-9a-f]|f[0-9a-f])-1f1(?:e[6-9a-f]|f[0-9a-f])$/.test( icon ) ) { 184 183 if ( settings.supports.everythingExceptFlag 184 && ! /^1f1(?:e[6-9a-f]|f[0-9a-f])-1f1(?:e[6-9a-f]|f[0-9a-f])$/.test( icon ) // Country flags 185 && ! /^(1f3f3-fe0f-200d-1f308|1f3f4-200d-2620-fe0f)$/.test( icon ) // Rainbow and pirate flags 186 ) { 185 187 return false; 186 188 } 187 189