Side navigation
#7323 closed enhancement (fixed)
Opened October 27, 2010 04:11AM UTC
Closed September 20, 2011 01:17AM UTC
Last modified March 08, 2012 04:29PM UTC
Allow removing multiple data keys at once with $.fn.removeData
Reported by: | rmurphey@gmail.com | Owned by: | gnarf |
---|---|---|---|
Priority: | blocker | Milestone: | 1.7 |
Component: | data | Version: | 1.4.3 |
Keywords: | removeData,1.7-discuss | Cc: | |
Blocked by: | Blocking: |
Description
I just saw some code in Wijmo that had a string of chained removeData() calls, and it occurred to me there should probably be a way to remove multiple data keys at once. Not sure whether this is a worthwhile addition (I know there are better ways they could have done this to avoid needing to remove one key at a time), but if so, I'd suggest an API that accepts either a string containing a single key (which is what currently works) or an array of keys.
Attachments (0)
Change History (20)
Changed October 27, 2010 04:44PM UTC by comment:1
component: | unfiled → data |
---|---|
keywords: | → removeData |
status: | new → open |
Changed October 27, 2010 04:45PM UTC by comment:2
Yes :) Didn't want to submit one unless it was something people liked.
Changed October 27, 2010 04:45PM UTC by comment:3
Replying to [comment:2 anonymous]:
Yes :) Didn't want to submit one unless it was something people liked.
Sorry, that was me, I wasn't logged in.
Changed October 27, 2010 08:06PM UTC by comment:4
Pull request 77 submitted, if you want it.
Changed November 21, 2010 10:49PM UTC by comment:5
owner: | → rmurphey |
---|---|
status: | open → assigned |
Changed April 16, 2011 09:03PM UTC by comment:6
milestone: | → 1.next |
---|---|
priority: | undecided → low |
We should consider this for 1.7.
Changed May 22, 2011 07:27PM UTC by comment:7
keywords: | removeData → removeData,1.7-discuss |
---|
Nominating ticket for 1.7 discussion.
Changed May 22, 2011 09:41PM UTC by comment:8
+1, Should be consistent with existing API
Changed May 23, 2011 12:15AM UTC by comment:9
+1, makes sense
Changed May 23, 2011 12:43AM UTC by comment:10
Per the discussion on the pull request (https://github.com/jquery/jquery/pull/77) there needs to be a decision as to the API. If we go with a single string, which is consistent with existing APIs ...
$('#foo').removeData('a b c');
... then we make it impossible to remove a key with a space in it. If we go with an array, as I did in the pull request ...
$('#foo').removeData([ 'a', 'b', 'c' ]);
... then we can allow the removal of any valid key, either one or many at a time.
I have no horse in this race; I can see the merits of both solutions.
Changed May 23, 2011 03:53AM UTC by comment:11
+1, In favor, but I don't think space-separated by itself is enough.
Changed May 23, 2011 03:55PM UTC by comment:12
+1, I don't know if we want to break space-separated keys for 1.7 - I like the array, even thought it's "inconsistent" with other aspects of the API
Changed June 03, 2011 01:41PM UTC by comment:13
+1, Let's do this.
Changed June 03, 2011 03:29PM UTC by comment:14
+1, space delimited string, like everything else
Changed June 03, 2011 03:47PM UTC by comment:15
Scott, keep in mind that data properties can be any valid string
https://github.com/jquery/jquery/pull/77#issuecomment-665309
illustrated here:
http://jsfiddle.net/rwaldron/Bt4nK/
But then again, we could always just say that strings with spaces are prohibited
Changed June 06, 2011 03:57PM UTC by comment:16
+0
Changed July 12, 2011 03:00PM UTC by comment:17
milestone: | 1.next → 1.7 |
---|---|
priority: | low → blocker |
Changed July 25, 2011 04:08PM UTC by comment:18
owner: | rmurphey → timmywil |
---|
Changed September 19, 2011 04:59PM UTC by comment:19
owner: | timmywil → gnarf |
---|
Changed September 20, 2011 01:17AM UTC by comment:20
resolution: | → fixed |
---|---|
status: | assigned → closed |
Landing pull request 512. 1.7 - removeData now takes space separated lists and arrays of keys - Fixes #7323.
More Details:
Changeset: 9b3768b968bc99d3422355e69e2c7c35bedf681e
Seems fair. Any desire to write a patch? :D