Side navigation
#10696 closed enhancement (invalid)
Opened November 06, 2011 06:56PM UTC
Closed November 06, 2011 07:24PM UTC
Proposed enhancement of :not selector
Reported by: | sneethling@mozila.com | Owned by: | |
---|---|---|---|
Priority: | undecided | Milestone: | None |
Component: | unfiled | Version: | 1.7 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
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/
Attachments (0)
Change History (1)
Changed November 06, 2011 07:24PM UTC by comment:1
resolution: | → invalid |
---|---|
status: | new → closed |
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.