Skip to content

Commit

Permalink
remove ResizeObserver ponyfill. fixes #28
Browse files Browse the repository at this point in the history
  • Loading branch information
mreinstein committed Sep 7, 2022
1 parent ce3eb94 commit e85e863
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 12 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
},
"dependencies": {
"hyperx-tmp": "^2.5.4",
"resize-observer-polyfill": "^1.5.1",
"snabbdom": "^3.0.3"
},
"engines": {
Expand Down
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ html`<div data-breakpoints='{ "BP1": 400, "BP2": 600, "BP3": 1200 }'> Some conte

If the div is 700px wide, it will have `BP2` in it's classlist. Only the class with the highest matching rule will be added, regardless of what order the rules are declared in.

Internally, this is implemented with a ResizeObserver, and that is ponyfilled to support older browsers.
Internally, this is implemented with a ResizeObserver. As of version 5, we no longer bundle a ResizeObserver ponyfill with snabby. You should polyfill ResizeObserver yourself if you plan on using snabby on very old browsers. https://www.npmjs.com/package/resize-observer-polyfill


### Directives
Expand Down
10 changes: 0 additions & 10 deletions snabbdom-containerquery.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,5 @@
// inspired by https://philipwalton.com/articles/responsive-components-a-solution-to-the-container-queries-problem/

// ResizeObserver support is pretty good, but about 10% of the browsers still lack it.
// in some cases, snabbdom is used as a 3rd party module that gets used on websites,
// and it's unacceptable in some cases to install global polyfills.
//
// for now we inline it into the plugin as a ponyfill so that it's always available,
// doesn't pollute global scope, and works in almost all in-use browsers, at the cost of a few kb.
//
// https://github.com/que-etc/resize-observer-polyfill
import ResizeObserver from 'resize-observer-polyfill';


// today it's more performant to have 1 resizeObserver observe multiple elements rather than 1 per element.
// see https://groups.google.com/a/chromium.org/g/blink-dev/c/z6ienONUb5A/m/F5-VcUZtBAAJ
Expand Down

0 comments on commit e85e863

Please sign in to comment.