IE 中的 Jquery 可排序错误

发布于 2024-11-08 04:09:40 字数 2972 浏览 0 评论 0原文

在 IE 7 和 8 中排序时出现一些相当不寻常的错误(在 9 中工作正常)。

http://jsfiddle.net/pC5qg/

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).

http://jsfiddle.net/pC5qg/

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

梦回梦里 2024-11-15 04:09:40

该问题已通过升级到 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

〆凄凉。 2024-11-15 04:09:40

我认为异常实际上是在 jsfiddle 中,而不是在 sortable 中:闯入调试器并跟踪调用堆栈表明 http://jsfiddle.net/codemirror/js/editor.jsscheduleHighlight 方法中(根据 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 the scheduleHighlight 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?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文