From 7e79589eba71b758e94587fae369ce5792da4d17 Mon Sep 17 00:00:00 2001 From: Madhura Jayaratne Date: Wed, 12 Jan 2011 10:48:43 -0500 Subject: [PATCH 1/2] Patch #3155803 - Column header misalignment --- js/sql.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/js/sql.js b/js/sql.js index e985be21ca..e61214ef93 100644 --- a/js/sql.js +++ b/js/sql.js @@ -110,7 +110,13 @@ function appendInlineAnchor() { if($(this).attr('colspan') == 3) { $(this).attr('colspan', '4') } - }) + }); + + $('#rowsDeleteForm').find('tbody').find('th').each(function() { + if($(this).attr('colspan') == 3) { + $(this).attr('colspan', '4') + } + }); } } From 5d4999c8cc5692cb47552c367863d0ab9a601605 Mon Sep 17 00:00:00 2001 From: Marc Delisle Date: Wed, 12 Jan 2011 10:59:16 -0500 Subject: [PATCH 2/2] Use a multiple selector Cache jQuery object to avoid unneeded DOM traversal --- js/sql.js | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/js/sql.js b/js/sql.js index e61214ef93..43b3af7325 100644 --- a/js/sql.js +++ b/js/sql.js @@ -106,15 +106,10 @@ function appendInlineAnchor() { $this_td.after($cloned_anchor); }); - $('#rowsDeleteForm').find('thead').find('th').each(function() { - if($(this).attr('colspan') == 3) { - $(this).attr('colspan', '4') - } - }); - - $('#rowsDeleteForm').find('tbody').find('th').each(function() { - if($(this).attr('colspan') == 3) { - $(this).attr('colspan', '4') + $('#rowsDeleteForm').find('thead, tbody').find('th').each(function() { + var $this_th = $(this); + if ($this_th.attr('colspan') == 3) { + $this_th.attr('colspan', '4') } }); }