From 14338a95591b30da732011c16582015746097715 Mon Sep 17 00:00:00 2001 From: Ross Wilson Date: Wed, 16 Apr 2014 13:03:02 -0600 Subject: [PATCH 1/3] Fix for #1237 Only set crossorigin on the element if something is specified --- src/shapes/image.class.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/shapes/image.class.js b/src/shapes/image.class.js index 89e09a22..c61d0d7a 100644 --- a/src/shapes/image.class.js +++ b/src/shapes/image.class.js @@ -374,7 +374,7 @@ options || (options = { }); this.setOptions(options); this._setWidthHeight(options); - if (this._element) { + if (this._element && this.crossOrigin) { this._element.crossOrigin = this.crossOrigin; } }, From 89f784d27fc593388d0ac0ed5f5c022da90923bf Mon Sep 17 00:00:00 2001 From: Ross Wilson Date: Mon, 21 Apr 2014 11:13:26 -0600 Subject: [PATCH 2/3] Update test for fix of #1237 --- test/unit/image.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/unit/image.js b/test/unit/image.js index bc412498..333f87c0 100644 --- a/test/unit/image.js +++ b/test/unit/image.js @@ -161,8 +161,9 @@ equal(objRepr.crossOrigin, '', 'toObject should return proper crossOrigin value'); var elImage2 = _createImageElement(); + elImage2.crossOrigin = 'anonymous'; image.setElement(elImage2); - equal(elImage2.crossOrigin, '', 'setElement should set proper crossOrigin on an img element'); + equal(elImage2.crossOrigin, 'anonymous', 'setElement should set proper crossOrigin on an img element'); // fromObject doesn't work on Node :/ if (fabric.isLikelyNode) { From 2c8641ff6d301fe71904f2461d091dd785865990 Mon Sep 17 00:00:00 2001 From: Ross Wilson Date: Mon, 21 Apr 2014 11:29:18 -0600 Subject: [PATCH 3/3] test build --- test/unit/image.js | 1 + 1 file changed, 1 insertion(+) diff --git a/test/unit/image.js b/test/unit/image.js index 333f87c0..24134a58 100644 --- a/test/unit/image.js +++ b/test/unit/image.js @@ -170,6 +170,7 @@ start(); return; } + fabric.Image.fromObject(objRepr, function(img) { equal(img.crossOrigin, ''); start();