UNPKG

modernizr

Version:

Modernizr is a JavaScript library that detects HTML5 and CSS3 features in the user’s browser.

21 lines (18 loc) 513 B
/*! { "name": "Canvas text", "property": "canvastext", "caniuse": "canvas-text", "tags": ["canvas", "graphics"], "polyfills": ["canvastext"] } !*/ /* DOC Detects support for the text APIs for `<canvas>` elements. */ define(['Modernizr', 'createElement', 'test/canvas'], function( Modernizr, createElement ) { Modernizr.addTest('canvastext', function() { if (Modernizr.canvas === false) return false; return typeof createElement('canvas').getContext('2d').fillText == 'function'; }); });