code: function (methodName) {
        var el = fabric.document.createElement('canvas');
  
        if (typeof G_vmlCanvasManager !== 'undefined') {
          G_vmlCanvasManager.initElement(el);
        }
        if (!el || !el.getContext) {
          return null;
        }
  
        var ctx = el.getContext('2d');
        if (!ctx) {
          return null;
        }
  
        switch (methodName) {
  
          case 'getImageData':
            return typeof ctx.getImageData !== 'undefined';
  
          case 'toDataURL':
            return typeof el.toDataURL !== 'undefined';
  
          case 'toDataURLWithQuality':
            try {
              el.toDataURL('image/jpeg', 0);
              return true;
            } catch (e) {
              return false;
            }
  
          default:
            return null;
        }
      }
docs: Provides a way to check support of some of the canvas methods
  (either those of HTMLCanvasElement itself, or rendering context)
  
  @method supports
  @param methodName {String} Method to check support for;
  Could be one of "getImageData", "toDataURL" or "toDataURLWithQuality"
  @return {Boolean | null} `true` if method is supported (or at least exists),
  `null` if canvas element or context can not be initialized