Use crossOrigin images when useCORS option set

This commit is contained in:
Niklas von Hertzen
2017-09-03 21:24:06 +08:00
parent c013e49192
commit 906a66eec7
2 changed files with 27 additions and 7 deletions

View File

@@ -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;
}
};