Skip to main content

Bug Tracker

Side navigation

#8753 closed enhancement (fixed)

Opened April 02, 2011 03:59PM UTC

Closed April 10, 2011 08:29PM UTC

jQuery 1.6: jQuery.Event contstructor to support setting properties

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

Copied directly from jQuery 1.6 Roadmap:

Fix $.Event contstructor to support setting properties on the new event (not just pushing them into the originalEvent), something like $.Event({ type: "keydown", keyCode: 64 })

I couldn't find a ticket for this, if anyone knows of one that exists, please cross-ref

Attachments (0)
Change History (10)

Changed April 02, 2011 04:00PM UTC by rwaldron comment:1

component: unfiledevent
milestone: 1.next1.6
owner: → rwaldron
priority: undecidedlow
status: newassigned

Changed April 02, 2011 09:18PM UTC by rwaldron comment:2

priority: lowblocker

Changed April 03, 2011 05:20PM UTC by rwaldron comment:3

_comment0: Found References: \ \ http://bugs.jquery.com/ticket/7900 \ \ \ http://bugs.jquery.com/ticket/7808 \ \ \ From 7808, updated: \ \ http://jsfiddle.net/rwaldron/65Zjp/2/1301851419954256

Found References:

http://bugs.jquery.com/ticket/7900

http://bugs.jquery.com/ticket/7808

From 7808, updated:

http://jsfiddle.net/rwaldron/65Zjp/3/

(use: http://jsfiddle.net/rwaldron/65Zjp/3/show/ - In a browser that supports native drag/drop, drop a file from your desktop into the box)

Changed April 03, 2011 08:08PM UTC by rwaldron comment:4

Changed April 04, 2011 02:15PM UTC by rwaldron comment:5

_comment0: Additional resource: \ \ http://jsfiddle.net/rwaldron/AMxMA/show/ \ \ http://jsfiddle.net/rwaldron/AMxMA/1301928613787012
_comment1: Usage and explanation of syntax: \ \ http://jsfiddle.net/rwaldron/dWsdV/show/ \ \ http://jsfiddle.net/rwaldron/dWsdV/1301929535507518

Changed April 04, 2011 02:41PM UTC by rwaldron comment:6

_comment0: The resulting enhancement subsequently provides a means to "fix" an event object as well as override event object properties \ \ A case that will be directly benefit from this: \ \ https://github.com/jquery/jquery-ui/blob/master/ui/jquery.ui.widget.js#L324-3531302033610799062

~~The resulting enhancement subsequently provides a means to "fix" an event object as well as override event object properties

A case that will be directly benefit from this:

https://github.com/jquery/jquery-ui/blob/master/ui/jquery.ui.widget.js#L324-353~~

Changed April 04, 2011 04:52PM UTC by rwaldron comment:7

_comment0: Per review recommendations \ \ https://github.com/rwldrn/jquery/tree/eventprops.1.6v31301937425372492
_comment1: Per review recommendations \ \ https://github.com/rwldrn/jquery/tree/eventprops.1.6v3 \ \ https://github.com/rwldrn/jquery/commit/c65ef9be059188b6725a3fa11ad65dd86a9eecc6 \ \ Updated: \ \ http://jsfiddle.net/rwaldron/P6nqA/4/show/ \ \ http://jsfiddle.net/rwaldron/P6nqA/4/1302033600351231

Changed April 04, 2011 05:50PM UTC by rwaldron comment:8

_comment0: In summation, this will allow us to depart from recommending that specified event properties (that can be found on event.originalEvent) be added by calling `jQuery.event.props.push(prop)`, instead by using `jQuery.Event( type, props )` props will be available on the directly from the `event object argument`, with a value either specified by the dev or copied from event.originalEvent. This "property adoption" will only be granted to the specified event type, saving all other event types from being required to copy any more properties than is actually needed of them.1301940004192781
_comment1: \ In summation, this will allow us to depart from recommending that specified event properties (that can be found on `event.originalEvent`) be added by calling `jQuery.event.props.push(prop)`. \ By calling `jQuery.Event( type, props )`, props will be available directly from the event object argument, with a value either specified by the dev (props) or copied from `event.originalEvent`. This "property adoption" will only be granted to the specified event type, saving all other event types from being required to copy any more properties than is actually needed of them. \ 1302033550602843
_comment2: <strike>In summation, this will allow us to depart from recommending that specified event properties (that can be found on `event.originalEvent`) be added by calling `jQuery.event.props.push(prop)`. \ By calling `jQuery.Event( type, props )`, props will be available directly from the event object argument, with a value either specified by the dev (props) or copied from `event.originalEvent`. This "property adoption" will only be granted to the specified event type, saving all other event types from being required to copy any more properties than is actually needed of them. \ </strike>1302033589243219

~~In summation, this will allow us to depart from recommending that specified event properties (that can be found on event.originalEvent) be added by calling jQuery.event.props.push(prop).

By calling jQuery.Event( type, props ), props will be available directly from the event object argument, with a value either specified by the dev (props) or copied from event.originalEvent. This "property adoption" will only be granted to the specified event type, saving all other event types from being required to copy any more properties than is actually needed of them.~~

Changed April 05, 2011 07:11PM UTC by rwaldron comment:9

_comment0: Nix everything above. Simplified version here, does exactly and only what the proposal requested: \ \ \ https://github.com/rwldrn/jquery/tree/eventprops.1.6r21302033525698147

Nix everything above. Simplified version here, does exactly and only what the proposal requested:

https://github.com/jquery/jquery/pull/301

Changed April 10, 2011 08:29PM UTC by john comment:10

resolution: → fixed
status: assignedclosed

Landed.