Skip to content

Commit

Permalink
Add support for ResizeObserver (Modernizr#2582)
Browse files Browse the repository at this point in the history
  • Loading branch information
AnderssonChristian authored Jul 2, 2020
1 parent 9b62ec8 commit 2255367
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 0 deletions.
29 changes: 29 additions & 0 deletions feature-detects/window/resizeobserver.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*!
{
"name": "ResizeObserver",
"property": "resizeobserver",
"caniuse": "resizeobserver",
"tags": ["ResizeObserver"],
"authors": ["Christian Andersson"],
"notes": [{
"name": "W3C Spec",
"href": "https://www.w3.org/TR/resize-observer/"
}, {
"name": "MDN Docs",
"href": "https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserver"
}, {
"name": "Web.dev Article",
"href": "https://web.dev/resize-observer/"
}, {
"name": "Digital Ocean tutorial",
"href": "https://www.digitalocean.com/community/tutorials/js-resize-observer"
}]
}
!*/

/* DOC
Detects support for ResizeObserver.
*/
define(['Modernizr'], function(Modernizr) {
Modernizr.addTest('resizeobserver', 'ResizeObserver' in window);
});
1 change: 1 addition & 0 deletions lib/config-all.json
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,7 @@
"window/atob-btoa",
"window/framed",
"window/matchmedia",
"window/resizeobserver",
"workers/blobworkers",
"workers/dataworkers",
"workers/sharedworkers",
Expand Down
1 change: 1 addition & 0 deletions test/browser/integration/caniuse.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ window.caniusecb = function(caniuse) {
queryselector: 'queryselector',
regions: 'css-regions',
requestanimationframe: 'requestanimationframe',
resizeobserver: 'resizeobserver',
rgba: 'css3-colors',
ruby: 'ruby',
sandbox: 'iframe-sandbox',
Expand Down

0 comments on commit 2255367

Please sign in to comment.