Bug Tracker

Modify

Ticket #10696 (closed enhancement: invalid)

Opened 19 months ago

Last modified 19 months ago

Proposed enhancement of :not selector

Reported by: sneethling@… Owned by:
Priority: undecided Milestone: None
Component: unfiled Version: 1.7
Keywords: Cc:
Blocking: Blocked by:

Description

If I have HTML such as:

<details>

<summary>Some text content</summary> <p>Some text content</p> <p>Some text content</p>

</details>

And I use the :not selector as follows:

$("details :not(summary)");

I get the expected result where the result contains the two paragraphs. If however I change the summary line as follows:

<summary>Some <abbr title="some explaination">text</abbr> content</summary>

The result now includes the two paragraphs but also the abbr. The expected result would be that just the two paragraphs should be in the result.

Reading the API: "The supplied selector is tested against each element; the elements that don't match the selector will be included in the result." - This explains why the above is happening.

However, if the content you wish to exclude is dynamically generated, you will not always know what other tags might be added inside the summary element for example therefore, making something like:

$(".details :not(.summary, abbr)");

not really an option. I therefore propose that the .not() and/or :not() functions have a boolean that maps to includeChildElements. If this is true, then exclude the selector and all of it's contained child elements.

More can be seen here:  http://jsfiddle.net/MHQyg/2/

Change History

comment:1 Changed 19 months ago by dmethvin

  • Status changed from new to closed
  • Resolution set to invalid

Your understanding of :not() is wrong, which is why I asked you to go to the forum (not the bug tracker). #jquery-dev isn't really set up for tutorials. I looked at your example about 5 minutes after you left and tried to find you in #jquery but it seems you were a hit-and-runner.

 http://jsfiddle.net/dmethvin/MHQyg/3/

Honestly, if you need more help ask on the forum, because the bug tracker isn't set up for tutorials either.

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.