PolymerLabs / uni-virtualizer

Monorepo for a "universal" (renderer-agnostic) virtual scroller and renderer-specific variants

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Prepare and submit PR for resize-observer-polyfill?

graynorton opened this issue · comments

EDIT May 12: We are going to evaluate resize-observer-polyfill against @juggle/resize-observer, which is more actively maintained but at first glance seems not to perform as well. Depending on the results of the evaluation, we'll either proceed with a PR or not...


We have a fork of https://github.com/que-etc/resize-observer-polyfill that allows the polyfill to observe size changes for elements in Shadow DOM (i.e. elements beneath native shadow roots).

The changes to the polyfill are relatively small in terms of code size and (while we haven't yet done formal perf testing) seem to be fairly performant, but the approach might be a bit controversial (as it involves patching attachShadow).

This issue is to cover the work required to clean up our fork and submit it as a PR. If the PR is not accepted, we may consider maintaining our fork.

Hi, not 100% sure whether this is a right issue but I have a question.

Are you going to publish a loader (polyfillLoaders/ResizeObserver.ts) to npm?
It would be great to have it as a separate package so everyone could depend on it.

As an example, we have copied it to use ResizeObserver in Vaadin components & LitElement:
https://github.com/vaadin/component-mixins/blob/master/packages/resizable-mixin/resize-observer-polyfill.ts

@web-padawan I've thought about it, but don't have any definite plans. I think the loading approach we're using here has some appeal and seems to be working well enough so far. The fact that you've copied it is another good data point, but I'd like to give it some more thought and get some additional opinions. That's actually what #44 is intended to do.

This issue (#45) is related but different. I'll update the description in a moment to explain.

I've not delved into it, but there is another resize observer polyfill which appears to be more frequently updated and also covers the areas que lacks - not sure about shadow-dom resizing though - it does have better test coverage etc.

https://github.com/juggle/resize-observer

@moodyjmz Thanks for the pointer! I'll take a look at it.

Closing.

Given our specific needs and the minimal activity on this polyfill, we've decided to (lightly) maintain a fork with our necessary modifications rather than submit PRs.