From 57378aac0b8f41f01ac2f758e380d2347175fbb6 Mon Sep 17 00:00:00 2001 From: Dan Poltawski Date: Tue, 20 Dec 2016 15:57:26 +0000 Subject: [PATCH] MDL-57472 javascript-static: remove fix_column_widths() A bit of a hack applied nearly 12 years ago in 7979105c629050e744b9e889a95b6984cf912b03 --- lib/javascript-static.js | 41 ++++++++-------------------------------- lib/outputrenderers.php | 2 -- 2 files changed, 8 insertions(+), 35 deletions(-) diff --git a/lib/javascript-static.js b/lib/javascript-static.js index 4320ae23c9b..c980e314e39 100644 --- a/lib/javascript-static.js +++ b/lib/javascript-static.js @@ -1063,43 +1063,18 @@ function filterByParent(elCollection, parentFinder) { return filteredCollection; } -/* - All this is here just so that IE gets to handle oversized blocks - in a visually pleasing manner. It does a browser detect. So sue me. -*/ - +/** + * @deprecated since Moodle 3.3, but shouldn't be used in earlier versions either. + */ function fix_column_widths() { - var agt = navigator.userAgent.toLowerCase(); - if ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1)) { - fix_column_width('left-column'); - fix_column_width('right-column'); - } + Y.log('fix_column_widths() no longer does anything. Please remove it from your code.', 'warn', 'javascript-static.js'); } +/** + * @deprecated since Moodle 3.3, but shouldn't be used in earlier versions either. + */ function fix_column_width(colName) { - if(column = document.getElementById(colName)) { - if(!column.offsetWidth) { - setTimeout("fix_column_width('" + colName + "')", 20); - return; - } - - var width = 0; - var nodes = column.childNodes; - - for(i = 0; i < nodes.length; ++i) { - if(nodes[i].className.indexOf("block") != -1 ) { - if(width < nodes[i].offsetWidth) { - width = nodes[i].offsetWidth; - } - } - } - - for(i = 0; i < nodes.length; ++i) { - if(nodes[i].className.indexOf("block") != -1 ) { - nodes[i].style.width = width + 'px'; - } - } - } + Y.log('fix_column_width() no longer does anything. Please remove it from your code.', 'warn', 'javascript-static.js'); } diff --git a/lib/outputrenderers.php b/lib/outputrenderers.php index 6c81aa7f47c..21f40ff451c 100644 --- a/lib/outputrenderers.php +++ b/lib/outputrenderers.php @@ -576,8 +576,6 @@ class core_renderer extends renderer_base { 'loadinghelp', ), 'moodle'); - $this->page->requires->js_function_call('setTimeout', array('fix_column_widths()', 20)); - $focus = $this->page->focuscontrol; if (!empty($focus)) { if (preg_match("#forms\['([a-zA-Z0-9]+)'\].elements\['([a-zA-Z0-9]+)'\]#", $focus, $matches)) {