Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

resize-observer-polyfill

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

resize-observer-polyfill

A polyfill for the Resize Observer API

  • 1.4.2
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created

What is resize-observer-polyfill?

The resize-observer-polyfill package provides a polyfill for the ResizeObserver API, which allows you to be notified when an element's content rectangle has changed its size, and thus react accordingly. This is particularly useful for responsive designs and element-specific layout updates.

What are resize-observer-polyfill's main functionalities?

Observing element size changes

This feature allows you to observe changes in the size of an element. The callback function is executed whenever the size of the observed element changes, providing you with the new dimensions and allowing you to perform any necessary adjustments.

var ro = new ResizeObserver(entries => {
  for (let entry of entries) {
    const cr = entry.contentRect;
    console.log('Element:', entry.target);
    console.log(`Element size: ${cr.width}px x ${cr.height}px`);
    console.log(`Element padding: ${cr.top}px ; ${cr.left}px`);
  }
});

ro.observe(document.getElementById('myElement'));

Other packages similar to resize-observer-polyfill

Keywords

FAQs

Package last updated on 03 Apr 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc