diff --git a/src/components/img/img.ts b/src/components/img/img.ts
index 188b7e6bf6..226775d5a7 100644
--- a/src/components/img/img.ts
+++ b/src/components/img/img.ts
@@ -223,6 +223,7 @@ export class Img implements OnDestroy {
if (this._hasLoaded) {
console.debug(`render ${this._src} ${Date.now()}`);
this._isLoaded(true);
+ this._srcAttr(this._src);
}
});
}
@@ -243,10 +244,13 @@ export class Img implements OnDestroy {
* @internal
*/
_srcAttr(srcAttr: string) {
+ const imgEle = this._img;
const renderer = this._renderer;
- renderer.setElementAttribute(this._img, 'src', srcAttr);
- renderer.setElementAttribute(this._img, 'alt', this.alt);
+ if (imgEle.src !== srcAttr) {
+ renderer.setElementAttribute(this._img, 'src', srcAttr);
+ renderer.setElementAttribute(this._img, 'alt', this.alt);
+ }
}
/**
diff --git a/src/components/img/test/basic/app-module.ts b/src/components/img/test/basic/app-module.ts
index 988467d2c9..9c348e43f1 100644
--- a/src/components/img/test/basic/app-module.ts
+++ b/src/components/img/test/basic/app-module.ts
@@ -52,9 +52,7 @@ export class E2EApp {
MyImg
],
imports: [
- IonicModule.forRoot(E2EApp, {
- imgWorkerUrl: '/dist/e2e/workers/ion-img-worker.js'
- })
+ IonicModule.forRoot(E2EApp)
],
bootstrap: [IonicApp],
entryComponents: [
diff --git a/src/components/img/test/basic/main.html b/src/components/img/test/basic/main.html
index 135c793d8e..4244d64838 100644
--- a/src/components/img/test/basic/main.html
+++ b/src/components/img/test/basic/main.html
@@ -26,13 +26,13 @@
-
+
Loaded Avatar
-
+
@@ -68,13 +68,13 @@
-
+
Loaded Thumbnail
-
+
@@ -83,7 +83,7 @@
Default ion-img w/in content, display: inline-block.
-
+
has width, height and alt set.
diff --git a/src/components/img/test/cards/app-module.ts b/src/components/img/test/cards/app-module.ts
index ce6065c133..f57350ad6b 100644
--- a/src/components/img/test/cards/app-module.ts
+++ b/src/components/img/test/cards/app-module.ts
@@ -29,9 +29,7 @@ export class E2EApp {
E2EPage
],
imports: [
- IonicModule.forRoot(E2EApp, {
- imgWorkerUrl: '/dist/e2e/workers/ion-img-worker.js'
- })
+ IonicModule.forRoot(E2EApp)
],
bootstrap: [IonicApp],
entryComponents: [
diff --git a/src/components/img/test/cards/main.html b/src/components/img/test/cards/main.html
index 2837ede61a..437b8d68fe 100644
--- a/src/components/img/test/cards/main.html
+++ b/src/components/img/test/cards/main.html
@@ -15,22 +15,22 @@
-
+
Item thumbnail right
ion-img left
-
+
-
+
Item avatar left
ion-img right
Isn't it beautiful.
-
+
diff --git a/src/components/img/test/lazy-load/app-module.ts b/src/components/img/test/lazy-load/app-module.ts
index 5824c6c7b4..559813021d 100644
--- a/src/components/img/test/lazy-load/app-module.ts
+++ b/src/components/img/test/lazy-load/app-module.ts
@@ -24,9 +24,7 @@ export class E2EApp {
E2EPage
],
imports: [
- IonicModule.forRoot(E2EApp, {
- imgWorkerUrl: '/dist/e2e/workers/ion-img-worker.js'
- })
+ IonicModule.forRoot(E2EApp)
],
bootstrap: [IonicApp],
entryComponents: [
diff --git a/src/components/img/test/lazy-load/main.html b/src/components/img/test/lazy-load/main.html
index ff3b48c0a6..bc35900049 100644
--- a/src/components/img/test/lazy-load/main.html
+++ b/src/components/img/test/lazy-load/main.html
@@ -12,13 +12,13 @@
-
+
Thumbnail
-
+
@@ -26,13 +26,13 @@
-
+
Thumbnail
-
+
@@ -40,13 +40,13 @@
-
+
Thumbnail
-
+
@@ -54,13 +54,13 @@
-
+
Thumbnail
-
+
@@ -68,13 +68,13 @@
-
+
Thumbnail
-
+
@@ -82,13 +82,13 @@
-
+
Thumbnail
-
+
@@ -96,13 +96,13 @@
-
+
Thumbnail
-
+
@@ -110,13 +110,13 @@
-
+
Thumbnail
-
+
@@ -124,13 +124,13 @@
-
+
Thumbnail
-
+
@@ -138,13 +138,13 @@
-
+
Thumbnail
-
+
@@ -152,13 +152,13 @@
-
+
Thumbnail
-
+
@@ -166,13 +166,13 @@
-
+
Thumbnail
-
+
@@ -180,13 +180,13 @@
-
+
Thumbnail
-
+
@@ -194,13 +194,13 @@
-
+
Thumbnail
-
+
@@ -208,13 +208,13 @@
-
+
Thumbnail
-
+
@@ -222,13 +222,13 @@
-
+
Thumbnail
-
+
@@ -236,13 +236,13 @@
-
+
Thumbnail
-
+
@@ -250,13 +250,13 @@
-
+
Thumbnail
-
+
@@ -264,13 +264,13 @@
-
+
Thumbnail
-
+
@@ -278,13 +278,13 @@
-
+
Thumbnail
-
+
@@ -292,13 +292,13 @@
-
+
Thumbnail
-
+
@@ -306,13 +306,13 @@
-
+
Thumbnail
-
+
@@ -320,13 +320,13 @@
-
+
Thumbnail
-
+
@@ -334,13 +334,13 @@
-
+
Thumbnail
-
+
@@ -348,13 +348,13 @@
-
+
Thumbnail
-
+
@@ -362,13 +362,13 @@
-
+
Thumbnail
-
+
@@ -376,13 +376,13 @@
-
+
Thumbnail
-
+
@@ -390,13 +390,13 @@
-
+
Thumbnail
-
+
@@ -404,13 +404,13 @@
-
+
Thumbnail
-
+
@@ -418,13 +418,13 @@
-
+
Thumbnail
-
+
@@ -432,13 +432,13 @@
-
+
Thumbnail
-
+
@@ -446,13 +446,13 @@
-
+
Thumbnail
-
+
@@ -460,13 +460,13 @@
-
+
Thumbnail
-
+
@@ -474,13 +474,13 @@
-
+
Thumbnail
-
+
@@ -488,13 +488,13 @@
-
+
Thumbnail
-
+
@@ -502,13 +502,13 @@
-
+
Thumbnail
-
+
@@ -516,13 +516,13 @@
-
+
Thumbnail
-
+
@@ -530,13 +530,13 @@
-
+
Thumbnail
-
+
@@ -544,13 +544,13 @@
-
+
Thumbnail
-
+
@@ -558,13 +558,13 @@
-
+
Thumbnail
-
+
@@ -572,13 +572,13 @@
-
+
Thumbnail
-
+
@@ -586,13 +586,13 @@
-
+
Thumbnail
-
+
@@ -600,13 +600,13 @@
-
+
Thumbnail
-
+
@@ -614,13 +614,13 @@
-
+
Thumbnail
-
+
@@ -628,13 +628,13 @@
-
+
Thumbnail
-
+
@@ -642,13 +642,13 @@
-
+
Thumbnail
-
+
@@ -656,13 +656,13 @@
-
+
Thumbnail
-
+
@@ -670,13 +670,13 @@
-
+
Thumbnail
-
+
diff --git a/src/components/img/test/list/app-module.ts b/src/components/img/test/list/app-module.ts
index 06d4dc6539..7888131c82 100644
--- a/src/components/img/test/list/app-module.ts
+++ b/src/components/img/test/list/app-module.ts
@@ -35,7 +35,7 @@ const images = [
function getRandomImg(): string {
let imgString = images[Math.floor(Math.random() * images.length)];
- let src = '../img/img/' + imgString;
+ let src = '../img/' + imgString;
return src;
}
@@ -54,9 +54,7 @@ export class E2EApp {
E2EPage
],
imports: [
- IonicModule.forRoot(E2EApp, {
- imgWorkerUrl: '/dist/e2e/workers/ion-img-worker.js'
- })
+ IonicModule.forRoot(E2EApp)
],
bootstrap: [IonicApp],
entryComponents: [
diff --git a/src/components/virtual-scroll/test/basic/app-module.ts b/src/components/virtual-scroll/test/basic/app-module.ts
index 3d42edd9aa..2d9577471e 100644
--- a/src/components/virtual-scroll/test/basic/app-module.ts
+++ b/src/components/virtual-scroll/test/basic/app-module.ts
@@ -64,9 +64,7 @@ export class E2EApp {
E2EPage
],
imports: [
- IonicModule.forRoot(E2EApp, {
- imgWorkerUrl: '/dist/e2e/workers/ion-img-worker.js'
- })
+ IonicModule.forRoot(E2EApp)
],
bootstrap: [IonicApp],
entryComponents: [
diff --git a/src/components/virtual-scroll/test/cards/app-module.ts b/src/components/virtual-scroll/test/cards/app-module.ts
index 5b38682ce3..2c3da2d636 100644
--- a/src/components/virtual-scroll/test/cards/app-module.ts
+++ b/src/components/virtual-scroll/test/cards/app-module.ts
@@ -41,9 +41,7 @@ export class E2EApp {
E2EPage
],
imports: [
- IonicModule.forRoot(E2EApp, {
- imgWorkerUrl: '/dist/e2e/workers/ion-img-worker.js'
- })
+ IonicModule.forRoot(E2EApp)
],
bootstrap: [IonicApp],
entryComponents: [
@@ -69,7 +67,7 @@ const images = [
];
function getImgSrc() {
- let src = `../../img/img/${images[rotateImg]}.jpg?${Math.round(Math.random() * 10000000)}`;
+ let src = `../img/${images[rotateImg]}.jpg?${Math.round(Math.random() * 10000000)}`;
rotateImg++;
if (rotateImg === images.length) rotateImg = 0;
return src;
diff --git a/src/components/virtual-scroll/test/image-gallery/app-module.ts b/src/components/virtual-scroll/test/image-gallery/app-module.ts
index 8d844d5659..80497b6b6b 100644
--- a/src/components/virtual-scroll/test/image-gallery/app-module.ts
+++ b/src/components/virtual-scroll/test/image-gallery/app-module.ts
@@ -87,9 +87,7 @@ export class E2EApp {
E2EPage
],
imports: [
- IonicModule.forRoot(E2EApp, {
- imgWorkerUrl: '/dist/e2e/workers/ion-img-worker.js'
- })
+ IonicModule.forRoot(E2EApp)
],
bootstrap: [IonicApp],
entryComponents: [
diff --git a/src/components/virtual-scroll/test/list/app-module.ts b/src/components/virtual-scroll/test/list/app-module.ts
index 1eba0fcba1..e3c5e93524 100644
--- a/src/components/virtual-scroll/test/list/app-module.ts
+++ b/src/components/virtual-scroll/test/list/app-module.ts
@@ -116,9 +116,7 @@ export class E2EApp {
E2EPage
],
imports: [
- IonicModule.forRoot(E2EApp, {
- imgWorkerUrl: '/dist/e2e/workers/ion-img-worker.js'
- })
+ IonicModule.forRoot(E2EApp)
],
bootstrap: [IonicApp],
entryComponents: [