OLD | NEW |
(Empty) | |
| 1 /* Copyright 2016 The Chromium Authors. All Rights Reserved. |
| 2 * |
| 3 * Use of this source code is governed by a BSD-style |
| 4 * license that can be found in the LICENSE file or at |
| 5 * https://developers.google.com/open-source/licenses/bsd |
| 6 */ |
| 7 |
| 8 /** |
| 9 * This file contains JS utilities used by other JS files in Monorail. |
| 10 */ |
| 11 |
| 12 |
| 13 /** |
| 14 * Add an indexOf method to all arrays, if this brower's JS implementation |
| 15 * does not already have it. |
| 16 * @param {Object} item The item to find |
| 17 * @returns {number} The index of the given item, or -1 if not found. |
| 18 */ |
| 19 if (Array.prototype.indexOf == undefined) { |
| 20 Array.prototype.indexOf = function(item) { |
| 21 for (var i = 0; i < this.length; ++i) { |
| 22 if (this[i] == item) return i; |
| 23 } |
| 24 return -1; |
| 25 } |
| 26 } |
| 27 |
| 28 |
| 29 /** |
| 30 * This function works around a FF HTML layout problem. The table |
| 31 * width is somehow rendered at 100% when the table contains a |
| 32 * display:none element, later, when that element is displayed, the |
| 33 * table renders at the correct width. The work-around is to have the |
| 34 * element initiallye displayed so that the table renders properly, |
| 35 * but then immediately hide the element until it is needed. |
| 36 * |
| 37 * TODO(jrobbins): Find HTML markup that FF can render more |
| 38 * consistently. After that, I can remove this hack. |
| 39 */ |
| 40 function TKR_forceProperTableWidth() { |
| 41 var e = $('confirmarea'); |
| 42 if (e) e.style.display='none'; |
| 43 } |
OLD | NEW |