Skip to content

Commit

Permalink
fix: lazy loading (ng-defer-load) works in chromium only on block-ele…
Browse files Browse the repository at this point in the history
…ments (#28)

closes #28
  • Loading branch information
Sebastian-Haehnlein authored and shauke committed Dec 2, 2019
1 parent 1c3ab46 commit cba69a9
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<span (deferLoad)="showImage = true">
<div (deferLoad)="showImage = true">
<img *ngIf="showImage" [src]="categoryImageUrl" itemprop="image" />
</span>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@
</ng-container>

<ng-template #image>
<span (deferLoad)="showImage = true">
<div (deferLoad)="showImage = true">
<img
*ngIf="showImage"
[src]="pagelet.stringParam('Image')"
[attr.alt]="pagelet.stringParam('AlternateText')"
[ngClass]="pagelet.stringParam('CSSClass')"
/>
</span>
</div>
</ng-template>

<!-- TODO: (CMS Component Configuration)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,13 @@ describe('Cms Image Component', () => {
expect(() => fixture.detectChanges()).not.toThrow();
expect(element).toMatchInlineSnapshot(`
<a class="teaser-link" href="http://example.com" title="bar"
><span
><img
><div>
<img
class="foo"
ng-reflect-ng-class="foo"
src="http://example.com/foo/bar.png"
alt="foo"/></span
alt="foo"
/></div
></a>
`);
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<span (deferLoad)="showImage = true">
<div (deferLoad)="showImage = true">
<img
*ngIf="showImage"
[src]="imageSourceUrl()"
Expand All @@ -10,4 +10,4 @@
[attr.alt]="getImgAltText()"
itemprop="image"
/>
</span>
</div>

0 comments on commit cba69a9

Please sign in to comment.