Remove Promise polyfill

This commit is contained in:
Niklas von Hertzen 2015-10-19 01:25:03 +03:00
parent 2a2ad9bb65
commit e88ac871a3
29 changed files with 14 additions and 23852 deletions

View File

@ -15,5 +15,5 @@
"globals": { "globals": {
"jQuery": true "jQuery": true
}, },
"predef": ["-Promise", "define"] "predef": ["Promise", "define"]
} }

4531
dist/html2canvas.js vendored

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

19271
dist/html2canvas.svg.js vendored

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -12,9 +12,6 @@
"engines": { "engines": {
"node": ">=0.10.0" "node": ">=0.10.0"
}, },
"dependencies": {
"es6-promise": "^2.0.1"
},
"repository": { "repository": {
"type": "git", "type": "git",
"url": "git@github.com:niklasvh/html2canvas.git" "url": "git@github.com:niklasvh/html2canvas.git"

View File

@ -20,7 +20,7 @@ The script is still in a **very experimental state**, so I don't recommend using
###Browser compatibility### ###Browser compatibility###
The script should work fine on the following browsers: The library should work fine on the following browsers (with `Promise` polyfill):
* Firefox 3.5+ * Firefox 3.5+
* Google Chrome * Google Chrome
@ -32,6 +32,10 @@ As each CSS property needs to be manually built to be supported, there are a num
### Usage ### ### Usage ###
The html2canvas library utilizes `Promise`s and expects them to be available in the global context. If you wish to
support [older browsers](http://caniuse.com/#search=promise) that do not natively support `Promise`s, please include a polyfill such as
[es6-promise](https://github.com/jakearchibald/es6-promise) before including `html2canvas`.
**Note!** These instructions are for using the current dev version of 0.5, for the latest release version (0.4.1), checkout the [old readme](https://github.com/niklasvh/html2canvas/blob/v0.4/readme.md). **Note!** These instructions are for using the current dev version of 0.5, for the latest release version (0.4.1), checkout the [old readme](https://github.com/niklasvh/html2canvas/blob/v0.4/readme.md).
To render an `element` with html2canvas, simply call: To render an `element` with html2canvas, simply call:

View File

@ -1,5 +1,4 @@
var log = require('./log'); var log = require('./log');
var Promise = require('./promise');
function restoreOwnerScroll(ownerDocument, x, y) { function restoreOwnerScroll(ownerDocument, x, y) {
if (ownerDocument.defaultView && (x !== ownerDocument.defaultView.pageXOffset || y !== ownerDocument.defaultView.pageYOffset)) { if (ownerDocument.defaultView && (x !== ownerDocument.defaultView.pageXOffset || y !== ownerDocument.defaultView.pageYOffset)) {

View File

@ -1,4 +1,3 @@
var Promise = require('./promise');
var Support = require('./support'); var Support = require('./support');
var CanvasRenderer = require('./renderers/canvas'); var CanvasRenderer = require('./renderers/canvas');
var ImageLoader = require('./imageloader'); var ImageLoader = require('./imageloader');
@ -51,7 +50,6 @@ function html2canvas(nodeList, options) {
}); });
} }
html2canvas.Promise = Promise;
html2canvas.CanvasRenderer = CanvasRenderer; html2canvas.CanvasRenderer = CanvasRenderer;
html2canvas.NodeContainer = NodeContainer; html2canvas.NodeContainer = NodeContainer;
html2canvas.log = log; html2canvas.log = log;

View File

@ -1,4 +1,3 @@
var Promise = require('./promise');
var log = require('./log'); var log = require('./log');
var smallImage = require('./utils').smallImage; var smallImage = require('./utils').smallImage;

View File

@ -1,5 +1,4 @@
var utils = require('./utils'); var utils = require('./utils');
var Promise = require('./promise');
var getBounds = utils.getBounds; var getBounds = utils.getBounds;
var loadUrlDocument = require('./proxy').loadUrlDocument; var loadUrlDocument = require('./proxy').loadUrlDocument;

View File

@ -1,5 +1,3 @@
var Promise = require('./promise');
function GradientContainer(imageData) { function GradientContainer(imageData) {
this.src = imageData.value; this.src = imageData.value;
this.colorStops = []; this.colorStops = [];

View File

@ -1,5 +1,3 @@
var Promise = require('./promise');
function ImageContainer(src, cors) { function ImageContainer(src, cors) {
this.src = src; this.src = src;
this.image = new Image(); this.image = new Image();

View File

@ -1,4 +1,3 @@
var Promise = require('./promise');
var log = require('./log'); var log = require('./log');
var ImageContainer = require('./imagecontainer'); var ImageContainer = require('./imagecontainer');
var DummyImageContainer = require('./dummyimagecontainer'); var DummyImageContainer = require('./dummyimagecontainer');

View File

@ -5,7 +5,6 @@ var TextContainer = require('./textcontainer');
var PseudoElementContainer = require('./pseudoelementcontainer'); var PseudoElementContainer = require('./pseudoelementcontainer');
var FontMetrics = require('./fontmetrics'); var FontMetrics = require('./fontmetrics');
var Color = require('./color'); var Color = require('./color');
var Promise = require('./promise');
var StackingContext = require('./stackingcontext'); var StackingContext = require('./stackingcontext');
var utils = require('./utils'); var utils = require('./utils');
var bind = utils.bind; var bind = utils.bind;

View File

@ -1 +0,0 @@
module.exports = require('es6-promise').Promise;

View File

@ -1,4 +1,3 @@
var Promise = require('./promise');
var XHR = require('./xhr'); var XHR = require('./xhr');
var utils = require('./utils'); var utils = require('./utils');
var log = require('./log'); var log = require('./log');

View File

@ -1,5 +1,4 @@
var ProxyURL = require('./proxy').ProxyURL; var ProxyURL = require('./proxy').ProxyURL;
var Promise = require('./promise');
function ProxyImageContainer(src, proxy) { function ProxyImageContainer(src, proxy) {
var link = document.createElement("a"); var link = document.createElement("a");

View File

@ -1,4 +1,3 @@
var Promise = require('./promise');
var XHR = require('./xhr'); var XHR = require('./xhr');
var decode64 = require('./utils').decode64; var decode64 = require('./utils').decode64;

View File

@ -1,5 +1,4 @@
var SVGContainer = require('./svgcontainer'); var SVGContainer = require('./svgcontainer');
var Promise = require('./promise');
function SVGNodeContainer(node, _native) { function SVGNodeContainer(node, _native) {
this.src = node; this.src = node;

View File

@ -1,5 +1,3 @@
var Promise = require('./promise');
function XHR(url) { function XHR(url) {
return new Promise(function(resolve, reject) { return new Promise(function(resolve, reject) {
var xhr = new XMLHttpRequest(); var xhr = new XMLHttpRequest();

View File

@ -3,6 +3,7 @@
<meta charset="utf-8"> <meta charset="utf-8">
<title>Mocha Tests</title> <title>Mocha Tests</title>
<link rel="stylesheet" href="lib/mocha.css" /> <link rel="stylesheet" href="lib/mocha.css" />
<script src="../../node_modules/bluebird/js/browser/bluebird.js"></script>
<script src="../../dist/html2canvas.js"></script> <script src="../../dist/html2canvas.js"></script>
<script src="../assets/jquery-1.6.2.js"></script> <script src="../assets/jquery-1.6.2.js"></script>
<script src="lib/expect.js"></script> <script src="lib/expect.js"></script>

View File

@ -3,6 +3,7 @@
<meta charset="utf-8"> <meta charset="utf-8">
<title>Mocha Tests</title> <title>Mocha Tests</title>
<link rel="stylesheet" href="lib/mocha.css" /> <link rel="stylesheet" href="lib/mocha.css" />
<script src="../../node_modules/bluebird/js/browser/bluebird.js"></script>
<script src="../../dist/html2canvas.js"></script> <script src="../../dist/html2canvas.js"></script>
<script src="../assets/jquery-1.6.2.js"></script> <script src="../assets/jquery-1.6.2.js"></script>
<script src="lib/expect.js"></script> <script src="lib/expect.js"></script>

View File

@ -3,6 +3,7 @@
<meta charset="utf-8"> <meta charset="utf-8">
<title>Mocha Tests</title> <title>Mocha Tests</title>
<link rel="stylesheet" href="lib/mocha.css" /> <link rel="stylesheet" href="lib/mocha.css" />
<script src="../../node_modules/bluebird/js/browser/bluebird.js"></script>
<script src="../../dist/html2canvas.js"></script> <script src="../../dist/html2canvas.js"></script>
<script src="../assets/jquery-1.6.2.js"></script> <script src="../assets/jquery-1.6.2.js"></script>
<script src="lib/expect.js"></script> <script src="lib/expect.js"></script>

View File

@ -4,6 +4,7 @@
<meta charset="UTF-8"> <meta charset="UTF-8">
<title>Proxy tests</title> <title>Proxy tests</title>
<link rel="stylesheet" href="lib/mocha.css" /> <link rel="stylesheet" href="lib/mocha.css" />
<script src="../../node_modules/bluebird/js/browser/bluebird.js"></script>
<script src="../assets/jquery-1.6.2.js"></script> <script src="../assets/jquery-1.6.2.js"></script>
<script src="lib/expect.js"></script> <script src="lib/expect.js"></script>
<script src="lib/mocha.js"></script> <script src="lib/mocha.js"></script>

View File

@ -3,6 +3,7 @@
<meta charset="utf-8"> <meta charset="utf-8">
<title>Mocha Tests</title> <title>Mocha Tests</title>
<link rel="stylesheet" href="lib/mocha.css" /> <link rel="stylesheet" href="lib/mocha.css" />
<script src="../../node_modules/bluebird/js/browser/bluebird.js"></script>
<script src="../../dist/html2canvas.js"></script> <script src="../../dist/html2canvas.js"></script>
<script src="../assets/jquery-1.6.2.js"></script> <script src="../assets/jquery-1.6.2.js"></script>
<script src="lib/expect.js"></script> <script src="lib/expect.js"></script>
@ -25,7 +26,6 @@
<div id="green-block"></div> <div id="green-block"></div>
<script>mocha.setup('bdd')</script> <script>mocha.setup('bdd')</script>
<script> <script>
var Promise = html2canvas.Promise;
describe("Multiple renders", function() { describe("Multiple renders", function() {
it("render correctly", function(done) { it("render correctly", function(done) {
this.timeout(10000); this.timeout(10000);

View File

@ -3,6 +3,7 @@
<meta charset="utf-8"> <meta charset="utf-8">
<title>Mocha Tests</title> <title>Mocha Tests</title>
<link rel="stylesheet" href="lib/mocha.css" /> <link rel="stylesheet" href="lib/mocha.css" />
<script src="../../node_modules/bluebird/js/browser/bluebird.js"></script>
<script src="../../dist/html2canvas.js"></script> <script src="../../dist/html2canvas.js"></script>
<script src="../assets/jquery-1.6.2.js"></script> <script src="../assets/jquery-1.6.2.js"></script>
<script src="lib/expect.js"></script> <script src="lib/expect.js"></script>
@ -23,7 +24,6 @@
<div style="background: red; width: 200px; height:200px;" id="block"></div> <div style="background: red; width: 200px; height:200px;" id="block"></div>
<div style="width: 200px; height:200px;" id="block2"></div> <div style="width: 200px; height:200px;" id="block2"></div>
<script> <script>
var Promise = html2canvas.Promise;
describe("options.onclone", function() { describe("options.onclone", function() {
it("with a function", function(done) { it("with a function", function(done) {
html2canvas(document.querySelector("#block"), {onclone: function(document) { html2canvas(document.querySelector("#block"), {onclone: function(document) {

View File

@ -4,6 +4,7 @@
<meta charset="UTF-8"> <meta charset="UTF-8">
<title>Scrolling tests</title> <title>Scrolling tests</title>
<link rel="stylesheet" href="lib/mocha.css" /> <link rel="stylesheet" href="lib/mocha.css" />
<script src="../../node_modules/bluebird/js/browser/bluebird.js"></script>
<script src="../../dist/html2canvas.js"></script> <script src="../../dist/html2canvas.js"></script>
<script src="../assets/jquery-1.6.2.js"></script> <script src="../assets/jquery-1.6.2.js"></script>
<script src="lib/expect.js"></script> <script src="lib/expect.js"></script>

View File

@ -4,10 +4,7 @@ var h2cSelector, h2cOptions;
document.write('<script type="text/javascript" src="' + src + '.js?' + Math.random() + '"></script>'); document.write('<script type="text/javascript" src="' + src + '.js?' + Math.random() + '"></script>');
} }
var sources = ['log', 'punycode/punycode', 'core', 'nodecontainer', 'pseudoelementcontainer', 'stackingcontext', 'textcontainer', 'support', 'imagecontainer', 'dummyimagecontainer', 'proxyimagecontainer', 'gradientcontainer', ['/node_modules/bluebird/js/browser/bluebird', '/tests/assets/jquery-1.6.2', '/dist/html2canvas'].forEach(appendScript);
'lineargradientcontainer', 'webkitgradientcontainer', 'svgcontainer', 'svgnodecontainer', 'imageloader', 'nodeparser', 'font', 'fontmetrics', 'renderer', 'promise', 'xhr', 'framecontainer', 'proxy', 'color', 'renderers/canvas'];
['/tests/assets/jquery-1.6.2', '/dist/html2canvas'].forEach(appendScript);
if (typeof(noFabric) === "undefined") { if (typeof(noFabric) === "undefined") {
appendScript('/dist/html2canvas.svg'); appendScript('/dist/html2canvas.svg');