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

element-resize-event

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

element-resize-event - npm Package Compare versions

Comparing version 2.0.4 to 2.0.5

..eslintrc.un~

112

example/bundle.js

@@ -17,68 +17,82 @@ (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){

},{"../index.js":2}],2:[function(require,module,exports){
var attachEvent = document.attachEvent;
var isIE = navigator.userAgent.match(/Trident/);
var exports = function exports(element, fn) {
var window = this
var document = window.document
var isIE
var requestFrame
var requestFrame = (function() {
var raf = window.requestAnimationFrame || window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame || function(fn) {
return window.setTimeout(fn, 20);
};
return function(fn) {
return raf(fn);
};
})();
var attachEvent = document.attachEvent
if (typeof navigator !== 'undefined') {
isIE = navigator.userAgent.match(/Trident/) || navigator.userAgent.match(/Edge/)
}
var cancelFrame = (function() {
var cancel = window.cancelAnimationFrame || window.mozCancelAnimationFrame || window.webkitCancelAnimationFrame ||
window.clearTimeout;
return function(id) {
return cancel(id);
};
})();
requestFrame = (function () {
var raf = window.requestAnimationFrame ||
window.mozRequestAnimationFrame ||
window.webkitRequestAnimationFrame ||
function fallbackRAF(func) {
return window.setTimeout(func, 20)
}
return function requestFrameFunction(func) {
return raf(func)
}
})()
function resizeListener(e) {
var win = e.target || e.srcElement;
if (win.__resizeRAF__) {
cancelFrame(win.__resizeRAF__);
var cancelFrame = (function () {
var cancel = window.cancelAnimationFrame ||
window.mozCancelAnimationFrame ||
window.webkitCancelAnimationFrame ||
window.clearTimeout
return function cancelFrameFunction(id) {
return cancel(id)
}
})()
function resizeListener(e) {
var win = e.target || e.srcElement
if (win.__resizeRAF__) {
cancelFrame(win.__resizeRAF__)
}
win.__resizeRAF__ = requestFrame(function () {
var trigger = win.__resizeTrigger__
trigger.__resizeListeners__.forEach(function (fn) {
fn.call(trigger, e)
})
})
}
win.__resizeRAF__ = requestFrame(function() {
var trigger = win.__resizeTrigger__;
trigger.__resizeListeners__.forEach(function(fn) {
fn.call(trigger, e);
});
});
}
function objectLoad(e) {
this.contentDocument.defaultView.__resizeTrigger__ = this.__resizeElement__;
this.contentDocument.defaultView.addEventListener('resize', resizeListener);
}
function objectLoad() {
this.contentDocument.defaultView.__resizeTrigger__ = this.__resizeElement__
this.contentDocument.defaultView.addEventListener('resize', resizeListener)
}
module.exports = function(element, fn) {
if (!element.__resizeListeners__) {
element.__resizeListeners__ = [];
element.__resizeListeners__ = []
if (attachEvent) {
element.__resizeTrigger__ = element;
element.attachEvent('onresize', resizeListener);
element.__resizeTrigger__ = element
element.attachEvent('onresize', resizeListener)
} else {
if (getComputedStyle(element).position == 'static') {
element.style.position = 'relative';
if (getComputedStyle(element).position === 'static') {
element.style.position = 'relative'
}
var obj = element.__resizeTrigger__ = document.createElement('object');
obj.setAttribute('style', 'display: block; position: absolute; top: 0; left: 0; height: 100%; width: 100%; overflow: hidden; pointer-events: none; z-index: -1;');
obj.setAttribute('class', 'resize-sensor');
obj.__resizeElement__ = element;
obj.onload = objectLoad;
obj.type = 'text/html';
var obj = element.__resizeTrigger__ = document.createElement('object')
obj.setAttribute('style', 'display: block; position: absolute; top: 0; left: 0; height: 100%; width: 100%; overflow: hidden; pointer-events: none; z-index: -1;')
obj.setAttribute('class', 'resize-sensor')
obj.__resizeElement__ = element
obj.onload = objectLoad
obj.type = 'text/html'
if (isIE) {
element.appendChild(obj);
element.appendChild(obj)
}
obj.data = 'about:blank';
obj.data = 'about:blank'
if (!isIE) {
element.appendChild(obj);
element.appendChild(obj)
}
}
}
element.__resizeListeners__.push(fn);
};
element.__resizeListeners__.push(fn)
}
module.exports = (typeof window === 'undefined') ? exports : exports.bind(window)
},{}]},{},[1]);

@@ -1,70 +0,79 @@

