Permalink
Browse files

Add test for canvas support so Vivid just displays the image in non s…

…upporting browsers.
  • Loading branch information...
1 parent 4ca23bf commit c6236e37865c8b129391d9e8d6c9406796ad62d6 @uxder committed Mar 2, 2012
Showing with 5 additions and 4 deletions.
  1. +5 −4 src/vivid.js
View
@@ -220,13 +220,14 @@ if ( typeof Object.create !== 'function' ) {
$.fn.vivid = function(options) {
//test for canvas support
- //TODO
- var noCanvasSupport = function() {
- return false;
+ //or is it best to have user test this with modernizr?
+ var canvasSupport = function() {
+ var elem = document.createElement('canvas');
+ return !!(elem.getContext && elem.getContext('2d'));
}
//check for canvas support
- if(noCanvasSupport()) return;
+ if(!canvasSupport()) return;
//create Vivid object
return this.each(function() {

0 comments on commit c6236e3

Please sign in to comment.