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

Cleanup INTERSECTION_OBSERVER_POLYFILL experiment #28929

Merged
merged 8 commits into from
Aug 6, 2020

Conversation

dvoytenko
Copy link
Contributor

@dvoytenko dvoytenko commented Jun 17, 2020

Closes #27807.

TODO

  • Resolve "friendly inabox" case.

@dvoytenko dvoytenko requested a review from zhouyx June 17, 2020 17:12
Copy link
Contributor

@zhouyx zhouyx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Woohoo! 🎉 🎉

@@ -14,9 +14,6 @@
* limitations under the License.
*/

// TODO(#27807): Remove polyfill part InOb polyfill has been launched. But the
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's worth changing the IntersectionObserverHostApi, IntersectionObserverHostForAd
class later on, also the file name to be more clear : )

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure. But I think it still covers more than ads. It's more of a "legacy 3p intersection observer host support".

src/polyfills.js Show resolved Hide resolved
@amp-owners-bot
Copy link

Hey @danielrozenberg! These files were changed:

build-system/global-configs/experiments-const.json

@dvoytenko
Copy link
Contributor Author

/cc @zhouyx This is to be deferred until the resolution for the "friendly inabox" case.

@dvoytenko
Copy link
Contributor Author

Ok, the last issue has been resolved. I'm restoring this pull request.

@dvoytenko dvoytenko merged commit 021d728 into ampproject:master Aug 6, 2020
@dvoytenko dvoytenko deleted the inob/cleanup branch August 6, 2020 18:33
@zhouyx
Copy link
Contributor

zhouyx commented Aug 6, 2020

🎉 🎉 Woohoo! @micajuine-ho fyi

@@ -586,9 +586,6 @@ export class AmpAdXOriginIframeHandler {
* @param {boolean} inViewport
*/
viewportCallback(inViewport) {
if (this.intersectionObserverHost_) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

likely the removal of this code might have caused issue: #29759
@dvoytenko was it intended to remove this?

@@ -596,13 +589,6 @@ export class AmpIframe extends AMP.BaseElement {
return true;
}

/** @override */
viewportCallback(inViewport) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

according to the offline chat I had with @zhouyx , I think this change is working as intended as amp-iframe does behave differently than amp-ad. @zhouyx pls confirm.

/cc @jridgewell @kristoferbaxter

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes I can confirm that IntersectionObserverHostApi is working as expected.
We are using the native IntersectionObserver within the IntersectionObserverHostApi so viewportCallback is no longer needed.

Also for legacy reason, IntersectionObserverHostApi sends update whenever there's an intersection change, but IntersectionObserverHostForAd sends update whenever there's a position change when the element is within the viewport.

we should migrate to using native IntersectionObserver to replace viewportCallback for IntersectionObserverHostForAd as well.

ed-bird pushed a commit to ed-bird/amphtml that referenced this pull request Dec 10, 2020
* Cleanup INTERSECTION_OBSERVER_POLYFILL experiment

* remove additional polyfilling code

* additional polyfill cleanup

* fix lints

* cleanup

* cleanup more tests

* fix sourcemaps

* cleanup FIE legacy mode
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Deploy a universal IntersectionObserver polyfill in all AMP modes
6 participants