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

element-resize-detector

Package Overview
Dependencies
Maintainers
1
Versions
41
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

element-resize-detector - npm Package Compare versions

Comparing version 0.2.3 to 0.2.5

67

build/element-resize-detector.js

@@ -135,3 +135,3 @@ (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.elementResizeDetectorMaker = f()}})(function(){var define,module,exports;return (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){

forEach(listeners, function(listener) {
forEach(listeners, function callListenerProxy(listener) {
listener(element);

@@ -170,3 +170,3 @@ });

forEach(elements, function(element) {
forEach(elements, function attachListenerToElement(element) {
//The element may change size directly after the call to listenTo, which would be unable to detect it because

@@ -180,3 +180,3 @@ //the async adding of the object. By checking the size before and after, the size change can still be detected

//The element is not prepared to be detectable, so do prepare it and add a listener to it.
return elementUtils.makeDetectable(reporter, element, function(element) {
return elementUtils.makeDetectable(reporter, element, function onElementDetectable(element) {
elementUtils.addListener(element, onResizeCallback);

@@ -276,19 +276,35 @@ onElementReadyToAddListener(callOnAdd, element, listener);

function onObjectLoad() {
/*jshint validthis:true */
/*jshint validthis: true */
function getDocument(element, callback) {
//Opera 12 seem to call the object.onload before the actual document has been created.
//So if it is not present, poll it with an timeout until it is present.
//TODO: Could maybe be handled better with object.onreadystatechange or similar.
if(!element.contentDocument) {
setTimeout(function checkForObjectDocument() {
getDocument(element, callback);
}, 100);
return;
}
callback(element.contentDocument);
}
//Create the style element to be added to the object.
var objectDocument = this.contentDocument;
var style = objectDocument.createElement("style");
style.innerHTML = "html, body { margin: 0; padding: 0 } div { -webkit-transition: opacity 0.01s; -ms-transition: opacity 0.01s; -o-transition: opacity 0.01s; transition: opacity 0.01s; opacity: 0; }";
getDocument(this, function onObjectDocumentReady(objectDocument) {
var style = objectDocument.createElement("style");
style.innerHTML = "html, body { margin: 0; padding: 0 } div { -webkit-transition: opacity 0.01s; -ms-transition: opacity 0.01s; -o-transition: opacity 0.01s; transition: opacity 0.01s; opacity: 0; }";
//TODO: Remove any styles that has been set on the object. Only the style above should be styling the object.
//TODO: Remove any styles that has been set on the object. Only the style above should be styling the object.
//Append the style to the object.
objectDocument.head.appendChild(style);
//Append the style to the object.
objectDocument.head.appendChild(style);
//TODO: Is this needed here?
//this.style.cssText = OBJECT_STYLE;
//TODO: Is this needed here?
//this.style.cssText = OBJECT_STYLE;
//Notify that the element is ready to be listened to.
callback(element);
//Notify that the element is ready to be listened to.
callback(element);
});
}

@@ -309,3 +325,3 @@

if(value !== "auto" && getNumericalValue(value) !== "0") {
reporter.warn("An element that is positioned static has style." + property + "=" + value + " which is ignored due to the static positioning. The element will need to be positioned relateive, so the style." + property + " will be set to 0. Element: ", element);
reporter.warn("An element that is positioned static has style." + property + "=" + value + " which is ignored due to the static positioning. The element will need to be positioned relative, so the style." + property + " will be set to 0. Element: ", element);
element.style[property] = 0;

@@ -328,3 +344,3 @@ }

object.onload = onObjectLoad;
object.setAttribute("erd-object-id", id);
object._erdObjectId = id;

@@ -365,4 +381,4 @@ //Safari: This must occur before adding the object to the DOM.

function getObject(element) {
return forEach(element.children, function(child) {
if(child.hasAttribute("erd-object-id")) {
return forEach(element.children, function isObject(child) {
if(child._erdObjectId !== undefined && child._erdObjectId !== null) {
return child;

@@ -404,2 +420,3 @@ }

module.exports = function(idGenerator) {
var ID_PROP_NAME = "_erdTargetId";

@@ -413,3 +430,3 @@ /**

function getId(element) {
return element.getAttribute("erd-target-id");
return element[ID_PROP_NAME];
}

@@ -430,3 +447,3 @@

element.setAttribute("erd-target-id", id);
element[ID_PROP_NAME] = id;

@@ -491,5 +508,5 @@ return id;

module.exports = function(quiet) {
var noop = function () {
function noop() {
//Does nothing.
};
}

@@ -504,3 +521,5 @@ var reporter = {

var attachFunction = function(reporter, name) {
reporter[name] = function() {
//The proxy is needed to be able to call the method with the console context,
//since we cannot use bind.
reporter[name] = function reporterProxy() {
console[name].apply(console, arguments);

@@ -519,2 +538,2 @@ };

});
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9ncnVudC1icm93c2VyaWZ5L25vZGVfbW9kdWxlcy9icm93c2VyaWZ5L25vZGVfbW9kdWxlcy9icm93c2VyLXBhY2svX3ByZWx1ZGUuanMiLCJzcmMvYnJvd3Nlci1kZXRlY3Rvci5qcyIsInNyYy9jb2xsZWN0aW9uLXV0aWxzLmpzIiwic3JjL2VsZW1lbnQtcmVzaXplLWRldGVjdG9yLmpzIiwic3JjL2VsZW1lbnQtdXRpbHMuanMiLCJzcmMvaWQtZ2VuZXJhdG9yLmpzIiwic3JjL2lkLWhhbmRsZXIuanMiLCJzcmMvbGlzdGVuZXItaGFuZGxlci5qcyIsInNyYy9yZXBvcnRlci5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTtBQ0FBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQT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amVjdC5vbnJlYWR5c3RhdGVjaGFuZ2Ugb3Igc2ltaWxhci5cbiAgICAgICAgICAgICAgICAgICAgaWYoIWVsZW1lbnQuY29udGVudERvY3VtZW50KSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBzZXRUaW1lb3V0KGZ1bmN0aW9uIGNoZWNrRm9yT2JqZWN0RG9jdW1lbnQoKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0RG9jdW1lbnQoZWxlbWVudCwgY2FsbGJhY2spO1xuICAgICAgICAgICAgICAgICAgICAgICAgfSwgMTAwKTtcblxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICAgICAgY2FsbGJhY2soZWxlbWVudC5jb250ZW50RG9jdW1lbnQpO1xuICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgIC8vQ3JlYXRlIHRoZSBzdHlsZSBlbGVtZW50IHRvIGJlIGFkZGVkIHRvIHRoZSBvYmplY3QuXG4gICAgICAgICAgICAgICAgZ2V0RG9jdW1lbnQodGhpcywgZnVuY3Rpb24gb25PYmplY3REb2N1bWVudFJlYWR5KG9iamVjdERvY3VtZW50KSB7XG4gICAgICAgICAgICAgICAgICAgIHZhciBzdHlsZSA9IG9iamVjdERvY3VtZW50LmNyZWF0ZUVsZW1lbnQoXCJzdHlsZVwiKTtcbiAgICAgICAgICAgICAgICAgICAgc3R5bGUuaW5uZXJIVE1MID0gXCJodG1sLCBib2R5IHsgbWFyZ2luOiAwOyBwYWRkaW5nOiAwIH0gZGl2IHsgLXdlYmtpdC10cmFuc2l0aW9uOiBvcGFjaXR5IDAuMDFzOyAtbXMtdHJhbnNpdGlvbjogb3BhY2l0eSAwLjAxczsgLW8tdHJhbnNpdGlvbjogb3BhY2l0eSAwLjAxczsgdHJhbnNpdGlvbjogb3BhY2l0eSAwLjAxczsgb3BhY2l0eTogMDsgfVwiO1xuXG4gICAgICA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AgICAgfTtcblxuICAgICAgICBhdHRhY2hGdW5jdGlvbihyZXBvcnRlciwgXCJsb2dcIik7XG4gICAgICAgIGF0dGFjaEZ1bmN0aW9uKHJlcG9ydGVyLCBcIndhcm5cIik7XG4gICAgICAgIGF0dGFjaEZ1bmN0aW9uKHJlcG9ydGVyLCBcImVycm9yXCIpO1xuICAgIH1cblxuICAgIHJldHVybiByZXBvcnRlcjtcbn07Il19
/*!
* element-resize-detector 0.2.1 (2015-03-23, 19:27)
* element-resize-detector 0.2.4 (2015-03-25, 14:46)
* https://github.com/wnr/element-resize-detector

@@ -141,3 +141,3 @@ * Licensed under MIT

forEach(listeners, function(listener) {
forEach(listeners, function callListenerProxy(listener) {
listener(element);

@@ -176,3 +176,3 @@ });

forEach(elements, function(element) {
forEach(elements, function attachListenerToElement(element) {
//The element may change size directly after the call to listenTo, which would be unable to detect it because

@@ -186,3 +186,3 @@ //the async adding of the object. By checking the size before and after, the size change can still be detected

//The element is not prepared to be detectable, so do prepare it and add a listener to it.
return elementUtils.makeDetectable(reporter, element, function(element) {
return elementUtils.makeDetectable(reporter, element, function onElementDetectable(element) {
elementUtils.addListener(element, onResizeCallback);

@@ -282,19 +282,35 @@ onElementReadyToAddListener(callOnAdd, element, listener);

function onObjectLoad() {
/*jshint validthis:true */
/*jshint validthis: true */
function getDocument(element, callback) {
//Opera 12 seem to call the object.onload before the actual document has been created.
//So if it is not present, poll it with an timeout until it is present.
//TODO: Could maybe be handled better with object.onreadystatechange or similar.
if(!element.contentDocument) {
setTimeout(function checkForObjectDocument() {
getDocument(element, callback);
}, 100);
return;
}
callback(element.contentDocument);
}
//Create the style element to be added to the object.
var objectDocument = this.contentDocument;
var style = objectDocument.createElement("style");
style.innerHTML = "html, body { margin: 0; padding: 0 } div { -webkit-transition: opacity 0.01s; -ms-transition: opacity 0.01s; -o-transition: opacity 0.01s; transition: opacity 0.01s; opacity: 0; }";
var objectDocument = getDocument(this, function onObjectDocumentReady(objectDocument) {
var style = objectDocument.createElement("style");
style.innerHTML = "html, body { margin: 0; padding: 0 } div { -webkit-transition: opacity 0.01s; -ms-transition: opacity 0.01s; -o-transition: opacity 0.01s; transition: opacity 0.01s; opacity: 0; }";
//TODO: Remove any styles that has been set on the object. Only the style above should be styling the object.
//TODO: Remove any styles that has been set on the object. Only the style above should be styling the object.
//Append the style to the object.
objectDocument.head.appendChild(style);
//Append the style to the object.
objectDocument.head.appendChild(style);
//TODO: Is this needed here?
//this.style.cssText = OBJECT_STYLE;
//TODO: Is this needed here?
//this.style.cssText = OBJECT_STYLE;
//Notify that the element is ready to be listened to.
callback(element);
//Notify that the element is ready to be listened to.
callback(element);
});
}

@@ -315,3 +331,3 @@

if(value !== "auto" && getNumericalValue(value) !== "0") {
reporter.warn("An element that is positioned static has style." + property + "=" + value + " which is ignored due to the static positioning. The element will need to be positioned relateive, so the style." + property + " will be set to 0. Element: ", element);
reporter.warn("An element that is positioned static has style." + property + "=" + value + " which is ignored due to the static positioning. The element will need to be positioned relative, so the style." + property + " will be set to 0. Element: ", element);
element.style[property] = 0;

@@ -334,3 +350,3 @@ }

object.onload = onObjectLoad;
object.setAttribute("erd-object-id", id);
object._erdObjectId = id;

@@ -371,4 +387,4 @@ //Safari: This must occur before adding the object to the DOM.

function getObject(element) {
return forEach(element.children, function(child) {
if(child.hasAttribute("erd-object-id")) {
return forEach(element.children, function isObject(child) {
if(child._erdObjectId !== undefined && child._erdObjectId !== null) {
return child;

@@ -410,2 +426,3 @@ }

module.exports = function(idGenerator) {
var ID_PROP_NAME = "_erdTargetId";

@@ -419,3 +436,3 @@ /**

function getId(element) {
return element.getAttribute("erd-target-id");
return element[ID_PROP_NAME];
}

@@ -436,3 +453,3 @@

element.setAttribute("erd-target-id", id);
element[ID_PROP_NAME] = id;

@@ -497,5 +514,5 @@ return id;

module.exports = function(quiet) {
var noop = function () {
function noop() {
//Does nothing.
};
}

@@ -509,5 +526,13 @@ var reporter = {

if(!quiet && window.console) {
reporter.log = console.log;
reporter.warn = console.warn;
reporter.error = console.error;
var attachFunction = function(reporter, name) {
//The proxy is needed to be able to call the method with the console context,
//since we cannot use bind.
reporter[name] = function reporterProxy() {
console[name].apply(console, arguments);
};
};
attachFunction(reporter, "log");
attachFunction(reporter, "warn");
attachFunction(reporter, "error");
}

@@ -514,0 +539,0 @@

/*!
* element-resize-detector 0.2.1 (2015-03-23, 19:27)
* element-resize-detector 0.2.4 (2015-03-25, 14:46)
* https://github.com/wnr/element-resize-detector

@@ -7,2 +7,2 @@ * Licensed under MIT

!function(a){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=a();else if("function"==typeof define&&define.amd)define([],a);else{var b;b="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,b.elementResizeDetectorMaker=a()}}(function(){return function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);var j=new Error("Cannot find module '"+g+"'");throw j.code="MODULE_NOT_FOUND",j}var k=c[g]={exports:{}};b[g][0].call(k.exports,function(a){var c=b[g][1][a];return e(c?c:a)},k,k.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g<d.length;g++)e(d[g]);return e}({1:[function(a,b){"use strict";var c=b.exports={};c.isIE=function(a){function b(){var a=navigator.userAgent.toLowerCase();return-1!==a.indexOf("msie")||-1!==a.indexOf("trident")}if(!b())return!1;if(!a)return!0;var c=function(){var a,b=3,c=document.createElement("div"),d=c.getElementsByTagName("i");do c.innerHTML="<!--[if gt IE "+ ++b+"]><i></i><![endif]-->";while(d[0]);return b>4?b:a}();return a===c}},{}],2:[function(a,b){"use strict";var c=b.exports={};c.forEach=function(a,b){for(var c=0;c<a.length;c++){var d=b(a[c]);if(d)return d}}},{}],3:[function(a,b){"use strict";function c(a,b,c){var d=a[b];return void 0!==d&&null!==d||void 0===c?d:c}var d=a("./collection-utils").forEach,e=a("./element-utils"),f=a("./listener-handler"),g=a("./id-generator"),h=a("./id-handler"),i=a("./reporter");b.exports=function(a){function b(a,b,e){function f(a){var b=p.get(a);d(b,function(b){b(a)})}function g(a,b,c){p.add(b,c),a&&c(b)}if(e||(e=b,b=a,a={}),!b)throw new Error("At least one element required.");if(!e)throw new Error("Listener required.");void 0===b.length&&(b=[b]);var h=c(a,"callOnAdd",j.callOnAdd);d(b,function(a){var b=a.offsetWidth,c=a.offsetHeight;return q.isDetectable(a)?void g(h,a,e):q.makeDetectable(n,a,function(a){q.addListener(a,f),g(h,a,e);var d=a.offsetWidth,i=a.offsetHeight;h||b===d&&c===i||e(a)})})}a=a||{};var j={};j.callOnAdd=!!c(a,"callOnAdd",!0);var k=a.idHandler;if(!k){var l=g(),m=h(l);k=m}var n=a.reporter;if(!n){var o=n===!1;n=i(o)}var p=f(k),q=e(k);return{listenTo:b}}},{"./collection-utils":2,"./element-utils":4,"./id-generator":5,"./id-handler":6,"./listener-handler":7,"./reporter":8}],4:[function(a,b){"use strict";var c=a("./collection-utils").forEach,d=a("./browser-detector");b.exports=function(a){function b(b){return d.isIE(8)?!!a.get(b):!!g(b)}function e(a,c){function e(){c(a)}if(!b(a))throw new Error("Element is not detectable.");if(d.isIE(8))a.attachEvent("onresize",e);else{var f=g(a);f.contentDocument.defaultView.addEventListener("resize",e)}}function f(b,c,e){function f(a,c,e){function f(){var a=this.contentDocument,b=a.createElement("style");b.innerHTML="html, body { margin: 0; padding: 0 } div { -webkit-transition: opacity 0.01s; -ms-transition: opacity 0.01s; -o-transition: opacity 0.01s; transition: opacity 0.01s; opacity: 0; }",a.head.appendChild(b),e(c)}var g="display: block; position: absolute; top: 0; left: 0; width: 100%; height: 100%; border: none; padding: 0; margin: 0; opacity: 0; z-index: -1000; pointer-events: none;",h=getComputedStyle(c);if("static"===h.position){c.style.position="relative";var i=function(a,b,c,d){function e(a){return a.replace(/[^-\d\.]/g,"")}var f=c[d];"auto"!==f&&"0"!==e(f)&&(a.warn("An element that is positioned static has style."+d+"="+f+" which is ignored due to the static positioning. The element will need to be positioned relateive, so the style."+d+" will be set to 0. Element: ",b),b.style[d]=0)};i(b,c,h,"top"),i(b,c,h,"right"),i(b,c,h,"bottom"),i(b,c,h,"left")}var j=document.createElement("object");j.type="text/html",j.style.cssText=g,j.onload=f,j.setAttribute("erd-object-id",a),d.isIE()||(j.data="about:blank"),c.appendChild(j),d.isIE()&&(j.data="about:blank")}var g=a.set(c);d.isIE(8)?e(c):f(g,c,e)}function g(a){return c(a.children,function(a){return a.hasAttribute("erd-object-id")?a:void 0})}return{isDetectable:b,makeDetectable:f,addListener:e}}},{"./browser-detector":1,"./collection-utils":2}],5:[function(a,b){"use strict";b.exports=function(){function a(){return b++}var b=1;return{generate:a}}},{}],6:[function(a,b){"use strict";b.exports=function(a){function b(a){return a.getAttribute("erd-target-id")}function c(b,c){return c||0===c||(c=a.generate()),b.setAttribute("erd-target-id",c),c}return{get:b,set:c}}},{}],7:[function(a,b){"use strict";b.exports=function(a){function b(b){return d[a.get(b)]}function c(b,c){var e=a.get(b);d[e]||(d[e]=[]),d[e].push(c)}var d={};return{get:b,add:c}}},{}],8:[function(a,b){"use strict";b.exports=function(a){var b=function(){},c={log:b,warn:b,error:b};return!a&&window.console&&(c.log=console.log,c.warn=console.warn,c.error=console.error),c}},{}]},{},[3])(3)});
!function(a){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=a();else if("function"==typeof define&&define.amd)define([],a);else{var b;b="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,b.elementResizeDetectorMaker=a()}}(function(){return function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);var j=new Error("Cannot find module '"+g+"'");throw j.code="MODULE_NOT_FOUND",j}var k=c[g]={exports:{}};b[g][0].call(k.exports,function(a){var c=b[g][1][a];return e(c?c:a)},k,k.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g<d.length;g++)e(d[g]);return e}({1:[function(a,b){"use strict";var c=b.exports={};c.isIE=function(a){function b(){var a=navigator.userAgent.toLowerCase();return-1!==a.indexOf("msie")||-1!==a.indexOf("trident")}if(!b())return!1;if(!a)return!0;var c=function(){var a,b=3,c=document.createElement("div"),d=c.getElementsByTagName("i");do c.innerHTML="<!--[if gt IE "+ ++b+"]><i></i><![endif]-->";while(d[0]);return b>4?b:a}();return a===c}},{}],2:[function(a,b){"use strict";var c=b.exports={};c.forEach=function(a,b){for(var c=0;c<a.length;c++){var d=b(a[c]);if(d)return d}}},{}],3:[function(a,b){"use strict";function c(a,b,c){var d=a[b];return void 0!==d&&null!==d||void 0===c?d:c}var d=a("./collection-utils").forEach,e=a("./element-utils"),f=a("./listener-handler"),g=a("./id-generator"),h=a("./id-handler"),i=a("./reporter");b.exports=function(a){function b(a,b,e){function f(a){var b=p.get(a);d(b,function(b){b(a)})}function g(a,b,c){p.add(b,c),a&&c(b)}if(e||(e=b,b=a,a={}),!b)throw new Error("At least one element required.");if(!e)throw new Error("Listener required.");void 0===b.length&&(b=[b]);var h=c(a,"callOnAdd",j.callOnAdd);d(b,function(a){var b=a.offsetWidth,c=a.offsetHeight;return q.isDetectable(a)?void g(h,a,e):q.makeDetectable(n,a,function(a){q.addListener(a,f),g(h,a,e);var d=a.offsetWidth,i=a.offsetHeight;h||b===d&&c===i||e(a)})})}a=a||{};var j={};j.callOnAdd=!!c(a,"callOnAdd",!0);var k=a.idHandler;if(!k){var l=g(),m=h(l);k=m}var n=a.reporter;if(!n){var o=n===!1;n=i(o)}var p=f(k),q=e(k);return{listenTo:b}}},{"./collection-utils":2,"./element-utils":4,"./id-generator":5,"./id-handler":6,"./listener-handler":7,"./reporter":8}],4:[function(a,b){"use strict";var c=a("./collection-utils").forEach,d=a("./browser-detector");b.exports=function(a){function b(b){return d.isIE(8)?!!a.get(b):!!g(b)}function e(a,c){function e(){c(a)}if(!b(a))throw new Error("Element is not detectable.");if(d.isIE(8))a.attachEvent("onresize",e);else{var f=g(a);f.contentDocument.defaultView.addEventListener("resize",e)}}function f(b,c,e){function f(a,c,e){function f(){function a(b,c){return b.contentDocument?void c(b.contentDocument):void setTimeout(function(){a(b,c)},100)}a(this,function(a){var b=a.createElement("style");b.innerHTML="html, body { margin: 0; padding: 0 } div { -webkit-transition: opacity 0.01s; -ms-transition: opacity 0.01s; -o-transition: opacity 0.01s; transition: opacity 0.01s; opacity: 0; }",a.head.appendChild(b),e(c)})}var g="display: block; position: absolute; top: 0; left: 0; width: 100%; height: 100%; border: none; padding: 0; margin: 0; opacity: 0; z-index: -1000; pointer-events: none;",h=getComputedStyle(c);if("static"===h.position){c.style.position="relative";var i=function(a,b,c,d){function e(a){return a.replace(/[^-\d\.]/g,"")}var f=c[d];"auto"!==f&&"0"!==e(f)&&(a.warn("An element that is positioned static has style."+d+"="+f+" which is ignored due to the static positioning. The element will need to be positioned relative, so the style."+d+" will be set to 0. Element: ",b),b.style[d]=0)};i(b,c,h,"top"),i(b,c,h,"right"),i(b,c,h,"bottom"),i(b,c,h,"left")}var j=document.createElement("object");j.type="text/html",j.style.cssText=g,j.onload=f,j._erdObjectId=a,d.isIE()||(j.data="about:blank"),c.appendChild(j),d.isIE()&&(j.data="about:blank")}var g=a.set(c);d.isIE(8)?e(c):f(g,c,e)}function g(a){return c(a.children,function(a){return void 0!==a._erdObjectId&&null!==a._erdObjectId?a:void 0})}return{isDetectable:b,makeDetectable:f,addListener:e}}},{"./browser-detector":1,"./collection-utils":2}],5:[function(a,b){"use strict";b.exports=function(){function a(){return b++}var b=1;return{generate:a}}},{}],6:[function(a,b){"use strict";b.exports=function(a){function b(a){return a[d]}function c(b,c){return c||0===c||(c=a.generate()),b[d]=c,c}var d="_erdTargetId";return{get:b,set:c}}},{}],7:[function(a,b){"use strict";b.exports=function(a){function b(b){return d[a.get(b)]}function c(b,c){var e=a.get(b);d[e]||(d[e]=[]),d[e].push(c)}var d={};return{get:b,add:c}}},{}],8:[function(a,b){"use strict";b.exports=function(a){function b(){}var c={log:b,warn:b,error:b};if(!a&&window.console){var d=function(a,b){a[b]=function(){console[b].apply(console,arguments)}};d(c,"log"),d(c,"warn"),d(c,"error")}return c}},{}]},{},[3])(3)});
{
"name": "element-resize-detector",
"version": "0.2.3",
"version": "0.2.5",
"description": "resize event emitter for elements.",

@@ -5,0 +5,0 @@ "homepage": "https://github.com/wnr/element-resize-detector",

@@ -76,3 +76,3 @@ //Heavily inspired by http://www.backalleycoder.com/2013/03/18/cross-browser-event-based-element-resize-detection/

forEach(listeners, function(listener) {
forEach(listeners, function callListenerProxy(listener) {
listener(element);

@@ -111,3 +111,3 @@ });

forEach(elements, function(element) {
forEach(elements, function attachListenerToElement(element) {
//The element may change size directly after the call to listenTo, which would be unable to detect it because

@@ -121,3 +121,3 @@ //the async adding of the object. By checking the size before and after, the size change can still be detected

//The element is not prepared to be detectable, so do prepare it and add a listener to it.
return elementUtils.makeDetectable(reporter, element, function(element) {
return elementUtils.makeDetectable(reporter, element, function onElementDetectable(element) {
elementUtils.addListener(element, onResizeCallback);

@@ -124,0 +124,0 @@ onElementReadyToAddListener(callOnAdd, element, listener);

@@ -58,19 +58,35 @@ "use strict";

function onObjectLoad() {
/*jshint validthis:true */
/*jshint validthis: true */
function getDocument(element, callback) {
//Opera 12 seem to call the object.onload before the actual document has been created.
//So if it is not present, poll it with an timeout until it is present.
//TODO: Could maybe be handled better with object.onreadystatechange or similar.
if(!element.contentDocument) {
setTimeout(function checkForObjectDocument() {
getDocument(element, callback);
}, 100);
return;
}
callback(element.contentDocument);
}
//Create the style element to be added to the object.
var objectDocument = this.contentDocument;
var style = objectDocument.createElement("style");
style.innerHTML = "html, body { margin: 0; padding: 0 } div { -webkit-transition: opacity 0.01s; -ms-transition: opacity 0.01s; -o-transition: opacity 0.01s; transition: opacity 0.01s; opacity: 0; }";
getDocument(this, function onObjectDocumentReady(objectDocument) {
var style = objectDocument.createElement("style");
style.innerHTML = "html, body { margin: 0; padding: 0 } div { -webkit-transition: opacity 0.01s; -ms-transition: opacity 0.01s; -o-transition: opacity 0.01s; transition: opacity 0.01s; opacity: 0; }";
//TODO: Remove any styles that has been set on the object. Only the style above should be styling the object.
//TODO: Remove any styles that has been set on the object. Only the style above should be styling the object.
//Append the style to the object.
objectDocument.head.appendChild(style);
//Append the style to the object.
objectDocument.head.appendChild(style);
//TODO: Is this needed here?
//this.style.cssText = OBJECT_STYLE;
//TODO: Is this needed here?
//this.style.cssText = OBJECT_STYLE;
//Notify that the element is ready to be listened to.
callback(element);
//Notify that the element is ready to be listened to.
callback(element);
});
}

@@ -91,3 +107,3 @@

if(value !== "auto" && getNumericalValue(value) !== "0") {
reporter.warn("An element that is positioned static has style." + property + "=" + value + " which is ignored due to the static positioning. The element will need to be positioned relateive, so the style." + property + " will be set to 0. Element: ", element);
reporter.warn("An element that is positioned static has style." + property + "=" + value + " which is ignored due to the static positioning. The element will need to be positioned relative, so the style." + property + " will be set to 0. Element: ", element);
element.style[property] = 0;

@@ -110,3 +126,3 @@ }

object.onload = onObjectLoad;
object.setAttribute("erd-object-id", id);
object._erdObjectId = id;

@@ -147,4 +163,4 @@ //Safari: This must occur before adding the object to the DOM.

function getObject(element) {
return forEach(element.children, function(child) {
if(child.hasAttribute("erd-object-id")) {
return forEach(element.children, function isObject(child) {
if(child._erdObjectId !== undefined && child._erdObjectId !== null) {
return child;

@@ -151,0 +167,0 @@ }

"use strict";
module.exports = function(idGenerator) {
var ID_PROP_NAME = "_erdTargetId";

@@ -12,3 +13,3 @@ /**

function getId(element) {
return element.getAttribute("erd-target-id");
return element[ID_PROP_NAME];
}

@@ -29,3 +30,3 @@

element.setAttribute("erd-target-id", id);
element[ID_PROP_NAME] = id;

@@ -32,0 +33,0 @@ return id;

@@ -11,5 +11,5 @@ "use strict";

module.exports = function(quiet) {
var noop = function () {
function noop() {
//Does nothing.
};
}

@@ -24,3 +24,5 @@ var reporter = {

var attachFunction = function(reporter, name) {
reporter[name] = function() {
//The proxy is needed to be able to call the method with the console context,
//since we cannot use bind.
reporter[name] = function reporterProxy() {
console[name].apply(console, arguments);

@@ -27,0 +29,0 @@ };

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