autosize
Advanced tools
Comparing version 3.0.14 to 3.0.15
## Changelog | ||
##### v.3.0.15 - 2016-1-26 | ||
* Used newer Event constructor, when available. Fixes #280. | ||
##### v.3.0.14 - 2015-11-11 | ||
@@ -45,3 +48,3 @@ * Fixed memory leak on destroy. Merged #271, fixes #270. | ||
##### v.3.0.1 - 2015-04-23 | ||
* Fixed the destroy event so that it removes it's own event handler. Fixes #218. | ||
* Fixed the destroy event so that it removes its own event handler. Fixes #218. | ||
@@ -48,0 +51,0 @@ ##### v.3.0.0 - 2015-04-15 |
/*! | ||
Autosize 3.0.14 | ||
Autosize 3.0.15 | ||
license: MIT | ||
@@ -36,2 +36,16 @@ http://www.jacklmoore.com/autosize | ||
var createEvent = function createEvent(name) { | ||
return new Event(name); | ||
}; | ||
try { | ||
new Event('test'); | ||
} catch (e) { | ||
// IE does not support `new Event()` | ||
createEvent = function (name) { | ||
var evt = document.createEvent('Event'); | ||
evt.initEvent(name, true, false); | ||
return evt; | ||
}; | ||
} | ||
function assign(ta) { | ||
@@ -141,4 +155,3 @@ var _ref = arguments[1] === undefined ? {} : arguments[1]; | ||
if (startHeight !== ta.style.height) { | ||
var evt = document.createEvent('Event'); | ||
evt.initEvent('autosize:resized', true, false); | ||
var evt = createEvent('autosize:resized'); | ||
ta.dispatchEvent(evt); | ||
@@ -196,4 +209,3 @@ } | ||
if (!(ta && ta.nodeName && ta.nodeName === 'TEXTAREA')) return; | ||
var evt = document.createEvent('Event'); | ||
evt.initEvent('autosize:destroy', true, false); | ||
var evt = createEvent('autosize:destroy'); | ||
ta.dispatchEvent(evt); | ||
@@ -204,4 +216,3 @@ } | ||
if (!(ta && ta.nodeName && ta.nodeName === 'TEXTAREA')) return; | ||
var evt = document.createEvent('Event'); | ||
evt.initEvent('autosize:update', true, false); | ||
var evt = createEvent('autosize:update'); | ||
ta.dispatchEvent(evt); | ||
@@ -208,0 +219,0 @@ } |
/*! | ||
Autosize 3.0.14 | ||
Autosize 3.0.15 | ||
license: MIT | ||
http://www.jacklmoore.com/autosize | ||
*/ | ||
!function(e,t){if("function"==typeof define&&define.amd)define(["exports","module"],t);else if("undefined"!=typeof exports&&"undefined"!=typeof module)t(exports,module);else{var n={exports:{}};t(n.exports,n),e.autosize=n.exports}}(this,function(e,t){"use strict";function n(e){function t(){var t=window.getComputedStyle(e,null);c=t.overflowY,"vertical"===t.resize?e.style.resize="none":"both"===t.resize&&(e.style.resize="horizontal"),f="content-box"===t.boxSizing?-(parseFloat(t.paddingTop)+parseFloat(t.paddingBottom)):parseFloat(t.borderTopWidth)+parseFloat(t.borderBottomWidth),isNaN(f)&&(f=0),i()}function n(t){var n=e.style.width;e.style.width="0px",e.offsetWidth,e.style.width=n,c=t,u&&(e.style.overflowY=t),o()}function o(){var t=window.pageYOffset,n=document.body.scrollTop,o=e.style.height;e.style.height="auto";var i=e.scrollHeight+f;return 0===e.scrollHeight?void(e.style.height=o):(e.style.height=i+"px",v=e.clientWidth,document.documentElement.scrollTop=t,void(document.body.scrollTop=n))}function i(){var t=e.style.height;o();var i=window.getComputedStyle(e,null);if(i.height!==e.style.height?"visible"!==c&&n("visible"):"hidden"!==c&&n("hidden"),t!==e.style.height){var r=document.createEvent("Event");r.initEvent("autosize:resized",!0,!1),e.dispatchEvent(r)}}var d=void 0===arguments[1]?{}:arguments[1],s=d.setOverflowX,l=void 0===s?!0:s,a=d.setOverflowY,u=void 0===a?!0:a;if(e&&e.nodeName&&"TEXTAREA"===e.nodeName&&!r.has(e)){var f=null,c=null,v=e.clientWidth,p=function(){e.clientWidth!==v&&i()},h=function(t){window.removeEventListener("resize",p,!1),e.removeEventListener("input",i,!1),e.removeEventListener("keyup",i,!1),e.removeEventListener("autosize:destroy",h,!1),e.removeEventListener("autosize:update",i,!1),r["delete"](e),Object.keys(t).forEach(function(n){e.style[n]=t[n]})}.bind(e,{height:e.style.height,resize:e.style.resize,overflowY:e.style.overflowY,overflowX:e.style.overflowX,wordWrap:e.style.wordWrap});e.addEventListener("autosize:destroy",h,!1),"onpropertychange"in e&&"oninput"in e&&e.addEventListener("keyup",i,!1),window.addEventListener("resize",p,!1),e.addEventListener("input",i,!1),e.addEventListener("autosize:update",i,!1),r.add(e),l&&(e.style.overflowX="hidden",e.style.wordWrap="break-word"),t()}}function o(e){if(e&&e.nodeName&&"TEXTAREA"===e.nodeName){var t=document.createEvent("Event");t.initEvent("autosize:destroy",!0,!1),e.dispatchEvent(t)}}function i(e){if(e&&e.nodeName&&"TEXTAREA"===e.nodeName){var t=document.createEvent("Event");t.initEvent("autosize:update",!0,!1),e.dispatchEvent(t)}}var r="function"==typeof Set?new Set:function(){var e=[];return{has:function(t){return Boolean(e.indexOf(t)>-1)},add:function(t){e.push(t)},"delete":function(t){e.splice(e.indexOf(t),1)}}}(),d=null;"undefined"==typeof window||"function"!=typeof window.getComputedStyle?(d=function(e){return e},d.destroy=function(e){return e},d.update=function(e){return e}):(d=function(e,t){return e&&Array.prototype.forEach.call(e.length?e:[e],function(e){return n(e,t)}),e},d.destroy=function(e){return e&&Array.prototype.forEach.call(e.length?e:[e],o),e},d.update=function(e){return e&&Array.prototype.forEach.call(e.length?e:[e],i),e}),t.exports=d}); | ||
!function(e,t){if("function"==typeof define&&define.amd)define(["exports","module"],t);else if("undefined"!=typeof exports&&"undefined"!=typeof module)t(exports,module);else{var n={exports:{}};t(n.exports,n),e.autosize=n.exports}}(this,function(e,t){"use strict";function n(e){function t(){var t=window.getComputedStyle(e,null);p=t.overflowY,"vertical"===t.resize?e.style.resize="none":"both"===t.resize&&(e.style.resize="horizontal"),c="content-box"===t.boxSizing?-(parseFloat(t.paddingTop)+parseFloat(t.paddingBottom)):parseFloat(t.borderTopWidth)+parseFloat(t.borderBottomWidth),isNaN(c)&&(c=0),i()}function n(t){var n=e.style.width;e.style.width="0px",e.offsetWidth,e.style.width=n,p=t,f&&(e.style.overflowY=t),o()}function o(){var t=window.pageYOffset,n=document.body.scrollTop,o=e.style.height;e.style.height="auto";var i=e.scrollHeight+c;return 0===e.scrollHeight?void(e.style.height=o):(e.style.height=i+"px",v=e.clientWidth,document.documentElement.scrollTop=t,void(document.body.scrollTop=n))}function i(){var t=e.style.height;o();var i=window.getComputedStyle(e,null);if(i.height!==e.style.height?"visible"!==p&&n("visible"):"hidden"!==p&&n("hidden"),t!==e.style.height){var r=d("autosize:resized");e.dispatchEvent(r)}}var s=void 0===arguments[1]?{}:arguments[1],a=s.setOverflowX,l=void 0===a?!0:a,u=s.setOverflowY,f=void 0===u?!0:u;if(e&&e.nodeName&&"TEXTAREA"===e.nodeName&&!r.has(e)){var c=null,p=null,v=e.clientWidth,h=function(){e.clientWidth!==v&&i()},y=function(t){window.removeEventListener("resize",h,!1),e.removeEventListener("input",i,!1),e.removeEventListener("keyup",i,!1),e.removeEventListener("autosize:destroy",y,!1),e.removeEventListener("autosize:update",i,!1),r["delete"](e),Object.keys(t).forEach(function(n){e.style[n]=t[n]})}.bind(e,{height:e.style.height,resize:e.style.resize,overflowY:e.style.overflowY,overflowX:e.style.overflowX,wordWrap:e.style.wordWrap});e.addEventListener("autosize:destroy",y,!1),"onpropertychange"in e&&"oninput"in e&&e.addEventListener("keyup",i,!1),window.addEventListener("resize",h,!1),e.addEventListener("input",i,!1),e.addEventListener("autosize:update",i,!1),r.add(e),l&&(e.style.overflowX="hidden",e.style.wordWrap="break-word"),t()}}function o(e){if(e&&e.nodeName&&"TEXTAREA"===e.nodeName){var t=d("autosize:destroy");e.dispatchEvent(t)}}function i(e){if(e&&e.nodeName&&"TEXTAREA"===e.nodeName){var t=d("autosize:update");e.dispatchEvent(t)}}var r="function"==typeof Set?new Set:function(){var e=[];return{has:function(t){return Boolean(e.indexOf(t)>-1)},add:function(t){e.push(t)},"delete":function(t){e.splice(e.indexOf(t),1)}}}(),d=function(e){return new Event(e)};try{new Event("test")}catch(s){d=function(e){var t=document.createEvent("Event");return t.initEvent(e,!0,!1),t}}var a=null;"undefined"==typeof window||"function"!=typeof window.getComputedStyle?(a=function(e){return e},a.destroy=function(e){return e},a.update=function(e){return e}):(a=function(e,t){return e&&Array.prototype.forEach.call(e.length?e:[e],function(e){return n(e,t)}),e},a.destroy=function(e){return e&&Array.prototype.forEach.call(e.length?e:[e],o),e},a.update=function(e){return e&&Array.prototype.forEach.call(e.length?e:[e],i),e}),t.exports=a}); |
{ | ||
"name": "autosize", | ||
"description": "Autosize is a small, stand-alone script to automatically adjust textarea height to fit text.", | ||
"version": "3.0.14", | ||
"version": "3.0.15", | ||
"keywords": [ | ||
@@ -10,2 +10,6 @@ "textarea", | ||
], | ||
"files": [ | ||
"dist", | ||
"src" | ||
], | ||
"author": { | ||
@@ -12,0 +16,0 @@ "name": "Jack Moore", |
@@ -13,6 +13,2 @@ ## Summary | ||
``` | ||
#### Install via Bower | ||
```bash | ||
bower install autosize | ||
``` | ||
@@ -19,0 +15,0 @@ #### Browser compatibility |
@@ -17,2 +17,14 @@ const set = (typeof Set === "function") ? new Set() : (function () { | ||
let createEvent = (name)=> new Event(name); | ||
try { | ||
new Event('test'); | ||
} catch(e) { | ||
// IE does not support `new Event()` | ||
createEvent = (name)=> { | ||
const evt = document.createEvent('Event'); | ||
evt.initEvent(name, true, false); | ||
return evt; | ||
}; | ||
} | ||
function assign(ta, {setOverflowX = true, setOverflowY = true} = {}) { | ||
@@ -115,4 +127,3 @@ if (!ta || !ta.nodeName || ta.nodeName !== 'TEXTAREA' || set.has(ta)) return; | ||
if (startHeight !== ta.style.height) { | ||
const evt = document.createEvent('Event'); | ||
evt.initEvent('autosize:resized', true, false); | ||
const evt = createEvent('autosize:resized'); | ||
ta.dispatchEvent(evt); | ||
@@ -171,4 +182,3 @@ } | ||
if (!(ta && ta.nodeName && ta.nodeName === 'TEXTAREA')) return; | ||
const evt = document.createEvent('Event'); | ||
evt.initEvent('autosize:destroy', true, false); | ||
const evt = createEvent('autosize:destroy'); | ||
ta.dispatchEvent(evt); | ||
@@ -179,4 +189,3 @@ } | ||
if (!(ta && ta.nodeName && ta.nodeName === 'TEXTAREA')) return; | ||
const evt = document.createEvent('Event'); | ||
evt.initEvent('autosize:update', true, false); | ||
const evt = createEvent('autosize:update'); | ||
ta.dispatchEvent(evt); | ||
@@ -183,0 +192,0 @@ } |
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
0
20936
7
397
36