mirror of
https://github.com/niklasvh/html2canvas.git
synced 2023-08-10 21:13:10 +03:00
34 lines
985 B
JavaScript
34 lines
985 B
JavaScript
function Support() {
|
|
this.rangeBounds = this.testRangeBounds();
|
|
this.cors = this.testCORS();
|
|
}
|
|
|
|
Support.prototype.testRangeBounds = function() {
|
|
var range, testElement, rangeBounds, rangeHeight, support = false;
|
|
|
|
if (document.createRange) {
|
|
range = document.createRange();
|
|
if (range.getBoundingClientRect) {
|
|
testElement = document.createElement('boundtest');
|
|
testElement.style.height = "123px";
|
|
testElement.style.display = "block";
|
|
document.body.appendChild(testElement);
|
|
|
|
range.selectNode(testElement);
|
|
rangeBounds = range.getBoundingClientRect();
|
|
rangeHeight = rangeBounds.height;
|
|
|
|
if (rangeHeight === 123) {
|
|
support = true;
|
|
}
|
|
document.body.removeChild(testElement);
|
|
}
|
|
}
|
|
|
|
return support;
|
|
};
|
|
|
|
Support.prototype.testCORS = function() {
|
|
return typeof((new Image()).crossOrigin) !== "undefined";
|
|
};
|