MDL-63303 javascript: fix bug in auto_rows.js allowing it to shrink
authorRyan Wyllie <ryan@moodle.com>
Tue, 16 Oct 2018 03:24:07 +0000 (11:24 +0800)
committerRyan Wyllie <ryan@moodle.com>
Thu, 15 Nov 2018 06:40:11 +0000 (14:40 +0800)
lib/amd/build/auto_rows.min.js
lib/amd/src/auto_rows.js

index edc87d9..f884f9d 100644 (file)
Binary files a/lib/amd/build/auto_rows.min.js and b/lib/amd/build/auto_rows.min.js differ
index 644d3a9..0814b48 100644 (file)
@@ -80,10 +80,14 @@ define(['jquery'], function($) {
         if (typeof minRows === "undefined") {
             element.data('min-rows', currentRows);
         }
+
+        // Reset element to single row so that the scroll height of the
+        // element is correctly calculated each time.
+        element.attr('rows', 1);
         var rows = calculateRows(element);
+        element.attr('rows', rows);
 
         if (rows != currentRows) {
-            element.attr('rows', rows);
             element.trigger(EVENTS.ROW_CHANGE);
         }
     };