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

Using this polyfill with polyfill.io #105

Closed
nicooprat opened this issue May 25, 2020 · 4 comments
Closed

Using this polyfill with polyfill.io #105

nicooprat opened this issue May 25, 2020 · 4 comments

Comments

@nicooprat
Copy link

Many thanks for this polyfill that worked a lot better than https://github.com/que-etc/resize-observer-polyfill!

I suggested to use this polyfill in Financial Times' polyfill.io service instead of an old one:

Failures:
 - safari/9.1:
    -> ResizeObserver ResizeObserver Observer should allow trying to unobserve multiple times.
       http://bs-local.com:9876/test?includePolyfills=yes&always=no&feature=ResizeObserver
       done() called multiple times

Here's the PR JakeChampion/polyfill-library#644 (comment)

Regards.

@TremayneChrist
Copy link
Member

Hi @nicooprat,

Really appreciate you trying to get this into polyfil.io and I'm glad it's working well for you!

I'll take a look into the tests and see what I can do.

@TremayneChrist
Copy link
Member

I'll have to fire up an instance of Safari 9.1 to debug this properly. Looking at the code I'm not sure how this is even possible, especially as the other tests for multiple observes appear to be working fine.

@TremayneChrist
Copy link
Member

@nicooprat the dependencies required for the polyfill have changed recently and therefore they will need to be updated in the PR for polyfill.io.

MapWeakMap

Also the tests will have to change slightly as this polyfill didn't follow the spec correctly for the disconnect API. You can see the issue here (#104).

https://github.com/juggle/resize-observer/releases/tag/v3.2.0

@TremayneChrist
Copy link
Member

I cannot seem to reproduce the error in Safari 9.1. I only see the callback being fired once.

var el = document.createElement('div');
var el2 = el.cloneNode();
document.body.appendChild(el);
document.body.appendChild(el2);
var ro = new ResizeObserver(function (entries) {
  console.log('RO', entries.length);
});
ro.observe(el);
ro.observe(el2);
ro.unobserve(el2);
ro.unobserve(el2);

// RO 1

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

No branches or pull requests

2 participants