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.3 to 1.3.0

.travis.yml

14

CHANGELOG.md

@@ -10,2 +10,13 @@ # Changelog

## [1.3.0] - 2018-03-16
### Changed
- Changed tests for the continuous integration (#5).
The browser tests is only for the checking compatibility.
### Removed
- Removed getter `.isDocumentTarget`. use `.isDocument` instead. (b1d4c76e73a92058fdc0f59efc8db296346d1da2)
## [1.2.0] - 2018-01-24

@@ -37,3 +48,4 @@

[Unreleased]: https://github.com/archco/element-measurer/compare/v1.2.0...HEAD
[Unreleased]: https://github.com/archco/element-measurer/compare/v1.3.0...HEAD
[1.3.0]: https://github.com/archco/element-measurer/compare/v1.2.0...v1.3.0
[1.2.0]: https://github.com/archco/element-measurer/compare/v1.1.0...v1.2.0

@@ -40,0 +52,0 @@ [1.1.0]: https://github.com/archco/element-measurer/compare/v1.0.2...v1.1.0

14

dist/element-measurer.js

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

root["ElementMeasurer"] = factory();
})(window, function() {
})(this, function() {
return /******/ (function(modules) { // webpackBootstrap

@@ -121,14 +121,2 @@ /******/ // The module cache

});
Object.defineProperty(ElementMeasurer.prototype, "isDocumentTarget", {
/**
* Returns whether target is document or html element.
* @deprecated use isDocument instead.
* @return
*/
get: function () {
return this.isDocument;
},
enumerable: true,
configurable: true
});
Object.defineProperty(ElementMeasurer.prototype, "clientWidth", {

@@ -135,0 +123,0 @@ /**

@@ -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()}(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}})});
!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()}(this,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,"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.3",
"version": "1.3.0",
"description": "The javascript library class for measures size of Element.",

@@ -11,4 +11,4 @@ "main": "dist/element-measurer.js",

"scripts": {
"test": "echo \"Please see test/test.html in browser.\" && exit 1",
"build": "webpack --hide-modules --mode=\"development\"",
"test": "mocha \"./test/*.spec.js\"",
"build": "webpack --hide-modules",
"watch": "npm run build -- --watch"

@@ -31,12 +31,18 @@ },

"devDependencies": {
"@types/chai": "^4.1.2",
"@types/chai-as-promised": "^7.1.0",
"@types/mocha": "^2.2.48",
"@types/puppeteer": "^1.1.0",
"chai": "^4.1.2",
"mocha": "^5.0.1",
"chai-as-promised": "^7.1.1",
"mocha": "^5.0.4",
"puppeteer": "^1.1.1",
"source-map-loader": "^0.2.3",
"ts-loader": "^4.0.1",
"typescript": "^2.7.2",
"webpack": "^4.0.1",
"webpack-cli": "^2.0.10",
"webpack": "^4.1.1",
"webpack-cli": "^2.0.12",
"webpack-merge": "^4.1.2",
"webpack-notifier": "^1.5.1"
"webpack-notifier": "^1.6.0"
}
}
# ElementMeasurer
[![Build Status](https://travis-ci.org/archco/element-measurer.svg?branch=master)](https://travis-ci.org/archco/element-measurer)
[![npm version](https://badge.fury.io/js/element-measurer.svg)](https://www.npmjs.com/package/element-measurer)
[![Downloads](https://img.shields.io/npm/dm/element-measurer.svg)](https://www.npmjs.com/package/element-measurer)
The javascript library class for measures size of Element.

@@ -48,5 +52,7 @@

- Syntax
``` js
elementMeasurer.setTarget(target);
```
- Param `Element|String|Window|Document` target

@@ -60,5 +66,7 @@ - Return `ElementMeasurer`

- Syntax
``` js
let obj = elementMeasurer.getOffset();
```
- Return `Object` { top, left }

@@ -65,0 +73,0 @@

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

export default ElementMeasurer;
declare type ArrowToTarget = HTMLElement|Element|Window|Document|string;

@@ -16,3 +14,3 @@

*/
declare class ElementMeasurer {
export default class ElementMeasurer {
target: HTMLElement;

@@ -22,4 +20,2 @@

readonly isDocument: boolean;
/** @deprecated use isDocument instead. */
readonly isDocumentTarget: boolean;
/** Returns inner width of an element in pixels. */

@@ -26,0 +22,0 @@ readonly clientWidth: number;

@@ -35,11 +35,2 @@ type ArrowToTarget = HTMLElement|Element|Window|Document|string;

/**
* Returns whether target is document or html element.
* @deprecated use isDocument instead.
* @return
*/
get isDocumentTarget(): boolean {
return this.isDocument;
}
/**
* Returns inner width of an element in pixels.

@@ -46,0 +37,0 @@ * @return

@@ -7,2 +7,3 @@ const path = require('path');

entry: './src/element-measurer.ts',
mode: 'development',
output: {

@@ -13,2 +14,3 @@ path: path.resolve(__dirname, 'dist'),

libraryTarget: 'umd',
globalObject: 'this',
},

@@ -15,0 +17,0 @@ module: {

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