Changeset 40582
- Timestamp:
- 05/08/2017 05:00:29 AM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/js/wp-emoji-loader.js
r38869 r40582 40 40 case 'flag': 41 41 /* 42 * This works because the image will be one of three things: 43 * - Two empty squares, if the browser doesn't render emoji 44 * - Two squares with 'U' and 'N' in them, if the browser doesn't render flag emoji 45 * - The United Nations flag 42 * Test for UN flag compatibility. This is the least supported of the letter locale flags, 43 * so gives us an easy test for full support. 46 44 * 47 * T he first two will encode to small images (1-2KB data URLs), the third will encode48 * t o a larger image (4-5KB data URL).45 * To test for support, we try to render it, and compare the rendering to how it would look if 46 * the browser doesn't render it correctly ([U] + [N]). 49 47 */ 50 48 context.fillText( stringFromCharCode( 55356, 56826, 55356, 56819 ), 0, 0 ); 51 if ( canvas.toDataURL().length < 3000 ) { 49 flag = canvas.toDataURL(); 50 51 context.clearRect( 0, 0, canvas.width, canvas.height ); 52 53 // Add a zero width space between the characters, to force rendering as characters. 54 context.fillText( stringFromCharCode( 55356, 57331, 8203, 55356, 57096 ), 0, 0 ); 55 flag2 = canvas.toDataURL(); 56 57 if ( flag !== flag2 ) { 52 58 return false; 53 59 } 54 55 context.clearRect( 0, 0, canvas.width, canvas.height );56 60 57 61 /*
Note: See TracChangeset
for help on using the changeset viewer.