New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.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.0.0 to 1.0.1

12

dist/element-measurer.js

@@ -130,2 +130,14 @@ window["ElementMeasurer"] =

/**
* Determine whether a target element is document part or sub element.
*
* @return {Boolean}
*/
}, {
key: 'isDocumentTarget',
value: function isDocumentTarget() {
return this._isDocument;
}
// private

@@ -132,0 +144,0 @@

2

dist/element-measurer.min.js

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

window.ElementMeasurer=function(t){function e(r){if(n[r])return n[r].exports;var i=n[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,e),i.l=!0,i.exports}var n={};return e.m=t,e.c=n,e.d=function(t,n,r){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:r})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=0)}([function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),o=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document.documentElement;r(this,t),this._isDocument=!1,this.setTarget(e)}return i(t,[{key:"setTarget",value:function(t){if(t instanceof Element)this.target=t;else if(t===window||t===document)this.target=document.documentElement;else{if("string"!=typeof t)throw new TypeError("Target value is not correct type.");this.target=document.querySelector(t)}this._checkTarget()}},{key:"_checkTarget",value:function(){this._isDocument=this.target===document.documentElement||this.target===document.body}},{key:"clientWidth",get:function(){return this._isDocument?window.innerWidth:this.target.getBoundingClientRect().width}},{key:"clientHeight",get:function(){return this._isDocument?window.innerHeight:this.target.getBoundingClientRect().height}},{key:"scrollTop",get:function(){return this._isDocument?window.pageYOffset:this.target.scrollTop},set:function(t){this._isDocument?window.scrollTo(this.scrollLeft,t):this.target.scrollTop=t}},{key:"scrollLeft",get:function(){return this._isDocument?window.pageXOffset:this.target.scrollLeft},set:function(t){this._isDocument?window.scrollTo(t,this.scrollTop):this.target.scrollLeft=t}},{key:"scrollWidth",get:function(){return this.target.scrollWidth}},{key:"scrollHeight",get:function(){return this.target.scrollHeight}},{key:"maxScrollTop",get:function(){return this.scrollHeight-this.clientHeight}},{key:"maxScrollLeft",get:function(){return this.scrollWidth-this.clientWidth}}]),t}();e.default=o}]);
window.ElementMeasurer=function(t){function e(r){if(n[r])return n[r].exports;var i=n[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,e),i.l=!0,i.exports}var n={};return e.m=t,e.c=n,e.d=function(t,n,r){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:r})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=0)}([function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),o=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document.documentElement;r(this,t),this._isDocument=!1,this.setTarget(e)}return i(t,[{key:"setTarget",value:function(t){if(t instanceof Element)this.target=t;else if(t===window||t===document)this.target=document.documentElement;else{if("string"!=typeof t)throw new TypeError("Target value is not correct type.");this.target=document.querySelector(t)}this._checkTarget()}},{key:"isDocumentTarget",value:function(){return this._isDocument}},{key:"_checkTarget",value:function(){this._isDocument=this.target===document.documentElement||this.target===document.body}},{key:"clientWidth",get:function(){return this._isDocument?window.innerWidth:this.target.getBoundingClientRect().width}},{key:"clientHeight",get:function(){return this._isDocument?window.innerHeight:this.target.getBoundingClientRect().height}},{key:"scrollTop",get:function(){return this._isDocument?window.pageYOffset:this.target.scrollTop},set:function(t){this._isDocument?window.scrollTo(this.scrollLeft,t):this.target.scrollTop=t}},{key:"scrollLeft",get:function(){return this._isDocument?window.pageXOffset:this.target.scrollLeft},set:function(t){this._isDocument?window.scrollTo(t,this.scrollTop):this.target.scrollLeft=t}},{key:"scrollWidth",get:function(){return this.target.scrollWidth}},{key:"scrollHeight",get:function(){return this.target.scrollHeight}},{key:"maxScrollTop",get:function(){return this.scrollHeight-this.clientHeight}},{key:"maxScrollLeft",get:function(){return this.scrollWidth-this.clientWidth}}]),t}();e.default=o}]);

@@ -139,2 +139,14 @@ (function webpackUniversalModuleDefinition(root, factory) {

/**
* Determine whether a target element is document part or sub element.
*
* @return {Boolean}
*/
}, {
key: 'isDocumentTarget',
value: function isDocumentTarget() {
return this._isDocument;
}
// private

@@ -141,0 +153,0 @@

@@ -136,2 +136,11 @@ export default class ElementMeasurer {

/**
* Determine whether a target element is document part or sub element.
*
* @return {Boolean}
*/
isDocumentTarget() {
return this._isDocument;
}
// private

@@ -138,0 +147,0 @@

{
"name": "element-measurer",
"version": "1.0.0",
"version": "1.0.1",
"description": "The javascript class for measure size of DOM.",

@@ -5,0 +5,0 @@ "main": "dist/element-measurer.js",

@@ -15,2 +15,3 @@ const expect = window.chai.expect;

expect(elmMeasurer).to.be.instanceof(ElementMeasurer);
expect(elmMeasurer.isDocumentTarget()).to.equal(false);

@@ -20,2 +21,3 @@ // document.

expect(docMeasurer).to.be.instanceof(ElementMeasurer);
expect(docMeasurer.isDocumentTarget()).to.equal(true);

@@ -22,0 +24,0 @@ // wrong argument.

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