-
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
Revert "⏪ Revert "♻️ Support img element (#34028)"" #34630
Conversation
This pull request introduces 1 alert when merging 80274dc into 63d8ca9 - view on LGTM.com new alerts:
|
This pull request introduces 1 alert when merging be10828 into 36c4832 - view on LGTM.com new alerts:
|
This pull request introduces 1 alert when merging 2e976b4 into 9d449c9 - view on LGTM.com new alerts:
|
This pull request introduces 1 alert when merging d33e5b4 into b5d55ee - view on LGTM.com new alerts:
|
This pull request introduces 1 alert when merging 1d1da19 into 1d3757a - view on LGTM.com new alerts:
|
Hey @alanorozco! These files were changed:
Hey @gmajoulet, @newmuis! These files were changed:
Hey @jridgewell! These files were changed:
|
Ready for review, additional change for supporting |
test/unit/test-amp-img.js
Outdated
@@ -406,7 +407,10 @@ describes.sandboxed('amp-img', {}, (env) => { | |||
el.getLayoutSize = () => ({width: 300, height: 200}); | |||
|
|||
const impl = new AmpImg(el); | |||
const propagateAttributesSpy = sandbox.spy(impl, 'propagateAttributes'); | |||
const propagateAttributesSpy = sandbox.spy( |
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.
I know this is how the code was beforehand, but it seems like instead of testing that this helper is called we should directly test that the expected attributes were propagated.
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.
That's a really good point. I'll switch this over.
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.
Unfortunately this test ensures the order of attributes being propagated, and ensures src
is last or double downloads can occur in Webkit.
I'll see if I can come up with a different method of verification.
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.
Perhaps instead spy on the element itself a la something like env.spy(impl.element, 'setAttribute')
?
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.
That is better than the change I made (validated order of attributes to propagate).
This pull request introduces 1 alert when merging e48ab85 into 3fe7dcb - view on LGTM.com new alerts:
|
…attributes helper
This pull request introduces 1 alert when merging 1dcc3fc into 3fe7dcb - view on LGTM.com new alerts:
|
This pull request introduces 1 alert when merging 115d045 into e734418 - view on LGTM.com new alerts:
|
This pull request introduces 1 alert when merging 85a1676 into 2ee75c4 - view on LGTM.com new alerts:
|
This pull request introduces 1 alert when merging 05d435f into 01e11e4 - view on LGTM.com new alerts:
|
This pull request introduces 1 alert when merging 4eab890 into cd94152 - view on LGTM.com new alerts:
|
@@ -1250,6 +1263,10 @@ export class AmpLightboxGallery extends AMP.BaseElement { | |||
closeGallery_() { | |||
return this.mutateElement(() => { | |||
this.container_.removeAttribute('gallery-view'); | |||
Services.ownersForDoc(this.element)./*OK*/ scheduleUnlayout( |
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.
nit: This is done 4x in this class, make it a helper
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.
Agreed, but would prefer in a different PR.
There are lots of examples of where this extension is breaking rules and I am fearful of making significant changes without:
- Better tests
- More consideration of what the implementation should own.
This pull request introduces 1 alert when merging 598d63f into cd94152 - view on LGTM.com new alerts:
|
@kristoferbaxter Felt bad about constantly torpedoing this PR with my core PRs, so I resolved the conflicts introduced by #34818 since I figured it would be easier for me to do anyway |
Thanks @rcebulko! Appreciate it. Also, no worries about the conflicts... happy to see the changes you're working on landing cleanly! |
This pull request introduces 1 alert when merging 0d0348b into 6efb0c0 - view on LGTM.com new alerts:
|
@@ -936,6 +938,13 @@ export class AmpLightboxGallery extends AMP.BaseElement { | |||
}; | |||
|
|||
const mutate = () => { | |||
if (enter) { | |||
Services.ownersForDoc(this.element)./*OK*/ scheduleUnlayout( |
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.
Can you comment why you're calling unlayout
when you're entering? Shouldn't this have been called when we closed the lightbox?
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 call, this implementation doesn't appear to clean up after itself well.
This pull request introduces 1 alert when merging 9057386 into bafe128 - view on LGTM.com new alerts:
|
This pull request introduces 1 alert when merging d94dbe0 into 1f2308b - view on LGTM.com new alerts:
|
// remove it from DOM. | ||
if (!candidate.signals().get(CommonSignals.LOAD_END)) { | ||
if ( | ||
!candidate.tagName === 'IMG' && |
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.
This looks like a bug
!candidate.tagName === 'IMG' && | |
candidate.tagName !== 'IMG' && |
This pull request introduces 1 alert when merging 184ccf3 into 7702194 - view on LGTM.com new alerts:
|
Let's hope the night metrics don't have another fun discovery awaiting us! |
Reverts #34589