mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-03-18 07:50:22 +00:00
Current implementation of ngSrc may lead to empty src attribute when page is loading.
For example:
<img ng-src="{{image.url}}">
can be temporarily rendered as
<img src="">
before the image resource is loaded.
Some browser emits a request to the current page when seeing <img src=""> (Firefox13 and IE8 will, Chromium20 won't), which leads to performance problems.
17 lines
432 B
JavaScript
17 lines
432 B
JavaScript
'use strict';
|
|
|
|
describe('ngSrc', function() {
|
|
var element;
|
|
|
|
afterEach(function() {
|
|
dealoc(element);
|
|
});
|
|
|
|
it('should not result empty string in img src', inject(function($rootScope, $compile) {
|
|
$rootScope.image = {};
|
|
element = $compile('<img ng-src="{{image.url}}">')($rootScope);
|
|
$rootScope.$digest();
|
|
expect(element.attr('src')).not.toBe('');
|
|
expect(element.attr('src')).toBe(undefined);
|
|
}));
|
|
});
|