Side navigation
#3244 closed feature (invalid)
Opened August 11, 2008 03:46PM UTC
Closed October 03, 2010 03:13AM UTC
small 'else-like' function: "instead" or "others"
Reported by: | oliverlangan | Owned by: | flesler |
---|---|---|---|
Priority: | major | Milestone: | 1.3 |
Component: | core | Version: | 1.2.6 |
Keywords: | Cc: | oliverlangan | |
Blocked by: | Blocking: |
Description
From the mailing lists:
This function allows you to write else-like statements in jQuery chains, immediately ending a previous destructive operation and filtering to everything else that had not been previously matched.
jQuery.fn.instead = function() {
return this.end().not(this);
};
A good name would have been 'else' but as a reserved word that causes some problems. Other suggested names have been "instead", "others", "otherwise", "invert", or "inverse".
Attachments (0)
Change History (4)
Changed August 11, 2008 03:48PM UTC by comment:1
Changed August 11, 2008 03:55PM UTC by comment:2
cc: | → oliverlangan |
---|---|
owner: | → flesler |
status: | new → assigned |
Changed August 12, 2008 05:48PM UTC by comment:3
need: | Review → Test Case |
---|
Can you provide 2-3 simple situations where this is really useful ?
Changed October 03, 2010 03:13AM UTC by comment:4
resolution: | → invalid |
---|---|
status: | assigned → closed |
Rather than leave this ticket open, perhaps someone can create a plugin and show its usefulness that way.
One possible extension to this code would be the ability to pass in an additional selector, creating more of an if-elseif-else structure: however, I could not see a way to filter out both the first ('if') and subsequent (elseif) sets from the final ('else') set.