Skip to content
This repository was archived by the owner on Jul 30, 2018. It is now read-only.
This repository was archived by the owner on Jul 30, 2018. It is now read-only.

Consider using ResizeObserver #618

@kitsonk

Description

@kitsonk

Enhancement/Discussion

We might want to consider using a ResizeObserver polyfill to allow the Dimensions meta manager to perform better, allowing it to detect changes to DOM elements that change the size information of a DOM element.

The draft spec is available at WICG ResizeObserver Draft. A well thought out polyfill is available at que-etc/resize-observer-polyfill which uses MutationObservers and Mutation Events to provide spec compliant functionality with some minor limitations.

It is currently available natively in Chrome/Opera under a flag.

Right now, every time a widget is re-rendered, any nodes that are registered with the Dimensions meta manager will have their bounding rectangle re-calculated, whether it has actually been changed. This would allow the manager to be more reactive and keep a cache of size information, of which its observed DOM elements would have their values updated on actual resize.

Because the polyfill is designed to deliver the resize changes only when it is convinced it has the right information, there could be an issue where the queuing of changes get delivered after the DOM has be re-rendered after an invalidation, either causing a double invalidation or incorrect information being offered up to the widgets. This would require investigation to help ensure that it operates effectively.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions