Skip to content
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

Merged
merged 23 commits into from
Jun 16, 2021

Conversation

kristoferbaxter
Copy link
Contributor

Reverts #34589

@lgtm-com
Copy link

lgtm-com bot commented Jun 1, 2021

This pull request introduces 1 alert when merging 80274dc into 63d8ca9 - view on LGTM.com

new alerts:

  • 1 for Comparison between inconvertible types

@lgtm-com
Copy link

lgtm-com bot commented Jun 2, 2021

This pull request introduces 1 alert when merging be10828 into 36c4832 - view on LGTM.com

new alerts:

  • 1 for Comparison between inconvertible types

@lgtm-com
Copy link

lgtm-com bot commented Jun 2, 2021

This pull request introduces 1 alert when merging 2e976b4 into 9d449c9 - view on LGTM.com

new alerts:

  • 1 for Comparison between inconvertible types

@lgtm-com
Copy link

lgtm-com bot commented Jun 2, 2021

This pull request introduces 1 alert when merging d33e5b4 into b5d55ee - view on LGTM.com

new alerts:

  • 1 for Comparison between inconvertible types

@lgtm-com
Copy link

lgtm-com bot commented Jun 4, 2021

This pull request introduces 1 alert when merging 1d1da19 into 1d3757a - view on LGTM.com

new alerts:

  • 1 for Comparison between inconvertible types

@kristoferbaxter kristoferbaxter marked this pull request as ready for review June 4, 2021 20:50
@kristoferbaxter kristoferbaxter requested a review from rcebulko June 4, 2021 20:51
@amp-owners-bot
Copy link

amp-owners-bot bot commented Jun 4, 2021

Hey @alanorozco! These files were changed:

extensions/amp-brid-player/0.1/amp-brid-player.js
extensions/amp-kaltura-player/0.1/amp-kaltura-player.js
extensions/amp-springboard-player/0.1/amp-springboard-player.js
extensions/amp-viqeo-player/0.1/amp-viqeo-player.js

Hey @gmajoulet, @newmuis! These files were changed:

extensions/amp-story/1.0/amp-story-page.js

Hey @jridgewell! These files were changed:

src/core/dom/propagate-attributes.js

@kristoferbaxter
Copy link
Contributor Author

Ready for review, additional change for supporting img filters amp-img>img from most auto upgrade paths, allowing previous behaviour on amp-img to remain untouched.

@@ -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(
Copy link
Contributor

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.

Copy link
Contributor Author

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.

Copy link
Contributor Author

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.

Copy link
Contributor

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')?

Copy link
Contributor Author

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).

@lgtm-com
Copy link

lgtm-com bot commented Jun 8, 2021

This pull request introduces 1 alert when merging e48ab85 into 3fe7dcb - view on LGTM.com

new alerts:

  • 1 for Comparison between inconvertible types

@lgtm-com
Copy link

lgtm-com bot commented Jun 8, 2021

This pull request introduces 1 alert when merging 1dcc3fc into 3fe7dcb - view on LGTM.com

new alerts:

  • 1 for Comparison between inconvertible types

@lgtm-com
Copy link

lgtm-com bot commented Jun 9, 2021

This pull request introduces 1 alert when merging 115d045 into e734418 - view on LGTM.com

new alerts:

  • 1 for Comparison between inconvertible types

@lgtm-com
Copy link

lgtm-com bot commented Jun 10, 2021

This pull request introduces 1 alert when merging 85a1676 into 2ee75c4 - view on LGTM.com

new alerts:

  • 1 for Comparison between inconvertible types

@lgtm-com
Copy link

lgtm-com bot commented Jun 10, 2021

This pull request introduces 1 alert when merging 05d435f into 01e11e4 - view on LGTM.com

new alerts:

  • 1 for Comparison between inconvertible types

@lgtm-com
Copy link

lgtm-com bot commented Jun 10, 2021

This pull request introduces 1 alert when merging 4eab890 into cd94152 - view on LGTM.com

new alerts:

  • 1 for Comparison between inconvertible types

@@ -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(
Copy link
Contributor

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

Copy link
Contributor Author

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:

  1. Better tests
  2. More consideration of what the implementation should own.

@lgtm-com
Copy link

lgtm-com bot commented Jun 10, 2021

This pull request introduces 1 alert when merging 598d63f into cd94152 - view on LGTM.com

new alerts:

  • 1 for Comparison between inconvertible types

@rcebulko
Copy link
Contributor

@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

@kristoferbaxter
Copy link
Contributor Author

Thanks @rcebulko! Appreciate it.

Also, no worries about the conflicts... happy to see the changes you're working on landing cleanly!

@lgtm-com
Copy link

lgtm-com bot commented Jun 11, 2021

This pull request introduces 1 alert when merging 0d0348b into 6efb0c0 - view on LGTM.com

new alerts:

  • 1 for Comparison between inconvertible types

@@ -936,6 +938,13 @@ export class AmpLightboxGallery extends AMP.BaseElement {
};

const mutate = () => {
if (enter) {
Services.ownersForDoc(this.element)./*OK*/ scheduleUnlayout(
Copy link
Contributor

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?

Copy link
Contributor Author

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.

@lgtm-com
Copy link

lgtm-com bot commented Jun 15, 2021

This pull request introduces 1 alert when merging 9057386 into bafe128 - view on LGTM.com

new alerts:

  • 1 for Comparison between inconvertible types

test/unit/test-amp-img.js Outdated Show resolved Hide resolved
@lgtm-com
Copy link

lgtm-com bot commented Jun 15, 2021

This pull request introduces 1 alert when merging d94dbe0 into 1f2308b - view on LGTM.com

new alerts:

  • 1 for Comparison between inconvertible types

// remove it from DOM.
if (!candidate.signals().get(CommonSignals.LOAD_END)) {
if (
!candidate.tagName === 'IMG' &&
Copy link
Contributor

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

Suggested change
!candidate.tagName === 'IMG' &&
candidate.tagName !== 'IMG' &&

@lgtm-com
Copy link

lgtm-com bot commented Jun 15, 2021

This pull request introduces 1 alert when merging 184ccf3 into 7702194 - view on LGTM.com

new alerts:

  • 1 for Comparison between inconvertible types

@kristoferbaxter kristoferbaxter merged commit fa14e5c into main Jun 16, 2021
@rcebulko
Copy link
Contributor

image

@kristoferbaxter
Copy link
Contributor Author

Let's hope the night metrics don't have another fun discovery awaiting us!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants