IE 中的 Jquery 可排序错误
在 IE 7 和 8 中排序时出现一些相当不寻常的错误(在 9 中工作正常)。
Jquery:
$(".first, .second, .third").sortable({
update : function (event, ui) {
var listItem = $(this).sortable('toArray');
var string = "navOrder=1&listItem=" + listItem;
}
});
HTML:
<ul class="first">
<li id="4">Learn More About The Law
<ul class="second">
<li id="49">ACA Overview</li>
<li id="45">Timelines
<ul class="third">
<li id="31">Already in Effect</li>
<li id="55">2012 Timeline</li>
<li id="56">2013 Timeline</li>
<li id="57">2014 Timeline</li>
<li id="58">2015 and on</li>
</ul>
</li>
</ul>
</li>
<li id="2">How Will Reform Affect Me?
<ul class="second">
<li id="32">I Have a Pre-existing Condition</li>
<li id="47">I Have Medicare
<ul class="third">
<li id="54">Medicare Insert</li>
<li id="20">Overview of Medicare Changes</li>
<li id="21">Medicare Advantage Plans</li>
<li id="22">Medicare Part D</li>
</ul>
</li>
<li id="50">I Have Insurance
<ul class="third">
<li id="51">I Have Insurance From My Employer</li>
<li id="52">I Buy My Own Insurance</li>
</ul>
</li>
<li id="48">Small Businesses
<ul class="third">
<li id="42">Small Business Tax Credits</li>
<li id="28">Grants for Small Business Wellness Programs</li>
<li id="27">Free Choice Voucher</li>
</ul>
</li>
<li id="53">Large Businesses
<ul class="third">
<li id="38">Large Employer Insurance Requirement</li>
<li id="39"> Am I a Large Employer?</li>
<li id="44">Large Employer Fines</li>
</ul>
</li>
</ul>
</li>
<li id="3">Is What I Hear True?
<ul class="second">
<li id="59">Why should I care about healthcare reform?</li>
<li id="40">Will the government have a say in my end-of-life decisions?</li>
<li id="41">Will Medicare services be cut to control costs?</li>
<li id="43">Will public funds be used to pay for abortions?</li>
</ul>
</li>
<li id="5">Resources
<ul class="second">
<li id="33">External Resources</li>
</ul>
</li>
</ul>
Getting some rather unusual errors when sorting in IE 7 and 8 (works fine in 9).
Jquery:
$(".first, .second, .third").sortable({
update : function (event, ui) {
var listItem = $(this).sortable('toArray');
var string = "navOrder=1&listItem=" + listItem;
}
});
HTML:
<ul class="first">
<li id="4">Learn More About The Law
<ul class="second">
<li id="49">ACA Overview</li>
<li id="45">Timelines
<ul class="third">
<li id="31">Already in Effect</li>
<li id="55">2012 Timeline</li>
<li id="56">2013 Timeline</li>
<li id="57">2014 Timeline</li>
<li id="58">2015 and on</li>
</ul>
</li>
</ul>
</li>
<li id="2">How Will Reform Affect Me?
<ul class="second">
<li id="32">I Have a Pre-existing Condition</li>
<li id="47">I Have Medicare
<ul class="third">
<li id="54">Medicare Insert</li>
<li id="20">Overview of Medicare Changes</li>
<li id="21">Medicare Advantage Plans</li>
<li id="22">Medicare Part D</li>
</ul>
</li>
<li id="50">I Have Insurance
<ul class="third">
<li id="51">I Have Insurance From My Employer</li>
<li id="52">I Buy My Own Insurance</li>
</ul>
</li>
<li id="48">Small Businesses
<ul class="third">
<li id="42">Small Business Tax Credits</li>
<li id="28">Grants for Small Business Wellness Programs</li>
<li id="27">Free Choice Voucher</li>
</ul>
</li>
<li id="53">Large Businesses
<ul class="third">
<li id="38">Large Employer Insurance Requirement</li>
<li id="39"> Am I a Large Employer?</li>
<li id="44">Large Employer Fines</li>
</ul>
</li>
</ul>
</li>
<li id="3">Is What I Hear True?
<ul class="second">
<li id="59">Why should I care about healthcare reform?</li>
<li id="40">Will the government have a say in my end-of-life decisions?</li>
<li id="41">Will Medicare services be cut to control costs?</li>
<li id="43">Will public funds be used to pay for abortions?</li>
</ul>
</li>
<li id="5">Resources
<ul class="second">
<li id="33">External Resources</li>
</ul>
</li>
</ul>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
该问题已通过升级到 Jquery 1.5.2 和 UI 1.8.13 得到解决
The issue has been resolved by upgrading to Jquery 1.5.2 and UI 1.8.13
我认为异常实际上是在 jsfiddle 中,而不是在
sortable
中:闯入调试器并跟踪调用堆栈表明 http://jsfiddle.net/codemirror/js/editor.js 在scheduleHighlight
方法中(根据 Visual Studio 第 1369 行) 。跟踪跟踪后,实际崩溃位于 http://jsfiddle.net/codemirror/js/select.js 第 167 行:在某些 IE 版本中尝试选择范围会导致崩溃。错误发生在jsfiddle之外吗?
I think the exception is actually in jsfiddle, not in
sortable
: breaking into a debugger and tracing the call stack indicates there is an error in http://jsfiddle.net/codemirror/js/editor.js in thescheduleHighlight
method (line 1369 according to Visual Studio). Following the trace the actual crash is in http://jsfiddle.net/codemirror/js/select.js on line 167: in certain IE versions attempts to select a range cause a crash.Does the error occur outside jsfiddle?