mirror of
https://github.com/niklasvh/html2canvas.git
synced 2023-08-10 21:13:10 +03:00
Use crossOrigin images when useCORS option set
This commit is contained in:
@@ -59,6 +59,10 @@ const testBase64 = (document: Document, src: string): Promise<boolean> => {
|
||||
});
|
||||
};
|
||||
|
||||
const testCORS = () => {
|
||||
return typeof new Image().crossOrigin !== 'undefined';
|
||||
};
|
||||
|
||||
const testSVG = document => {
|
||||
const img = new Image();
|
||||
const canvas = document.createElement('canvas');
|
||||
@@ -145,6 +149,13 @@ const FEATURES = {
|
||||
const value = testForeignObject(document);
|
||||
Object.defineProperty(FEATURES, 'SUPPORT_FOREIGNOBJECT_DRAWING', {value});
|
||||
return value;
|
||||
},
|
||||
// $FlowFixMe - get/set properties not yet supported
|
||||
get SUPPORT_CORS_IMAGES() {
|
||||
'use strict';
|
||||
const value = testCORS();
|
||||
Object.defineProperty(FEATURES, 'SUPPORT_CORS_IMAGES', {value});
|
||||
return value;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user