Bug Tracker

Ticket #8789 (closed enhancement: fixed)

Opened 3 years ago

Last modified 3 years ago

Meta: Event Property Hooks

Reported by: rwaldron Owned by: rwaldron
Priority: blocker Milestone: 1.7
Component: event Version: 1.5.2
Keywords: Cc:
Blocking: Blocked by:

Description (last modified by ajpiano) (diff)

Implement the ability to specify properties of event.originalEvent to be moved over to event.* for specific event types, without the performance sacrifices of copying all event.originalEvent properties or adding to the globally used jQuery.event.props list

Will be particularly useful for newer events introduced by HTML5 JavaScript APIs that have special properties that are ignored by jQuery.event.fix() when it copies the jQuery.event.props array.

Ex.

Drag/Drop API has "dataTranser", touch event props, messaging event props, Custom data properties

Ultimately, this will allow end devs to write less code and we can stop recommending the extension of jQuery.event.props

Change History

comment:1 Changed 3 years ago by rwaldron

  • Description modified (diff)

comment:2 Changed 3 years ago by rwaldron

  • Owner set to rwaldron
  • Priority changed from undecided to low
  • Status changed from new to assigned
  • Component changed from unfiled to event
  • Milestone changed from 1.next to 1.6

comment:3 Changed 3 years ago by rwaldron

Can be stored as simply as shown here  http://jsfiddle.net/rwaldron/JxdNj/

comment:4 Changed 3 years ago by dmethvin

Ticket #6942 is another example of when this could be useful. Right now we run all events through the same jQuery.event.fix paths regardless of event type, which is probably causing performance issues in cases where event frequency is high such as mousemove.

comment:5 Changed 3 years ago by john

  • Owner rwaldron deleted
  • Milestone changed from 1.6 to 1.next

Let's try to get this in 1.7.

comment:6 Changed 3 years ago by john

  • Keywords 1.7-discuss added

Nominating ticket for 1.7 discussion.

comment:7 Changed 3 years ago by rwaldron

  • Description modified (diff)

+1,

comment:8 Changed 3 years ago by jaubourg

+1,

comment:9 Changed 3 years ago by timmywil

+1,

comment:10 Changed 3 years ago by dmethvin

  • Description modified (diff)

+1, I like the concept but am concerned about size issues and the temptation to define every property for every event type. Worth an exploratory implementation though.

comment:11 Changed 3 years ago by john

  • Description modified (diff)

+1, Yes, absolutely yes.

comment:12 Changed 3 years ago by rwaldron

  • Description modified (diff)

Considering the support for this proposal so far, I'm going to begin drafting tests towards a base implementation

comment:13 Changed 3 years ago by scott.gonzalez

  • Description modified (diff)

+1, might be a way to fix #6942 as well

comment:14 Changed 3 years ago by ajpiano

  • Description modified (diff)

+1, rwaldron mentioned that there was a mechanism to do this on a per-event-type basis, is that happening?

comment:15 Changed 3 years ago by rwaldron

To clarify, what @ajpiano refers to is that I had an idea for how to make this work on a per-event type basis, though no code is ready for review.

comment:16 Changed 3 years ago by dmethvin

  • Priority changed from low to blocker
  • Milestone changed from 1.next to 1.7

comment:17 Changed 3 years ago by rwaldron

  • Owner set to rwaldron

comment:18 Changed 3 years ago by rwaldron

  • Keywords 1.8-discuss added; 1.7-discuss removed
  • Milestone changed from 1.7 to 1.8

After much consideration, I've decided that this should wait until 1.8 (there will be enough changes to Events in 1.7, this seems like too much at once)

comment:19 Changed 3 years ago by rwaldron

  • Keywords 1.8-discuss removed
  • Milestone changed from 1.8 to 1.7

comment:20 Changed 3 years ago by Rick Waldron

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

Merge branch 'fix-8789-rwldrn-fix' of  git://github.com/dmethvin/jquery into fix-8789-rwldrn-fix

  • 'fix-8789-rwldrn-fix' of  git://github.com/dmethvin/jquery: Minor cleanups to code. Futile effort to get IE to pass the unit test. propHooks now an object with props array and filter function. Moves mouse properties to mouseProps current state Removes early return loop, must copy properties Shortcircuit fix if possible More ref localization Remove unnec. empty line More reference caching Cache reference to propHook lookup and result Restore this.propHooks => jQuery.event.propHooks for better gzip compression. Thanks gnarf Adds notes re: crash status of fix conditions Moves key event fixes to own even prop hook defs jQuery.event.propHooks => this.propHooks where possible Removes pageX pageY from prop list Updates rmouseEvent Implements jQuery.event.propHooks. Fixes #8789 Adds implementation tests for jQuery.event.propHooks #8789 Changeset: 36c82a1bcea14680b7efed47da8f3ebd9bf3de82
Note: See TracTickets for help on using tickets.