Bug Tracker

Modify

Ticket #10589 (closed enhancement: fixed)

Opened 19 months ago

Last modified 12 months ago

Remove $.fn.data("events")

Reported by: gnarf Owned by: dmethvin
Priority: high Milestone: 1.8
Component: data Version: git
Keywords: 1.8-discuss debug Cc:
Blocking: Blocked by:

Description (last modified by rwaldron) (diff)

This was discussed when we talked about removing the .data("events") code. We would like to discourage/deprecate this usage, and perhaps release something like $.fn.events() to replace it in a "debugging extension".

I'd like to suggest that we deprecate the current usage as soon as possible.

Change History

comment:1 Changed 19 months ago by gnarf

  • Keywords 1.8-discuss debug added
  • Status changed from new to open
  • Component changed from unfiled to data
  • Milestone changed from None to 1.8

comment:2 Changed 19 months ago by gnarf

  • Description modified (diff)

comment:3 Changed 19 months ago by dcherman

I use it for debugging, or at times for re-ordering already bound events if I need to bind something but have it fire first like this:

el.data( 'events' ).keydown.unshift( el.data( 'events' ).keydown.pop() );

comment:4 Changed 19 months ago by dcherman

Thought I just had - what about maintaining a list of bound handlers on the element's event fn?

Something like el.keydown.getHandlers() returns [ function() { ... }, $.noop, somefunc ]

Last edited 19 months ago by dcherman (previous) (diff)

comment:5 Changed 19 months ago by rwaldron

  • Priority changed from undecided to high

comment:6 Changed 19 months ago by dmethvin

Given that I changed some of the internal structure of the events object during 1.7, several of the plugins that dig into the information in detail don't work properly anyway. I didn't realize this until we started the discussion yesterday and some people joined that thread. However, I have yet to be convinced that the people using "events" that way should be using them.

 https://github.com/jquery/jquery/commit/24e416dca36df4b182a612dba37f8b6cdaa25916

The data isn't being hidden, just moved to its rightful place in the internal data object so that user data named "events" won't clobber it. So we aren't preventing anyone from being able to inspect events for debugging purposes, which seems to be the most common need.

Once we come to a resolution on this and other 1.8 initiatives I'd suggest a blog post with the results so we can prepare people for the move from jQuery(elem, "events") to jQuery._data(elem, "events") with the warning that it is not a public interface and subject to change.

comment:7 Changed 18 months ago by jzaefferer

  • Description modified (diff)

+1

comment:8 Changed 18 months ago by jaubourg

+1

comment:9 Changed 18 months ago by dmethvin

  • Description modified (diff)

+1, For access, let's stay with jQuery._data(elem, "events") so people understand it's not a documented interface.

comment:10 Changed 18 months ago by mikesherov

  • Description modified (diff)

+1

comment:11 Changed 18 months ago by timmywil

+1

comment:12 Changed 17 months ago by rwaldron

  • Description modified (diff)

+1

comment:13 Changed 12 months ago by dmethvin

  • Owner set to dmethvin
  • Status changed from open to assigned
  • Summary changed from Deprecate $.fn.data("events") - Replace with debugging extension to Remove $.fn.data("events")

comment:14 Changed 12 months ago by Dave Methvin

  • Status changed from assigned to closed
  • Resolution set to fixed

Fix #10589. Remove deprecated $.fn.data("events") special case.

No unit tests were harmed in the removal of this hack.

Changeset: 9e0c056171d1a5cac407f8fedbf926be91eaba1a

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.