[Pkg-javascript-commits] [autosize.js] 01/05: Imported Upstream version 3.0.15~dfsg1

Alexandre Viau aviau at moszumanska.debian.org
Wed Mar 23 16:03:24 UTC 2016


This is an automated email from the git hooks/post-receive script.

aviau pushed a commit to branch master
in repository autosize.js.

commit e78377f53d5b70954aa2651263ce1b6265ff776b
Author: aviau <alexandre at alexandreviau.net>
Date:   Wed Mar 23 11:54:31 2016 -0400

    Imported Upstream version 3.0.15~dfsg1
---
 LICENSE.md       | 21 +++++++++++++++++++++
 changelog.md     |  5 ++++-
 dist/autosize.js | 25 ++++++++++++++++++-------
 package.json     |  6 +++++-
 readme.md        |  4 ----
 src/autosize.js  | 21 +++++++++++++++------
 6 files changed, 63 insertions(+), 19 deletions(-)

diff --git a/LICENSE.md b/LICENSE.md
new file mode 100644
index 0000000..2de673b
--- /dev/null
+++ b/LICENSE.md
@@ -0,0 +1,21 @@
+The MIT License (MIT)
+
+Copyright (c) 2015 Jack Moore
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
\ No newline at end of file
diff --git a/changelog.md b/changelog.md
index 8a2ac39..52604a3 100644
--- a/changelog.md
+++ b/changelog.md
@@ -1,5 +1,8 @@
 ## Changelog
 
+##### v.3.0.15 - 2016-1-26
+* Used newer Event constructor, when available. Fixes #280.
+
 ##### v.3.0.14 - 2015-11-11
 * Fixed memory leak on destroy. Merged #271, fixes #270.
 * Fixed bug in old versions of Firefox (1-5), fixes #246.
@@ -42,7 +45,7 @@
 * Reworked to respect max-height of any unit-type.  Fixes #191.
 
 ##### 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.
 
 ##### v.3.0.0 - 2015-04-15
 * Added new methods for updating and destroying:
diff --git a/dist/autosize.js b/dist/autosize.js
index cfa49e7..c807509 100644
--- a/dist/autosize.js
+++ b/dist/autosize.js
@@ -1,5 +1,5 @@
 /*!
-	Autosize 3.0.14
+	Autosize 3.0.15
 	license: MIT
 	http://www.jacklmoore.com/autosize
 */
@@ -33,6 +33,20 @@
 			} };
 	})();
 
+	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) {
 		var _ref = arguments[1] === undefined ? {} : arguments[1];
 
@@ -137,8 +151,7 @@
 			}
 
 			if (startHeight !== ta.style.height) {
-				var evt = document.createEvent('Event');
-				evt.initEvent('autosize:resized', true, false);
+				var evt = createEvent('autosize:resized');
 				ta.dispatchEvent(evt);
 			}
 		}
@@ -191,15 +204,13 @@
 
 	function destroy(ta) {
 		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);
 	}
 
 	function update(ta) {
 		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);
 	}
 
diff --git a/package.json b/package.json
index bd6aded..18ef012 100644
--- a/package.json
+++ b/package.json
@@ -1,12 +1,16 @@
 {
   "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": [
     "textarea",
     "form",
     "ui"
   ],
+  "files": [
+    "dist",
+    "src"
+  ],
   "author": {
     "name": "Jack Moore",
     "url": "http://www.jacklmoore.com",
diff --git a/readme.md b/readme.md
index c34e6df..3857829 100644
--- a/readme.md
+++ b/readme.md
@@ -10,10 +10,6 @@ Full documentation and a demo can be found at [jacklmoore.com/autosize](http://j
 ```bash
 npm install autosize
 ```
-#### Install via Bower
-```bash
-bower install autosize
-```
 
 #### Browser compatibility
 
diff --git a/src/autosize.js b/src/autosize.js
index c02f4cf..d0e47ce 100644
--- a/src/autosize.js
+++ b/src/autosize.js
@@ -14,6 +14,18 @@ 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} = {}) {
 	if (!ta || !ta.nodeName || ta.nodeName !== 'TEXTAREA' || set.has(ta)) return;
 
@@ -111,8 +123,7 @@ function assign(ta, {setOverflowX = true, setOverflowY = true} = {}) {
 		}
 
 		if (startHeight !== ta.style.height) {
-			const evt = document.createEvent('Event');
-			evt.initEvent('autosize:resized', true, false);
+			const evt = createEvent('autosize:resized');
 			ta.dispatchEvent(evt);
 		}
 	}
@@ -166,15 +177,13 @@ function assign(ta, {setOverflowX = true, setOverflowY = true} = {}) {
 
 function destroy(ta) {
 	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);
 }
 
 function update(ta) {
 	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);
 }
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/autosize.js.git



More information about the Pkg-javascript-commits mailing list