Comparing version 3.0.18 to 3.0.19
## Changelog | ||
##### v.3.0.19 - 2016-11-23 | ||
* Bubble dispatched events. Merged #319. | ||
##### v.3.0.18 - 2016-10-26 | ||
@@ -4,0 +7,0 @@ * Fixed Firefox issue where calling dispatchEvent on a detached element throws an error. Fixes #317. |
/*! | ||
Autosize 3.0.18 | ||
Autosize 3.0.19 | ||
license: MIT | ||
@@ -21,3 +21,3 @@ http://www.jacklmoore.com/autosize | ||
var map = typeof Map === 'function' ? new Map() : (function () { | ||
var map = typeof Map === "function" ? new Map() : (function () { | ||
var keys = []; | ||
@@ -45,7 +45,8 @@ var values = []; | ||
} | ||
} }; | ||
} | ||
}; | ||
})(); | ||
var createEvent = function createEvent(name) { | ||
return new Event(name); | ||
return new Event(name, { bubbles: true }); | ||
}; | ||
@@ -118,3 +119,4 @@ try { | ||
node: el.parentNode, | ||
scrollTop: el.parentNode.scrollTop }); | ||
scrollTop: el.parentNode.scrollTop | ||
}); | ||
} | ||
@@ -182,3 +184,6 @@ el = el.parentNode; | ||
ta.dispatchEvent(evt); | ||
} catch (err) {} | ||
} catch (err) { | ||
// Firefox will throw an error on dispatchEvent for a detached element | ||
// https://bugzilla.mozilla.org/show_bug.cgi?id=889376 | ||
} | ||
} | ||
@@ -210,3 +215,4 @@ } | ||
overflowX: ta.style.overflowX, | ||
wordWrap: ta.style.wordWrap }); | ||
wordWrap: ta.style.wordWrap | ||
}); | ||
@@ -230,3 +236,4 @@ ta.addEventListener('autosize:destroy', destroy, false); | ||
destroy: destroy, | ||
update: update }); | ||
update: update | ||
}); | ||
@@ -287,5 +294,2 @@ init(); | ||
module.exports = autosize; | ||
}); | ||
// Firefox will throw an error on dispatchEvent for a detached element | ||
// https://bugzilla.mozilla.org/show_bug.cgi?id=889376 | ||
}); |
/*! | ||
Autosize 3.0.18 | ||
Autosize 3.0.19 | ||
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);"vertical"===t.resize?e.style.resize="none":"both"===t.resize&&(e.style.resize="horizontal"),l="content-box"===t.boxSizing?-(parseFloat(t.paddingTop)+parseFloat(t.paddingBottom)):parseFloat(t.borderTopWidth)+parseFloat(t.borderBottomWidth),isNaN(l)&&(l=0),s()}function n(t){var n=e.style.width;e.style.width="0px",e.offsetWidth,e.style.width=n,e.style.overflowY=t,r()}function o(e){for(var t=[];e&&e.parentNode&&e.parentNode instanceof Element;)e.parentNode.scrollTop&&t.push({node:e.parentNode,scrollTop:e.parentNode.scrollTop}),e=e.parentNode;return t}function r(){var t=e.style.height,n=o(e),r=document.documentElement&&document.documentElement.scrollTop;e.style.height="auto";var i=e.scrollHeight+l;return 0===e.scrollHeight?void(e.style.height=t):(e.style.height=i+"px",u=e.clientWidth,n.forEach(function(e){e.node.scrollTop=e.scrollTop}),void(r&&(document.documentElement.scrollTop=r)))}function s(){r();var t=window.getComputedStyle(e,null),o=Math.round(parseFloat(t.height)),i=Math.round(parseFloat(e.style.height));if(o!==i?"visible"!==t.overflowY&&n("visible"):"hidden"!==t.overflowY&&n("hidden"),a!==o){a=o;var s=d("autosize:resized");try{e.dispatchEvent(s)}catch(l){}}}if(e&&e.nodeName&&"TEXTAREA"===e.nodeName&&!i.has(e)){var l=null,u=e.clientWidth,a=null,c=function(){e.clientWidth!==u&&s()},p=function(t){window.removeEventListener("resize",c,!1),e.removeEventListener("input",s,!1),e.removeEventListener("keyup",s,!1),e.removeEventListener("autosize:destroy",p,!1),e.removeEventListener("autosize:update",s,!1),Object.keys(t).forEach(function(n){e.style[n]=t[n]}),i["delete"](e)}.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",p,!1),"onpropertychange"in e&&"oninput"in e&&e.addEventListener("keyup",s,!1),window.addEventListener("resize",c,!1),e.addEventListener("input",s,!1),e.addEventListener("autosize:update",s,!1),e.style.overflowX="hidden",e.style.wordWrap="break-word",i.set(e,{destroy:p,update:s}),t()}}function o(e){var t=i.get(e);t&&t.destroy()}function r(e){var t=i.get(e);t&&t.update()}var i="function"==typeof Map?new Map:function(){var e=[],t=[];return{has:function(t){return e.indexOf(t)>-1},get:function(n){return t[e.indexOf(n)]},set:function(n,o){-1===e.indexOf(n)&&(e.push(n),t.push(o))},"delete":function(n){var o=e.indexOf(n);o>-1&&(e.splice(o,1),t.splice(o,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 l=null;"undefined"==typeof window||"function"!=typeof window.getComputedStyle?(l=function(e){return e},l.destroy=function(e){return e},l.update=function(e){return e}):(l=function(e,t){return e&&Array.prototype.forEach.call(e.length?e:[e],function(e){return n(e,t)}),e},l.destroy=function(e){return e&&Array.prototype.forEach.call(e.length?e:[e],o),e},l.update=function(e){return e&&Array.prototype.forEach.call(e.length?e:[e],r),e}),t.exports=l}); | ||
!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);"vertical"===t.resize?e.style.resize="none":"both"===t.resize&&(e.style.resize="horizontal"),l="content-box"===t.boxSizing?-(parseFloat(t.paddingTop)+parseFloat(t.paddingBottom)):parseFloat(t.borderTopWidth)+parseFloat(t.borderBottomWidth),isNaN(l)&&(l=0),s()}function n(t){var n=e.style.width;e.style.width="0px",e.offsetWidth,e.style.width=n,e.style.overflowY=t,r()}function o(e){for(var t=[];e&&e.parentNode&&e.parentNode instanceof Element;)e.parentNode.scrollTop&&t.push({node:e.parentNode,scrollTop:e.parentNode.scrollTop}),e=e.parentNode;return t}function r(){var t=e.style.height,n=o(e),r=document.documentElement&&document.documentElement.scrollTop;e.style.height="auto";var i=e.scrollHeight+l;return 0===e.scrollHeight?void(e.style.height=t):(e.style.height=i+"px",u=e.clientWidth,n.forEach(function(e){e.node.scrollTop=e.scrollTop}),void(r&&(document.documentElement.scrollTop=r)))}function s(){r();var t=window.getComputedStyle(e,null),o=Math.round(parseFloat(t.height)),i=Math.round(parseFloat(e.style.height));if(o!==i?"visible"!==t.overflowY&&n("visible"):"hidden"!==t.overflowY&&n("hidden"),a!==o){a=o;var s=d("autosize:resized");try{e.dispatchEvent(s)}catch(e){}}}if(e&&e.nodeName&&"TEXTAREA"===e.nodeName&&!i.has(e)){var l=null,u=e.clientWidth,a=null,c=function(){e.clientWidth!==u&&s()},p=function(t){window.removeEventListener("resize",c,!1),e.removeEventListener("input",s,!1),e.removeEventListener("keyup",s,!1),e.removeEventListener("autosize:destroy",p,!1),e.removeEventListener("autosize:update",s,!1),Object.keys(t).forEach(function(n){e.style[n]=t[n]}),i.delete(e)}.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",p,!1),"onpropertychange"in e&&"oninput"in e&&e.addEventListener("keyup",s,!1),window.addEventListener("resize",c,!1),e.addEventListener("input",s,!1),e.addEventListener("autosize:update",s,!1),e.style.overflowX="hidden",e.style.wordWrap="break-word",i.set(e,{destroy:p,update:s}),t()}}function o(e){var t=i.get(e);t&&t.destroy()}function r(e){var t=i.get(e);t&&t.update()}var i="function"==typeof Map?new Map:function(){var e=[],t=[];return{has:function(t){return e.indexOf(t)>-1},get:function(n){return t[e.indexOf(n)]},set:function(n,o){e.indexOf(n)===-1&&(e.push(n),t.push(o))},delete:function(n){var o=e.indexOf(n);o>-1&&(e.splice(o,1),t.splice(o,1))}}}(),d=function(e){return new Event(e,{bubbles:!0})};try{new Event("test")}catch(e){d=function(e){var t=document.createEvent("Event");return t.initEvent(e,!0,!1),t}}var s=null;"undefined"==typeof window||"function"!=typeof window.getComputedStyle?(s=function(e){return e},s.destroy=function(e){return e},s.update=function(e){return e}):(s=function(e,t){return e&&Array.prototype.forEach.call(e.length?e:[e],function(e){return n(e,t)}),e},s.destroy=function(e){return e&&Array.prototype.forEach.call(e.length?e:[e],o),e},s.update=function(e){return e&&Array.prototype.forEach.call(e.length?e:[e],r),e}),t.exports=s}); |
{ | ||
"name": "autosize", | ||
"description": "Autosize is a small, stand-alone script to automatically adjust textarea height to fit text.", | ||
"version": "3.0.18", | ||
"version": "3.0.19", | ||
"keywords": [ | ||
@@ -30,5 +30,5 @@ "textarea", | ||
"babel": "^5.4.3", | ||
"gaze": "^0.5.1", | ||
"jshint": "^2.5.6", | ||
"uglify-js": "^2.4.22" | ||
"gaze": "^1.1.2", | ||
"jshint": "^2.9.4", | ||
"uglify-js": "^2.7.4" | ||
}, | ||
@@ -35,0 +35,0 @@ "config": { |
@@ -28,3 +28,3 @@ const map = (typeof Map === "function") ? new Map() : (function () { | ||
let createEvent = (name)=> new Event(name); | ||
let createEvent = (name)=> new Event(name, {bubbles: true}); | ||
try { | ||
@@ -31,0 +31,0 @@ new Event('test'); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
23403
468