New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

element-height-observer

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

element-height-observer - npm Package Compare versions

Comparing version 0.0.7 to 0.0.8

README.md

5

dist/index.d.ts

@@ -1,2 +0,5 @@

export declare function registerHeightObserver(element: HTMLElement, callback: () => void): void;
export interface IHeightObserverOptions {
direction?: 'both' | 'horizontal' | 'vertical';
}
export declare function registerHeightObserver(element: HTMLElement, options: IHeightObserverOptions | (() => void), callback?: () => void): void;
export declare function unregisterHeightObserver(element: HTMLElement): void;

28

dist/index.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
function registerHeightObserver(element, callback) {
function registerHeightObserver(element, options, callback) {
var opts;
var cbk;
if (!callback) {
cbk = options;
opts = {};
}
else {
opts = options;
cbk = callback;
}
var iframe = document.createElement('IFRAME');

@@ -9,4 +19,14 @@ iframe.style.pointerEvents = 'none';

iframe.style.overflow = 'auto';
iframe.style.height = '100%';
iframe.style.width = '0';
if (!opts || opts.direction === 'vertical') {
iframe.style.height = '100%';
iframe.style.width = '0';
}
else if (opts.direction === 'horizontal') {
iframe.style.height = '0';
iframe.style.width = '100%';
}
else {
iframe.style.height = '100%';
iframe.style.width = '100%';
}
iframe.style.top = '0';

@@ -20,3 +40,3 @@ iframe.style.bottom = '0';

iframe.contentWindow.addEventListener('resize', function () {
callback();
cbk();
});

@@ -23,0 +43,0 @@ };

@@ -1,1 +0,1 @@

"use strict";function registerHeightObserver(e,t){var r=document.createElement("IFRAME");r.style.pointerEvents="none",r.style.position="absolute",r.style.display="block",r.style.overflow="auto",r.style.height="100%",r.style.width="0",r.style.top="0",r.style.bottom="0",r.style.left="0",r.style.border="0",r.style.backgroundColor="transparent",r.className="element-height-observer-iframe",r.onload=function(){r.contentWindow.addEventListener("resize",function(){t()})},e.appendChild(r),"static"!==e.style.position&&""!==e.style.position||(e.style.position="relative")}function unregisterHeightObserver(e){for(var t=e.children.length-1;0<=t;t--){var r=e.children.item(t);"element-height-observer-iframe"===r.getAttribute("class")&&r.remove()}}Object.defineProperty(exports,"__esModule",{value:!0}),exports.registerHeightObserver=registerHeightObserver,exports.unregisterHeightObserver=unregisterHeightObserver;
"use strict";function registerHeightObserver(e,t,r){var i,s;r?(i=t,s=r):(s=t,i={});var o=document.createElement("IFRAME");o.style.pointerEvents="none",o.style.position="absolute",o.style.display="block",o.style.overflow="auto",i&&"vertical"!==i.direction?("horizontal"===i.direction?o.style.height="0":o.style.height="100%",o.style.width="100%"):(o.style.height="100%",o.style.width="0"),o.style.top="0",o.style.bottom="0",o.style.left="0",o.style.border="0",o.style.backgroundColor="transparent",o.className="element-height-observer-iframe",o.onload=function(){o.contentWindow.addEventListener("resize",function(){s()})},e.appendChild(o),"static"!==e.style.position&&""!==e.style.position||(e.style.position="relative")}function unregisterHeightObserver(e){for(var t=e.children.length-1;0<=t;t--){var r=e.children.item(t);"element-height-observer-iframe"===r.getAttribute("class")&&r.remove()}}Object.defineProperty(exports,"__esModule",{value:!0}),exports.registerHeightObserver=registerHeightObserver,exports.unregisterHeightObserver=unregisterHeightObserver;
{
"name": "element-height-observer",
"version": "0.0.7",
"version": "0.0.8",
"description": "Allows you to add an efficient height listener to any dom element and execute a callback when its height changes",
"main": "dist/index.min.js",
"readme": "README.md",
"types": "dist/index.d.ts",

@@ -7,0 +8,0 @@ "scripts": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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