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

element-measurer

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

element-measurer - npm Package Compare versions

Comparing version 1.2.2 to 1.2.3

29

dist/element-measurer.js

@@ -10,3 +10,3 @@ (function webpackUniversalModuleDefinition(root, factory) {

root["ElementMeasurer"] = factory();
})(typeof self !== 'undefined' ? self : this, function() {
})(window, function() {
return /******/ (function(modules) { // webpackBootstrap

@@ -58,2 +58,7 @@ /******/ // The module cache

/******/
/******/ // define __esModule on exports
/******/ __webpack_require__.r = function(exports) {
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules

@@ -74,12 +79,18 @@ /******/ __webpack_require__.n = function(module) {

/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 0);
/******/ return __webpack_require__(__webpack_require__.s = "./src/element-measurer.ts");
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/******/ ({
/***/ "./src/element-measurer.ts":
/*!*********************************!*\
!*** ./src/element-measurer.ts ***!
\*********************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
__webpack_require__.r(__webpack_exports__);
/**

@@ -238,8 +249,5 @@ * Element measurer.

ElementMeasurer.prototype.setTarget = function (val) {
if (val instanceof HTMLElement) {
if (val instanceof HTMLElement || val instanceof Element) {
this.target = val;
}
else if (val instanceof Element) {
this.target = val;
}
else if (val === window || val === document) {

@@ -277,4 +285,5 @@ this.target = document.documentElement;

/***/ })
/******/ ]);
/******/ });
});
//# sourceMappingURL=element-measurer.js.map

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

