This next jQuery function eachcalls IE8 to represent "Stop running script? .. A script on this page causes your browser to start slowly ..".
$('.expand-collapse-icon').each(function() {
var dupId = $(this).parent('td').attr('duplicate-id');
var len = $(".results-table tr")
.filter(":not(:first)")
.filter(":has(.hidden-row[duplicate-id='" + dupId + "'])").length;
if (len <= 0) {
$(this).hide();
$(this).parent('td').css('padding-left', '15px');
}
});
Basically, I have a number of visible lines (about 92) that have related hidden lines. Lines are connected duplicate-idEach visible line has expand-collapse-iconin the first <td>. If you click on the icon, it will display hidden lines. If the visible line has no associated hidden lines, I do not want to show the icon.
Ideally, I can prevent the page from displaying the icon on the server side if there are no related lines, but there are dragons hiding in the code.
Is there an obvious way to speed this up?