开发者

Jquery find behavior in firefox 3.5.9

i have the following piece of HTML code on my page:

<tr>
  <td>
    <div>
      <input type="hidden" name="test" value="">
      <input autocomplete="off" class="ffb-input watermark">
      <div class="ffb">
        <div class="content">
        </div>
      </div>
    </div>
  </td>
</tr>

In JavaScript I get the <tr> element using jquery and trying to search for input like this:

tr.find('div input:hidden')

but nothing is returned. When I'm using find like this:

tr.find('div input[type=hidden]'开发者_开发知识库)

Everything is working fine. What is the reason for such behavor? I observe this only in FireFox 3.5.9, not in 3.6.3, Jquery 1.4.2


The type attribute does not seem to be taken into account for the :hidden selector. As noted in the comments, it should be, so you might want to file a bug.

This seems to be the code for :hidden:

if ( jQuery.expr && jQuery.expr.filters ) {
    jQuery.expr.filters.hidden = function( elem ) {
        var width = elem.offsetWidth, height = elem.offsetHeight,
            skip = elem.nodeName.toLowerCase() === "tr";

        return width === 0 && height === 0 && !skip ?
            true :
            width > 0 && height > 0 && !skip ?
                false :
                jQuery.curCSS(elem, "display") === "none";
    };

    jQuery.expr.filters.visible = function( elem ) {
        return !jQuery.expr.filters.hidden( elem );
    };
}

I don't see anything obviously wrong, but you can try to debug this code and submit a patch, perhaps ..

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