Move non-canvas supported fallback to seperate file

This commit is contained in:
Niklas von Hertzen 2014-03-15 13:22:55 +02:00
parent 81c22866bc
commit b35fcaeaf9
5 changed files with 53 additions and 26 deletions

View File

@ -21,7 +21,7 @@ module.exports = function(grunt) {
concat: {
dist: {
src: [
'src/promise.js', 'src/**/*.js'
'src/promise.js', 'src/fallback.js', 'src/**/*.js'
],
dest: 'build/<%= pkg.name %>.js'
},

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,12 +1,5 @@
var html2canvasNodeAttribute = "data-html2canvas-node";
if (typeof(Object.create) !== "function" || typeof(document.createElement("canvas").getContext) !== "function") {
window.html2canvas = function() {
return Promise.reject("No canvas support");
};
return;
}
window.html2canvas = function(nodeList, options) {
options = options || {};
if (options.logging) {

6
src/fallback.js Normal file
View File

@ -0,0 +1,6 @@
if (typeof(Object.create) !== "function" || typeof(document.createElement("canvas").getContext) !== "function") {
window.html2canvas = function() {
return Promise.reject("No canvas support");
};
return;
}