-
Notifications
You must be signed in to change notification settings - Fork 27.4k
With AngularJS 1.7 the data-src attribute of an image gets automatically replaced #16734
With AngularJS 1.7 the data-src attribute of an image gets automatically replaced #16734
Comments
@petebacondarwin you sure it was dedb10c not something earlier like 1e9eadc? From a quick test the plnkr seems to still have the issue when changing to v1.7.0 but not v1.6.10... (either way I'm interested in investigating more). From my initial investigation... seems like we're settings 2 $interpolate watchers on the I'm pretty sure we shouldn't even be creating that interpolate directive since there's no interpolation in those attributes. But the |
Oops. yes it was not your commit @jbedard ! It is a problem with 1.7.0.rc.0 too. |
I agree we should not have a directive on a non-interpolated attribute. |
By creating attribute directives that watch the value of media url attributes (e.g. `img[src]`) we caused a conflict when both `src` and `data-src` were appearing on the same element. As each directive was trying to write to the attributes on the element, where AngularJS treats `src` and `data-src` as synonymous. This commit ensures that we do not create watchers when the media url attribute is a constant (no interpolation). Fixes #16734
Hopefully #16737 will fix this |
By creating attribute directives that watch the value of media url attributes (e.g. `img[src]`) we caused a conflict when both `src` and `data-src` were appearing on the same element. As each directive was trying to write to the attributes on the element, where AngularJS treats `src` and `data-src` as synonymous. This commit ensures that we do not create create such directives when the media url attribute is a constant (no interpolation). Because of this (and because we no longer sanitize URLs in the `$attr.$set()` method, this commit also updates `ngHref` and `ngSrc` to do a preliminary sanitization of URLs in case there is no interpolation in the attribute value. Fixes angular#16734
…ributes By creating attribute directives that watch the value of media url attributes (e.g. `img[src]`) we caused a conflict when both `src` and `data-src` were appearing on the same element. As each directive was trying to write to the attributes on the element, where AngularJS treats `src` and `data-src` as synonymous. This commit ensures that we do not create create such directives when the media url attribute is a constant (no interpolation). Because of this (and because we no longer sanitize URLs in the `$attr.$set()` method, this commit also updates `ngHref` and `ngSrc` to do a preliminary sanitization of URLs in case there is no interpolation in the attribute value. Fixes angular#16734
…ributes By creating attribute directives that watch the value of media url attributes (e.g. `img[src]`) we caused a conflict when both `src` and `data-src` were appearing on the same element. As each directive was trying to write to the attributes on the element, where AngularJS treats `src` and `data-src` as synonymous. This commit ensures that we do not create create such directives when the media url attribute is a constant (no interpolation). Because of this (and because we no longer sanitize URLs in the `$attr.$set()` method, this commit also updates `ngHref` and `ngSrc` to do a preliminary sanitization of URLs in case there is no interpolation in the attribute value. Fixes angular#16734
It looks like this is also causing issues with Is it possible to have an official release with this fix in? I've temporarily patched in the change from the PR and it has fixed the problem for me. |
Thanks for testing with your scenario. We should be able to merge this soon and hopefully have a new release out early next week. |
…ributes By creating attribute directives that watch the value of media url attributes (e.g. `img[src]`) we caused a conflict when both `src` and `data-src` were appearing on the same element. As each directive was trying to write to the attributes on the element, where AngularJS treats `src` and `data-src` as synonymous. This commit ensures that we do not create create such directives when the media url attribute is a constant (no interpolation). Because of this (and because we no longer sanitize URLs in the `$attr.$set()` method, this commit also updates `ngHref` and `ngSrc` to do a preliminary sanitization of URLs in case there is no interpolation in the attribute value. Fixes #16734
…ributes By creating attribute directives that watch the value of media url attributes (e.g. `img[src]`) we caused a conflict when both `src` and `data-src` were appearing on the same element. As each directive was trying to write to the attributes on the element, where AngularJS treats `src` and `data-src` as synonymous. This commit ensures that we do not create create such directives when the media url attribute is a constant (no interpolation). Because of this (and because we no longer sanitize URLs in the `$attr.$set()` method, this commit also updates `ngHref` and `ngSrc` to do a preliminary sanitization of URLs in case there is no interpolation in the attribute value. Fixes #16734
I'm submitting a ...
Current behavior:
The
data-src
attribute of an image gets replaced with the value of thesrc
attributeExpected:
The
data-src
attribute contains the original value.As the image is plain HTML, and has no obvious directives bound to it, I would expect that nothing is changed for this element. With version 1.7 this somehow changed.
Steps to reproduce
See Plunker (http://plnkr.co/edit/bpouxUmsXretMfcb)
AngularJS version: 1.7.x
Browser: all
The text was updated successfully, but these errors were encountered: