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

element-position

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

element-position - npm Package Compare versions

Comparing version 0.1.7 to 0.1.8

dist/index.min.js

6

dist/index.d.ts
declare namespace Position {
function getNestedOffset(el: Element): {
function getNestedOffset(el: HTMLElement): {
top: number,

@@ -8,7 +8,7 @@ left: number,

}
function getNestedScroll(el: Element): {
function getNestedScroll(el: HTMLElement): {
x: number,
y: number
}
function getAbsolute(el: Element): {
function getAbsolute(el: HTMLElement): {
top: number,

@@ -15,0 +15,0 @@ left: number,

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

!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.Position=e()}(this,function(){"use strict";var o={getNestedOffset:function(t){for(var e=t.offsetLeft,f=t.offsetTop,o=t.offsetLeft+t.offsetWidth,s=t.offsetTop+t.offsetHeight;t=t.parentElement;)e+=t.offsetLeft,f+=t.offsetTop,o+=t.offsetLeft,s+=t.offsetTop;return{left:e,top:f,right:o,bottom:s}}},s={getNestedScroll:function(t){for(var e=0,f=0;t=t.parentElement;)e+=t.scrollLeft,f+=t.scrollTop;return{x:e,y:f}}},t={getAbsolute:function(t){var e=o.getNestedOffset(t),f=s.getNestedScroll(t);return{left:e.left-f.x,top:e.top-f.y,right:e.right-f.x,bottom:e.bottom-f.y}}};return{getNestedOffset:o.getNestedOffset,getNestedScroll:s.getNestedScroll,getAbsolute:t.getAbsolute}});
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
(global.Position = factory());
}(this, (function () { 'use strict';
var OFFSET = {
getNestedOffset: function (el) {
var left = el.offsetLeft, top = el.offsetTop, right = el.offsetLeft + el.offsetWidth, bottom = el.offsetTop + el.offsetHeight;
while (el = el.offsetParent) {
left += el.offsetLeft;
top += el.offsetTop;
right += el.offsetLeft;
bottom += el.offsetTop;
}
return {
left: left,
top: top,
right: right,
bottom: bottom
};
}
};
var SCROLL = {
getNestedScroll: function (el) {
var x = 0, y = 0;
while (el = el.parentElement) {
x += el.scrollLeft;
y += el.scrollTop;
}
return {
x: x,
y: y
};
}
};
var ABSOLUTE = {
getAbsolute: function (el) {
var offset = OFFSET.getNestedOffset(el), scroll = SCROLL.getNestedScroll(el);
return {
left: (offset.left - scroll.x),
top: (offset.top - scroll.y),
right: (offset.right - scroll.x),
bottom: (offset.bottom - scroll.y)
};
}
};
var main = {
getNestedOffset: OFFSET.getNestedOffset,
getNestedScroll: SCROLL.getNestedScroll,
getAbsolute: ABSOLUTE.getAbsolute
};
return main;
})));
{
"name": "element-position",
"version": "0.1.7",
"version": "0.1.8",
"description": "Calculates the position of the DOM.",
"main": "dist/index.js",
"main": "dist/index.min.js",
"author": {

@@ -7,0 +7,0 @@ "name": "Troy Tae",

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