-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unload resources in carousel #2123
Conversation
d75a1fd
to
7eda331
Compare
@dvoytenko mind giving this a first, pass. super preliminary work. just want to make sure im in the right direction. |
3386f97
to
ae9f721
Compare
// when you null out an img tags src and you read it, it will be | ||
// window.location.origin + window.location.path so we need | ||
// to compare to the previously selected "src" above. | ||
if (this.img_.src == '' || this.img_.src != src) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use img.getAttribute('src')
instead.
img.src = '';
img.src; // => `${location.origin}${location.path}`
img.getAttribute('src'); // => ''
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good fix, thanks!
7ca7d81
to
33d0b69
Compare
this.loadPromise_ = loadPromise(this.img_); | ||
this.loadPromise_ = loadPromise(this.img_) | ||
.catch(error => { | ||
if (this.img_.getAttribute('src')) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You mean !this.img_.getAttribute('src')
, right? If src
was cleared, means that we expect the error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yep, sorry just made the change hastily here and just havent pushed out latest changes with tests.
will mark done when ive pushed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.
Made few comments. Generally, it's very close. Please add tests. |
947fc82
to
12406a6
Compare
@dvoytenko please review. should be finalized now. i still need to add more tests, but everything on amp-carousel integration tests are failing for me locally currently...trying to figure that out. |
12406a6
to
42b9d6d
Compare
@dvoytenko friendly ping. would like to wrap this up by EOB (yes eob!) |
|
||
describe('integration amp-carousel', () => { | ||
|
||
let fixture; | ||
//let sandbox; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comments. 😛
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
haha yeah, meant to leave it in intentionally. as my tests are all red locally for carousels. will remove and move it over to a different branch.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed.
LGTM |
42b9d6d
to
4156069
Compare
4156069
to
ba33ca2
Compare
Unload resources in carousel
closes #1293
closes #1334