mirror of
https://github.com/Modernizr/Modernizr.git
synced 2026-01-09 15:47:55 -05:00
* Move tests with storage tag into that subdirectory * Move tests with canvas tag into that subdirectory * Move tests with image tag into that subdirectory * Fix error * Fix typo * Move audio test into audio subdirectory * Move battery test into that subdirectory * Move canvas test into that subdirectory * Move video test into that subdirectory * Update dependencies * Move form and input tests into input subdirectory * Update dependencies again * Move webgl, svg and event tests into subdirectories * Update README
32 lines
868 B
JavaScript
32 lines
868 B
JavaScript
/*!
|
|
{
|
|
"name": "Emoji",
|
|
"property": "emoji"
|
|
}
|
|
!*/
|
|
/* DOC
|
|
Detects support for emoji character sets.
|
|
*/
|
|
define(['Modernizr', 'createElement', 'test/canvas/text'], function(Modernizr, createElement) {
|
|
Modernizr.addTest('emoji', function() {
|
|
if (!Modernizr.canvastext) {
|
|
return false;
|
|
}
|
|
var node = createElement('canvas');
|
|
var ctx = node.getContext('2d');
|
|
var backingStoreRatio =
|
|
ctx.webkitBackingStorePixelRatio ||
|
|
ctx.mozBackingStorePixelRatio ||
|
|
ctx.msBackingStorePixelRatio ||
|
|
ctx.oBackingStorePixelRatio ||
|
|
ctx.backingStorePixelRatio ||
|
|
1;
|
|
var offset = 12 * backingStoreRatio;
|
|
ctx.fillStyle = '#f00';
|
|
ctx.textBaseline = 'top';
|
|
ctx.font = '32px Arial';
|
|
ctx.fillText('\ud83d\udc28', 0, 0); // U+1F428 KOALA
|
|
return ctx.getImageData(offset, offset, 1, 1).data[0] !== 0;
|
|
});
|
|
});
|