module.exports = function(element, fn) {
var window = this;
var document = window.document;
var exports = function exports(element, fn) {
var window = this
var document = window.document
var isIE
var requestFrame
var attachEvent = document.attachEvent;
if (typeof navigator !== "undefined") {
var isIE = navigator.userAgent.match(/Trident/) || navigator.userAgent.match(/Edge/);
var attachEvent = document.attachEvent
if (typeof navigator !== 'undefined') {
isIE = navigator.userAgent.match(/Trident/) || navigator.userAgent.match(/Edge/)
}
var requestFrame = (function() {
var raf = window.requestAnimationFrame || window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame || function(fn) {
return window.setTimeout(fn, 20);
};
return function(fn) {
return raf(fn);
};
})();
requestFrame = (function () {
var raf = window.requestAnimationFrame ||
window.mozRequestAnimationFrame ||
window.webkitRequestAnimationFrame ||
function fallbackRAF(func) {
return window.setTimeout(func, 20)
}
return function requestFrameFunction(func) {
return raf(func)
}
})()
var cancelFrame = (function() {
var cancel = window.cancelAnimationFrame || window.mozCancelAnimationFrame || window.webkitCancelAnimationFrame ||
window.clearTimeout;
return function(id) {
return cancel(id);
};
})();
var cancelFrame = (function () {
var cancel = window.cancelAnimationFrame ||
window.mozCancelAnimationFrame ||
window.webkitCancelAnimationFrame ||
window.clearTimeout
return function cancelFrameFunction(id) {
return cancel(id)
}
})()
function resizeListener(e) {
var win = e.target || e.srcElement;
var win = e.target || e.srcElement
if (win.__resizeRAF__) {
cancelFrame(win.__resizeRAF__);
cancelFrame(win.__resizeRAF__)
}
win.__resizeRAF__ = requestFrame(function() {
var trigger = win.__resizeTrigger__;
trigger.__resizeListeners__.forEach(function(fn) {
fn.call(trigger, e);
});
});
win.__resizeRAF__ = requestFrame(function () {
var trigger = win.__resizeTrigger__
trigger.__resizeListeners__.forEach(function (fn) {
fn.call(trigger, e)
})
})
}
function objectLoad(e) {
this.contentDocument.defaultView.__resizeTrigger__ = this.__resizeElement__;
this.contentDocument.defaultView.addEventListener('resize', resizeListener);
function objectLoad() {
this.contentDocument.defaultView.__resizeTrigger__ = this.__resizeElement__
this.contentDocument.defaultView.addEventListener('resize', resizeListener)
}
if (!element.__resizeListeners__) {
element.__resizeListeners__ = [];
element.__resizeListeners__ = []
if (attachEvent) {
element.__resizeTrigger__ = element;
element.attachEvent('onresize', resizeListener);
element.__resizeTrigger__ = element
element.attachEvent('onresize', resizeListener)
} else {
if (getComputedStyle(element).position == 'static') {
element.style.position = 'relative';
if (getComputedStyle(element).position === 'static') {
element.style.position = 'relative'
}
var obj = element.__resizeTrigger__ = document.createElement('object');
obj.setAttribute('style', 'display: block; position: absolute; top: 0; left: 0; height: 100%; width: 100%; overflow: hidden; pointer-events: none; z-index: -1;');
obj.setAttribute('class', 'resize-sensor');
obj.__resizeElement__ = element;
obj.onload = objectLoad;
obj.type = 'text/html';
var obj = element.__resizeTrigger__ = document.createElement('object')
obj.setAttribute('style', 'display: block; position: absolute; top: 0; left: 0; height: 100%; width: 100%; overflow: hidden; pointer-events: none; z-index: -1;')
obj.setAttribute('class', 'resize-sensor')
obj.__resizeElement__ = element
obj.onload = objectLoad
obj.type = 'text/html'
if (isIE) {
element.appendChild(obj);
element.appendChild(obj)
}
obj.data = 'about:blank';
obj.data = 'about:blank'
if (!isIE) {
element.appendChild(obj);
element.appendChild(obj)
}
}
}
element.__resizeListeners__.push(fn);
};
element.__resizeListeners__.push(fn)
}
module.exports = (typeof window === 'undefined') ? exports : exports.bind(window)
{
"name": "element-resize-event",
"description": "Polyfill to make it easy to listen for element resize events",
"version": "2.0.4",
"version": "2.0.5",
"author": "Kyle Mathews <mathews.kyle@gmail.com>",

@@ -10,3 +10,6 @@ "bugs": {

"devDependencies": {
"browserify": "^8.1.3"
"browserify": "^8.1.3",
"eslint": "^2.10.2",
"eslint-config-airbnb-base": "^3.0.1",
"eslint-plugin-import": "^1.8.0"
},

@@ -13,0 +16,0 @@ "homepage": "https://github.com/KyleAMathews/element-resize-event",

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