!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.ElementMeasurer=t():e.ElementMeasurer=t()}("undefined"!=typeof self?self:this,function(){return function(e){var t={};function o(r){if(t[r])return t[r].exports;var n=t[r]={i:r,l:!1,exports:{}};return e[r].call(n.exports,n,n.exports,o),n.l=!0,n.exports}return o.m=e,o.c=t,o.d=function(e,t,r){o.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:r})},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="",o(o.s=0)}([function(e,t,o){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e){void 0===e&&(e=document.documentElement),this.setTarget(e)}return Object.defineProperty(e.prototype,"isDocument",{get:function(){return this.target===document.documentElement||this.target===document.body},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isDocumentTarget",{get:function(){return this.isDocument},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"clientWidth",{get:function(){return this.isDocument?window.innerWidth:this.target.getBoundingClientRect().width},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"clientHeight",{get:function(){return this.isDocument?window.innerHeight:this.target.getBoundingClientRect().height},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"scrollTop",{get:function(){return this.isDocument?window.pageYOffset:this.target.scrollTop},set:function(e){this.isDocument?window.scrollTo(this.scrollLeft,e):this.target.scrollTop=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"scrollLeft",{get:function(){return this.isDocument?window.pageXOffset:this.target.scrollLeft},set:function(e){this.isDocument?window.scrollTo(e,this.scrollTop):this.target.scrollLeft=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"scrollWidth",{get:function(){return this.target.scrollWidth},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"scrollHeight",{get:function(){return this.target.scrollHeight},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"maxScrollTop",{get:function(){return this.scrollHeight-this.clientHeight},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"maxScrollLeft",{get:function(){return this.scrollWidth-this.clientWidth},enumerable:!0,configurable:!0}),e.prototype.setTarget=function(e){if(e instanceof HTMLElement)this.target=e;else if(e instanceof Element)this.target=e;else if(e===window||e===document)this.target=document.documentElement;else{if("string"!=typeof e)throw new TypeError("Target value is not correct type.");this.target=document.querySelector(e)}return this},e.prototype.getOffset=function(){for(var e=this.target,t=0,o=0;e&&!isNaN(e.offsetLeft)&&!isNaN(e.offsetTop);)o+=e.offsetLeft-e.scrollLeft,t+=e.offsetTop-e.scrollTop,e=e.offsetParent;return{top:t,left:o}},e}();t.default=r}])});
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.ElementMeasurer=t():e.ElementMeasurer=t()}(window,function(){return function(e){var t={};function r(o){if(t[o])return t[o].exports;var n=t[o]={i:o,l:!1,exports:{}};return e[o].call(n.exports,n,n.exports,r),n.l=!0,n.exports}return r.m=e,r.c=t,r.d=function(e,t,o){r.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:o})},r.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s="./src/element-measurer.ts")}({"./src/element-measurer.ts":function(e,t,r){"use strict";r.r(t);var o=function(){function e(e){void 0===e&&(e=document.documentElement),this.setTarget(e)}return Object.defineProperty(e.prototype,"isDocument",{get:function(){return this.target===document.documentElement||this.target===document.body},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isDocumentTarget",{get:function(){return this.isDocument},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"clientWidth",{get:function(){return this.isDocument?window.innerWidth:this.target.getBoundingClientRect().width},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"clientHeight",{get:function(){return this.isDocument?window.innerHeight:this.target.getBoundingClientRect().height},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"scrollTop",{get:function(){return this.isDocument?window.pageYOffset:this.target.scrollTop},set:function(e){this.isDocument?window.scrollTo(this.scrollLeft,e):this.target.scrollTop=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"scrollLeft",{get:function(){return this.isDocument?window.pageXOffset:this.target.scrollLeft},set:function(e){this.isDocument?window.scrollTo(e,this.scrollTop):this.target.scrollLeft=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"scrollWidth",{get:function(){return this.target.scrollWidth},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"scrollHeight",{get:function(){return this.target.scrollHeight},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"maxScrollTop",{get:function(){return this.scrollHeight-this.clientHeight},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"maxScrollLeft",{get:function(){return this.scrollWidth-this.clientWidth},enumerable:!0,configurable:!0}),e.prototype.setTarget=function(e){if(e instanceof HTMLElement||e instanceof Element)this.target=e;else if(e===window||e===document)this.target=document.documentElement;else{if("string"!=typeof e)throw new TypeError("Target value is not correct type.");this.target=document.querySelector(e)}return this},e.prototype.getOffset=function(){for(var e=this.target,t=0,r=0;e&&!isNaN(e.offsetLeft)&&!isNaN(e.offsetTop);)r+=e.offsetLeft-e.scrollLeft,t+=e.offsetTop-e.scrollTop,e=e.offsetParent;return{top:t,left:r}},e}();t.default=o}})});
{
"name": "element-measurer",
"version": "1.2.2",
"version": "1.2.3",
"description": "The javascript library class for measures size of Element.",

@@ -12,3 +12,3 @@ "main": "dist/element-measurer.js",

"test": "echo \"Please see test/test.html in browser.\" && exit 1",
"build": "npx webpack --hide-modules",
"build": "webpack --hide-modules --mode=\"development\"",
"watch": "npm run build -- --watch"

@@ -31,11 +31,12 @@ },

"devDependencies": {
"awesome-typescript-loader": "^3.4.1",
"chai": "^4.1.2",
"mocha": "^4.0.1",
"mocha": "^5.0.1",
"source-map-loader": "^0.2.3",
"typescript": "^2.6.2",
"uglifyjs-webpack-plugin": "^1.1.6",
"webpack": "^3.10.0",
"ts-loader": "^4.0.1",
"typescript": "^2.7.2",
"webpack": "^4.0.1",
"webpack-cli": "^2.0.10",
"webpack-merge": "^4.1.2",
"webpack-notifier": "^1.5.1"
}
}

@@ -133,5 +133,3 @@ type ArrowToTarget = HTMLElement|Element|Window|Document|string;

setTarget(val: ArrowToTarget): this {
if (val instanceof HTMLElement) {
this.target = val;
} else if (val instanceof Element) {
if (val instanceof HTMLElement || val instanceof Element) {
this.target = val as HTMLElement;

@@ -138,0 +136,0 @@ } else if (val === window || val === document) {

const path = require('path');
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
const merge = require('webpack-merge');
const WebpackNotifierPlugin = require('webpack-notifier');
module.exports = {
entry: {
'element-measurer': './src/element-measurer.ts',
'element-measurer.min': './src/element-measurer.ts',
},
const dev = {
entry: './src/element-measurer.ts',
output: {
path: path.resolve(__dirname, 'dist'),
filename: '[name].js',
filename: 'element-measurer.js',
library: 'ElementMeasurer',

@@ -21,3 +18,3 @@ libraryTarget: 'umd',

exclude: /node_modules/,
use: 'awesome-typescript-loader',
use: 'ts-loader',
},

@@ -34,7 +31,14 @@ {

},
devtool: 'source-map',
};
const min = merge(dev, {
output: {
filename: 'element-measurer.min.js'
},
optimization: {
minimize: true,
},
devtool: false,
plugins: [
new UglifyJsPlugin({
sourceMap: false,
include: /\.min\.js$/,
}),
new WebpackNotifierPlugin({

@@ -46,3 +50,4 @@ title: 'Webpack',

],
devtool: 'source-map',
};
});
module.exports = [dev, min];

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