Jquery 是什么让脚本在IE8上运行缓慢?
我有一个搜索过滤器,它从一个 在firefox和chrome上运行良好,没有错误 当我在IE8(我们的主浏览器)上试用时,它可以工作,但搜索速度非常慢。 它像一秒钟,但我没有得到错误或类似的东西 我的脚本中是否有任何东西可能会使IE8的速度变慢? 我拿出了一些桌子,因为我不认为把它们全部展示出来会有什么不同Jquery 是什么让脚本在IE8上运行缓慢?,jquery,internet-explorer-8,Jquery,Internet Explorer 8,我有一个搜索过滤器,它从一个 在firefox和chrome上运行良好,没有错误 当我在IE8(我们的主浏览器)上试用时,它可以工作,但搜索速度非常慢。 它像一秒钟,但我没有得到错误或类似的东西 我的脚本中是否有任何东西可能会使IE8的速度变慢? 我拿出了一些桌子,因为我不认为把它们全部展示出来会有什么不同 <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquer
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script>
<script language="JavaScript">
$(document).ready(function () {
//add index column with all content.
$(".tablecolors tr:has(td)").each(function () {
var t = $(this).text().toLowerCase(); //all row text
$("<td class='indexColumn'></td>")
.hide().text(t).appendTo(this);
}); //each tr
$("#FilterTextBox").keyup(function () {
var s = $(this).val().toLowerCase().split(" ");
$(".tablecolors tr:hidden").show();
$.each(s, function () {
$(".tablecolors tr:visible .indexColumn:not(:contains('"+ this + "'))").parent().hide();
}); //each
}); //key up.
}); //document.ready
</script>
....
<table cellpadding="0" cellspacing="0" class="tablecolors" >
<thead><th >Department</th></thead>
<tbody>
<cfoutput query="GetDeptPhone" >
<tr>
<td >#dept_name# )</td>
</tr>
</cfoutput>
</tbody>
</table>
$(文档).ready(函数(){
//添加包含所有内容的索引列。
$(“.tablecolors tr:has(td)”).each(函数(){
var t=$(this).text().toLowerCase();//所有行文本
$("")
.hide().text(t).appendTo(this);
});//每个tr
$(“#FilterTextBox”).keyup(函数(){
var s=$(this.val().toLowerCase().split(“”);
$(“.tablecolors tr:hidden”).show();
$.each,函数(){
$(“.tablecolors tr:visible.indexColumn:not(:contains(““+this+”)))”))。parent().hide();
});//每个
})//把钥匙锁上。
}); //准备好了吗
....
部门
#部门名称)
如果在每次迭代中修改DOM模型,它可能会很慢。我会冒昧猜测,说IE就是问题所在。
$.each(s, function ()
{
$(".tablecolors tr:visible .indexColumn:not(:contains('"+ this + "'))").parent().hide();
});