devrelm / resize-observer

Other
98 stars 12 forks source link

Fix: Enable reuse of ResizeObserver #96

Closed devrelm closed 3 years ago

devrelm commented 3 years ago

93 introduced an error where once disconnect() is called on a ResizeObserver, that ResizeObserver can no longer be used to track further elements. This does not appear to be intended behavior in the spec.

This PR enables re-use of the ResizeObserver.

It also deregisters the ResizeObserver when the last element is unobserved in addition to when the ResizeObserver has disconnect() called on it.

devrelm commented 3 years ago

@thgreasi This is now fixed with v1.0.2.