Bug Tracker

Opened 11 years ago

Last modified 9 years ago

#4446 closed enhancement

.andSelf(selector) — at Initial Version

Reported by: karamfil Owned by:
Priority: low Milestone: 1.next
Component: traversing Version: 1.3.2
Keywords: andSelf, filter, 1.7-discuss Cc:
Blocked by: Blocking:

Description

Why not andSelf() function to have a selector param. Here is a particular example

$('element').nextAll('.className').andSelf('.className').doSomething();

This way one can add self only if it meets particular requirements.

Here is a fast solution :)

$.fn.andSelf = function(selector){ return (selector == null
this.prevObject.is(selector)) ? this.add( this.prevObject ) : this; }

Change History (0)

Note: See TracTickets for help on using tickets.