Skip to main content

Bug Tracker

Side navigation

#6968 closed bug (fixed)

Opened August 30, 2010 11:09AM UTC

Closed January 17, 2011 09:33PM UTC

"handle" won't work as a key for .data() method

Reported by: itachi Owned by: snover
Priority: blocker Milestone: 1.5
Component: data Version: 1.4.3
Keywords: needstest patch Cc:
Blocked by: Blocking:

--- to reproduce, evaluate:

/* any jQuery el */

var $el = $(document)

/* set "handle" to anything but a function */

$"handle", {}))

/* this fails, see line 1850 where jQuery.trigger() function assumes that elem, "handle" ) is a function */


--- expected: "handle" keyword work or is marked invalid in docs

Attachments (0)
Change History (14)

Changed August 31, 2010 12:00AM UTC by dmethvin comment:1

Good point, perhaps it would be a good idea for jQuery to use a leading $ for its data names to avoid conflicts.

Changed September 03, 2010 01:46PM UTC by dmethvin comment:2

need: ReviewPatch

Also used internally:


Changed October 15, 2010 04:09AM UTC by snover comment:3

priority: → blocker
status: newopen

We need to stop polluting the data objects with internal data. 1.4.3 also adds __events__ as a polluting key.

Changed October 17, 2010 09:28PM UTC by snover comment:4


Retargeting to 1.5.

Changed November 08, 2010 09:31PM UTC by rwaldron comment:5

keywords: → needstests, patch

Changed November 19, 2010 01:19PM UTC by jitter comment:6

keywords: needstests, patchneedstest patch

Changed November 30, 2010 10:32AM UTC by cobexer comment:7

what about using jQuery.expando + "_events",...

this would remove all collision possibilities.

however it would also pollute the display in FireQuery (Firebug addon)

maybe reserve "jQuery." as prefix a user may not use

Changed December 18, 2010 05:16PM UTC by iliakan comment:8

It seems sane to have $ as prefix for all jquery native stuff, or even __$, like: "__" as hidden library stuff and "$" pointing that it is jquery library stuff.

Changed December 18, 2010 09:14PM UTC by rwaldron comment:9

#7651 is a duplicate of this ticket.

Changed December 28, 2010 05:55PM UTC by rwaldron comment:10

blocking: → 7840

Changed January 01, 2011 03:07AM UTC by snover comment:11

owner: → snover
status: openassigned

Changed January 10, 2011 11:40PM UTC by gnarf comment:12

Replying to [comment:8 iliakan]:

It seems sane to have $ as prefix for all jquery native stuff, or even __$, like: "__" as hidden library stuff and "$" pointing that it is jquery library stuff.

I kinda like that idea...

either seems less polluting for the internals. I wonder how many people are using
or other internal keys for their own code/purposes though. Either suggestion would be easy enough to compat mode, making the .data strip the $ off the argument.

Changed January 10, 2011 11:52PM UTC by snover comment:13

pull request i forgot to put this here.

Changed January 17, 2011 09:33PM UTC by Colin Snover comment:14

resolution: → fixed
status: assignedclosed

Merge in data_nocollide branch. Fixes #6968, improves unit testing framework checks for leaky stuff.

Changeset: e78d3a7e2d47e9796f87c18b76f8178b0bee42c5