Polyfills the ResizeObserver API.
APACHE-2.0 License
Bot releases are visible (Hide)
Aligns polyfill with spec changes.
Initial value of lastReportedSize
changed from 0, 0
to -1, -1
allowing for consistent notifications to be triggered when an element is observed for the first time.
const el = document.createElement('div');
const ro = new ResizeObserver(() => { ... });
ro.observe(el); // Will now notify with size `0, 0`.
https://github.com/w3c/csswg-drafts/issues/3664#issuecomment-1218270926
Published by TremayneChrist about 3 years ago
Published by TremayneChrist about 3 years ago
Published by TremayneChrist about 3 years ago
Published by TremayneChrist about 3 years ago
Published by TremayneChrist over 3 years ago
isElement
sometimes returns false on elements within an iFrame. Thanks @JayaKrishnaNamburu!Published by TremayneChrist over 3 years ago
ResizeObserverSize[]
to the observer callbackPublished by TremayneChrist over 4 years ago
disconnect
would prevent the observer from being used to observe again (#104).Map
with WeakMap
Published by TremayneChrist over 4 years ago
Tested:
Chromium 45.0.2454.0 (64-bit)
Published by TremayneChrist over 4 years ago
device-pixel-content-box
option to readme.Published by TremayneChrist over 4 years ago
Published by TremayneChrist over 4 years ago
ResizeObserverEntry.toJSON()
const elFromIFrame = iframe.contentDocument.querySelector('body');
const ro = new ResizeObserver(() => {
...
});
ro.observe(elFromIFrame);
Published by TremayneChrist almost 5 years ago
next
taglatest
Published by TremayneChrist almost 5 years ago
Published by TremayneChrist almost 5 years ago
Updates library to follow the latest specification. This includes some breaking changes from 2.x.
Breaking changes from 2.x:
ResizeObserverEntry
to return a sequence of sizes, for future fragment support (#84)ResizeObserver
and ResizeObserverEntry
Notable improvements:
device-pixel-content-box
(#85)Other improvements:
this
rewritten to undefined
warning in rollup.Published by TremayneChrist almost 5 years ago
Published by TremayneChrist almost 5 years ago
ResizeObserverEntry
to return a sequence of sizesBREAKING CHANGE:
Arrays are returned for contentBoxSize
, borderBoxSize
, and devicePixelContentBoxSize
.
//entry
{
contentRect: { ... },
contentBoxSize: [{ inlineSize: number, blockSize: number }],
...
}
Published by TremayneChrist almost 5 years ago
Published by TremayneChrist almost 5 years ago
ResizeObserver
and ResizeObserverEntry
BREAKING CHANGE:
You must now use named exports.
import { ResizeObserver } from '@juggle/resize-observer';
Published by TremayneChrist almost 5 years ago
type=module
to package.json
.types
field to package.json
to explicitly locate declaration files.