Opened 11 years ago
Closed 11 years ago
#11740 closed bug (worksforme)
.not() method
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | undecided | Milestone: | None |
Component: | unfiled | Version: | 1.7.2 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
I have this html structure. <div class="collapsible">
<div class="collapsor">click me</div> <div class="collapsing">I'm hidden</div>
<div> <div class="collapsible">
<div class="collapsor">click me 2</div> <div class="collapsing">I'm hidden 2</div>
<div>
It's a basic accordion, so on initialization I want to collapse all the ".collapsing", except for the first one. I thought to do: $(".collapsing").not('.collapsible:first>.collapsing').hide(); but this doesn't work! infact the selection and the subsequent .not() result in an empty array. I realized this must be a bug because if I call: $(".collapsing",context).not($('.collapsible:first>.collapsing')).hide(); it works. (notice the call to $() inside the .not())
Change History (5)
comment:1 Changed 11 years ago by
Owner: | set to leonardo@… |
---|---|
Status: | new → pending |
comment:2 Changed 11 years ago by
Status: | pending → new |
---|
I should really learn to read the guidelines *before* posting. But unfortunately I don't seem to be able to reproduce the effect on jsFiddle. It works as expected there, there is no difference between the two examples I made above. This isn't true for my webpages though. I'm using jQuery 1.7.2. :/
comment:3 Changed 11 years ago by
Are you using TinyMCE? If so, you may want to upgrade to the latest version - this sounds like a report we previously received that turned out to be caused by TinyMCE
comment:4 Changed 11 years ago by
No I'm not using TinyMCE. I have made a static snapshot of my page. You can visit it here: http://bss.rel.to/test_collapse.html The code is in the ./js/collapse.js file As you can easily test with a JS console, the set returned by
$(".collapsing",context).not($('.collapsible:first>.collapsing'))
is not the same of
$(".collapsing",context).not('.collapsible:first>.collapsing')
but, unless I'm interpreting wrong the .not() documentation, they should be equivalent.
comment:5 Changed 11 years ago by
Resolution: | → worksforme |
---|---|
Status: | new → closed |
This is not a jQuery bug
Thanks for taking the time to contribute to the jQuery project! Please provide a complete reduced test case on jsFiddle to help us assess your ticket!
Additionally, be sure to test against the "jQuery (edge)" version to ensure the issue still exists. To get you started, use this boilerplate: http://jsfiddle.net/FrKyN/ Open the link and click to "Fork" (in the top menu) to begin.