emoji.js 470 B

1234567891011
  1. // Requires a Modernizr build with `canvastext` included
  2. // http://www.modernizr.com/download/#-canvas-canvastext
  3. Modernizr.addTest('emoji', function() {
  4. if (!Modernizr.canvastext) return false;
  5. var node = document.createElement('canvas'),
  6. ctx = node.getContext('2d');
  7. ctx.textBaseline = 'top';
  8. ctx.font = '32px Arial';
  9. ctx.fillText('\ud83d\ude03', 0, 0); // "smiling face with open mouth" emoji
  10. return ctx.getImageData(16, 16, 1, 1).data[0] !== 0;
  11. });