- Timestamp:
- 01/03/2016 04:25:52 AM (9 years ago)
- Location:
- trunk/src/wp-includes/js
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/js/wp-emoji-loader.js
r35606 r36160 13 13 function browserSupportsEmoji( type ) { 14 14 var canvas = document.createElement( 'canvas' ), 15 context = canvas.getContext && canvas.getContext( '2d' ); 15 context = canvas.getContext && canvas.getContext( '2d' ), 16 tone; 16 17 17 18 if ( ! context || ! context.fillText ) { … … 39 40 context.fillText( String.fromCharCode( 55356, 56806, 55356, 56826 ), 0, 0 ); 40 41 return canvas.toDataURL().length > 3000; 42 } else if ( 'diversity' === type ) { 43 /* 44 * This tests if the browser supports the Emoji Diversity specification, by rendering an 45 * emoji with no skin tone specified (in this case, Santa). It then adds a skin tone, and 46 * compares if the emoji rendering has changed. 47 */ 48 context.fillText( String.fromCharCode( 55356, 57221 ), 0, 0 ); 49 tone = context.getImageData( 16, 16, 1, 1 ).data.toString(); 50 context.fillText( String.fromCharCode( 55356, 57221, 55356, 57343 ), 0, 0 ); 51 // Chrome has issues comparing arrays, so we compare it as a string, instead. 52 return tone !== context.getImageData( 16, 16, 1, 1 ).data.toString(); 41 53 } else { 42 54 if ( 'simple' === type ) { … … 67 79 68 80 settings.supports = { 69 simple: browserSupportsEmoji( 'simple' ), 70 flag: browserSupportsEmoji( 'flag' ), 71 unicode8: browserSupportsEmoji( 'unicode8' ) 81 simple: browserSupportsEmoji( 'simple' ), 82 flag: browserSupportsEmoji( 'flag' ), 83 unicode8: browserSupportsEmoji( 'unicode8' ), 84 diversity: browserSupportsEmoji( 'diversity' ) 72 85 }; 73 86 … … 77 90 }; 78 91 79 if ( ! settings.supports.simple || ! settings.supports.flag || ! settings.supports.unicode8 ) {92 if ( ! settings.supports.simple || ! settings.supports.flag || ! settings.supports.unicode8 || ! settings.supports.diversity ) { 80 93 ready = function() { 81 94 settings.readyCallback(); -
trunk/src/wp-includes/js/wp-emoji.js
r35637 r36160 150 150 } 151 151 152 if ( ! settings.supports.flag && settings.supports.simple && settings.supports.unicode8 && 152 if ( ! settings.supports.flag && settings.supports.simple && settings.supports.unicode8 && settings.supports.diversity && 153 153 ! /^1f1(?:e[6-9a-f]|f[0-9a-f])-1f1(?:e[6-9a-f]|f[0-9a-f])$/.test( icon ) ) { 154 154 … … 179 179 */ 180 180 if ( settings ) { 181 replaceEmoji = ! settings.supports.simple || ! settings.supports.flag || ! settings.supports.unicode8 ;181 replaceEmoji = ! settings.supports.simple || ! settings.supports.flag || ! settings.supports.unicode8 || ! settings.supports.diversity; 182 182 183 183 if ( settings.DOMReady ) {
Note: See TracChangeset
for help on using the changeset viewer.