English 中文(简体)
为什么 j笑:看得见的挑选者把隐藏的TyE8列入?
原标题:Why does jQuery s :visible selector include hidden TRs on IE8?

j Query s 。 选择人似乎并不在互联网探索8中从事有关与贸易有关的内容的工作,其含义是将那些隐藏在hide()。 这里是一个试验案例:

<html>
  <head>
    <script language="JavaScript" src="jquery-1.3.2.min.js"></script>
    <script language="JavaScript">
$(document).ready(function () { 
               $( #trb ).hide();
               $( #trcount ).html($( tr:visible ).length);
               $( #pb ).hide();
               $( #pcount ).html($( p.item:visible ).length);
});
    </script>
  </head>
  <body>
    <table>
      <tr><td>A</td></tr>
      <tr id="trb"><td>B</td></tr>
      <tr><td>C</td></tr>
    </table>
    <p><span id="trcount">?</span> rows are visible.</p>

    <p>Using paragraphs:</p>
    <p class="item">A</p>
    <p class="item" id="pb">B</p>
    <p class="item">C</p>

    <p><span id="pcount">?</span> paragraphs are visible.</p>
  </body>
</html>

就 Chrome而言,它产生了“两行可见”和“两段可见”,如预期。 然而,在互联网探索者8方面,结果是“3个浏览点”和“2个段落”。

为什么? 如何围绕它开展工作? (在我隐藏一个项目时,我认为最好加上一个特别安全等级。)

最佳回答

This1.3.2。 解决这一问题,使用j Query 1.4.2.

观察两者的差别: 8:

jQuery 1.4.2 - no problems alt text

jQuery 1.3.2 - "3 rows visible" alt text

正如Patrick DW在评论中指出的那样,。 同一条线上的答案似乎意味着使用<代码>而不是:(hidden)将在1.3.2中解决这一问题,但它没有。

问题回答

暂无回答




相关问题
Image rendered with wrong colors in IE8

I have a gradient image as a PNG (no transparency) in a web-page. By taking a screenshot of Chrome showing the page and cropping the image from the page, I see the exact same colors are drawn as the ...

Determine Mobile Internet Explorer version

I need to determine the version of Mobile Internet Explorer on a Windows Mobile 6.1 device. So that I can report the same user-agent string as is being used by Mobile Internet Explorer. The user-...

CSS working only in Firefox

I am trying to create a search text-field like on the Apple website. The HTML looks like this: <div class="frm-search"> <div> <input class="btn" type="image" src="http://www....

Internet Explorer only part loading JavaScript/CSS

I m having trouble with my local development environment where IE (6 through to 8) is only part loading JavaScript/CSS files. It throws random errors at random places in jquery.min.js every time I ...

IE doesn t run Javascript when you click back button

I ve built a shop with tons of JS running. One of the pieces of the cart, is a zip code field which is required to calculate shipping cost. This works fine going through the cart. Now clicking ...