mirror of
https://github.com/niklasvh/html2canvas.git
synced 2023-08-10 21:13:10 +03:00
Remove Promise polyfill
This commit is contained in:
parent
2a2ad9bb65
commit
e88ac871a3
@ -15,5 +15,5 @@
|
|||||||
"globals": {
|
"globals": {
|
||||||
"jQuery": true
|
"jQuery": true
|
||||||
},
|
},
|
||||||
"predef": ["-Promise", "define"]
|
"predef": ["Promise", "define"]
|
||||||
}
|
}
|
||||||
|
4531
dist/html2canvas.js
vendored
4531
dist/html2canvas.js
vendored
File diff suppressed because it is too large
Load Diff
9
dist/html2canvas.min.js
vendored
9
dist/html2canvas.min.js
vendored
File diff suppressed because one or more lines are too long
19271
dist/html2canvas.svg.js
vendored
19271
dist/html2canvas.svg.js
vendored
File diff suppressed because it is too large
Load Diff
12
dist/html2canvas.svg.min.js
vendored
12
dist/html2canvas.svg.min.js
vendored
File diff suppressed because one or more lines are too long
@ -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"
|
||||||
|
@ -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:
|
||||||
|
@ -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)) {
|
||||||
|
@ -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;
|
||||||
|
@ -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;
|
||||||
|
|
||||||
|
@ -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;
|
||||||
|
|
||||||
|
@ -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 = [];
|
||||||
|
@ -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();
|
||||||
|
@ -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');
|
||||||
|
@ -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;
|
||||||
|
@ -1 +0,0 @@
|
|||||||
module.exports = require('es6-promise').Promise;
|
|
@ -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');
|
||||||
|
@ -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");
|
||||||
|
@ -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;
|
||||||
|
|
||||||
|
@ -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;
|
||||||
|
@ -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();
|
||||||
|
@ -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>
|
||||||
|
@ -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>
|
||||||
|
@ -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>
|
||||||
|
@ -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>
|
||||||
|
@ -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);
|
||||||
|
@ -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) {
|
||||||
|
@ -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>
|
||||||
|
@ -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');
|
||||||
|
Loading…
Reference in New Issue
Block a user