]> source.dussan.org Git - nextcloud-server.git/commitdiff
Bump autosize.js
authorRoeland Jago Douma <roeland@famdouma.nl>
Mon, 3 Apr 2017 11:40:34 +0000 (13:40 +0200)
committerRoeland Jago Douma <roeland@famdouma.nl>
Mon, 3 Apr 2017 11:40:34 +0000 (13:40 +0200)
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
core/vendor/autosize/.bower.json
core/vendor/autosize/dist/autosize.js

index 56e4b46a16277f0b483833adccf8e385c5784de9..4cea0da89eaa317998a04874ca9f7b906e5c32b2 100644 (file)
     "amd",
     "node"
   ],
-  "version": "3.0.17",
-  "_release": "3.0.17",
+  "version": "3.0.20",
+  "_release": "3.0.20",
   "_resolution": {
     "type": "version",
-    "tag": "3.0.17",
-    "commit": "144040e4f545fbea9b304706a5200eba9961ee3f"
+    "tag": "3.0.20",
+    "commit": "2277ca66ae8e466c5159faf81069b94575db87aa"
   },
   "_source": "https://github.com/jackmoore/autosize.git",
   "_target": "^3.0.17",
-  "_originalSource": "autosize",
-  "_direct": true
+  "_originalSource": "autosize"
 }
\ No newline at end of file
index 49b8b0b957f96731b74c372ec2f148ae4b495cd1..998d64181251069901bdb1c0f254e80524c22ecc 100644 (file)
@@ -1,5 +1,5 @@
 /*!
-       Autosize 3.0.17
+       Autosize 3.0.20
        license: MIT
        http://www.jacklmoore.com/autosize
 */
 })(this, function (exports, module) {
        'use strict';
 
-       var set = typeof Set === 'function' ? new Set() : (function () {
-               var list = [];
+       var map = typeof Map === "function" ? new Map() : (function () {
+               var keys = [];
+               var values = [];
 
                return {
                        has: function has(key) {
-                               return Boolean(list.indexOf(key) > -1);
+                               return keys.indexOf(key) > -1;
                        },
-                       add: function add(key) {
-                               list.push(key);
+                       get: function get(key) {
+                               return values[keys.indexOf(key)];
+                       },
+                       set: function set(key, value) {
+                               if (keys.indexOf(key) === -1) {
+                                       keys.push(key);
+                                       values.push(value);
+                               }
                        },
                        'delete': function _delete(key) {
-                               list.splice(list.indexOf(key), 1);
-                       } };
+                               var index = keys.indexOf(key);
+                               if (index > -1) {
+                                       keys.splice(index, 1);
+                                       values.splice(index, 1);
+                               }
+                       }
+               };
        })();
 
        var createEvent = function createEvent(name) {
-               return new Event(name);
+               return new Event(name, { bubbles: true });
        };
        try {
                new Event('test');
@@ -48,7 +60,7 @@
        }
 
        function assign(ta) {
-               if (!ta || !ta.nodeName || ta.nodeName !== 'TEXTAREA' || set.has(ta)) return;
+               if (!ta || !ta.nodeName || ta.nodeName !== 'TEXTAREA' || map.has(ta)) return;
 
                var heightOffset = null;
                var clientWidth = ta.clientWidth;
                        }
 
                        ta.style.overflowY = value;
-
-                       resize();
                }
 
                function getParentOverflows(el) {
                                if (el.parentNode.scrollTop) {
                                        arr.push({
                                                node: el.parentNode,
-                                               scrollTop: el.parentNode.scrollTop });
+                                               scrollTop: el.parentNode.scrollTop
+                                       });
                                }
                                el = el.parentNode;
                        }
                function update() {
                        resize();
 
-                       var computed = window.getComputedStyle(ta, null);
-                       var computedHeight = Math.round(parseFloat(computed.height));
                        var styleHeight = Math.round(parseFloat(ta.style.height));
+                       var computed = window.getComputedStyle(ta, null);
+                       var actualHeight = Math.round(parseFloat(computed.height));
 
-                       // The computed height not matching the height set via resize indicates that
+                       // The actual height not matching the style height (set via the resize method) indicates that
                        // the max-height has been exceeded, in which case the overflow should be set to visible.
-                       if (computedHeight !== styleHeight) {
+                       if (actualHeight !== styleHeight) {
                                if (computed.overflowY !== 'visible') {
                                        changeOverflow('visible');
+                                       resize();
+                                       actualHeight = Math.round(parseFloat(window.getComputedStyle(ta, null).height));
                                }
                        } else {
                                // Normally keep overflow set to hidden, to avoid flash of scrollbar as the textarea expands.
                                if (computed.overflowY !== 'hidden') {
                                        changeOverflow('hidden');
+                                       resize();
+                                       actualHeight = Math.round(parseFloat(window.getComputedStyle(ta, null).height));
                                }
                        }
 
-                       if (cachedHeight !== computedHeight) {
-                               cachedHeight = computedHeight;
+                       if (cachedHeight !== actualHeight) {
+                               cachedHeight = actualHeight;
                                var evt = createEvent('autosize:resized');
-                               ta.dispatchEvent(evt);
+                               try {
+                                       ta.dispatchEvent(evt);
+                               } catch (err) {
+                                       // Firefox will throw an error on dispatchEvent for a detached element
+                                       // https://bugzilla.mozilla.org/show_bug.cgi?id=889376
+                               }
                        }
                }
 
                        ta.removeEventListener('keyup', update, false);
                        ta.removeEventListener('autosize:destroy', destroy, false);
                        ta.removeEventListener('autosize:update', update, false);
-                       set['delete'](ta);
 
                        Object.keys(style).forEach(function (key) {
                                ta.style[key] = style[key];
                        });
+
+                       map['delete'](ta);
                }).bind(ta, {
                        height: ta.style.height,
                        resize: ta.style.resize,
                        overflowY: ta.style.overflowY,
                        overflowX: ta.style.overflowX,
-                       wordWrap: ta.style.wordWrap });
+                       wordWrap: ta.style.wordWrap
+               });
 
                ta.addEventListener('autosize:destroy', destroy, false);
 
                window.addEventListener('resize', pageResize, false);
                ta.addEventListener('input', update, false);
                ta.addEventListener('autosize:update', update, false);
-               set.add(ta);
                ta.style.overflowX = 'hidden';
                ta.style.wordWrap = 'break-word';
 
+               map.set(ta, {
+                       destroy: destroy,
+                       update: update
+               });
+
                init();
        }
 
        function destroy(ta) {
-               if (!(ta && ta.nodeName && ta.nodeName === 'TEXTAREA')) return;
-               var evt = createEvent('autosize:destroy');
-               ta.dispatchEvent(evt);
+               var methods = map.get(ta);
+               if (methods) {
+                       methods.destroy();
+               }
        }
 
        function update(ta) {
-               if (!(ta && ta.nodeName && ta.nodeName === 'TEXTAREA')) return;
-               var evt = createEvent('autosize:update');
-               ta.dispatchEvent(evt);
+               var methods = map.get(ta);
+               if (methods) {
+                       methods.update();
+               }
        }
 
        var autosize = null;