Skip to main content

Bug Tracker

Side navigation

#11740 closed bug (worksforme)

Opened May 08, 2012 09:49PM UTC

Closed May 09, 2012 01:45AM UTC

.not() method

Reported by: leonardo@guildofmessengers.com Owned by: leonardo@guildofmessengers.com
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())

Attachments (0)
Change History (5)

Changed May 08, 2012 09:56PM UTC by rwaldron comment:1

owner: → leonardo@guildofmessengers.com
status: newpending

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.

Changed May 08, 2012 10:55PM UTC by leonardo@guildofmessengers.com comment:2

status: pendingnew

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. :/

Changed May 08, 2012 11:40PM UTC by rwaldron comment:3

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

Changed May 09, 2012 12:00AM UTC by leonardo@guildofmessengers.com comment:4

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.

Changed May 09, 2012 01:45AM UTC by rwaldron comment:5

resolution: → worksforme
status: newclosed