Commit 96a44a86 authored by Dave Methvin's avatar Dave Methvin

Fix #10375. Don't put `type` in jQuery.event.props

It's already set in jQuery.Event, and copying it can clobber values set by the caller, e.g., the UI widget factory.
parent 22fcc774
...@@ -467,7 +467,7 @@ jQuery.event = { ...@@ -467,7 +467,7 @@ jQuery.event = {
// Includes some event props shared by KeyEvent and MouseEvent // Includes some event props shared by KeyEvent and MouseEvent
// *** attrChange attrName relatedNode srcElement are not normalized, non-W3C, deprecated, will be removed in 1.8 *** // *** attrChange attrName relatedNode srcElement are not normalized, non-W3C, deprecated, will be removed in 1.8 ***
props: "attrChange attrName relatedNode srcElement altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp type view which".split(" "), props: "attrChange attrName relatedNode srcElement altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),
propHooks: {}, propHooks: {},
......
...@@ -1101,7 +1101,7 @@ test("trigger(eventObject, [data], [fn])", function() { ...@@ -1101,7 +1101,7 @@ test("trigger(eventObject, [data], [fn])", function() {
test("jQuery.Event( type, props )", function() { test("jQuery.Event( type, props )", function() {
expect(4); expect(5);
var event = jQuery.Event( "keydown", { keyCode: 64 }), var event = jQuery.Event( "keydown", { keyCode: 64 }),
handler = function( event ) { handler = function( event ) {
...@@ -1111,6 +1111,9 @@ test("jQuery.Event( type, props )", function() { ...@@ -1111,6 +1111,9 @@ test("jQuery.Event( type, props )", function() {
// Supports jQuery.Event implementation // Supports jQuery.Event implementation
equal( event.type, "keydown", "Verify type" ); equal( event.type, "keydown", "Verify type" );
// ensure "type" in props won't clobber the one set by constructor
equal( jQuery.inArray("type", jQuery.event.props), -1, "'type' property not in props (#10375)" );
ok( "keyCode" in event, "Special 'keyCode' property exists" ); ok( "keyCode" in event, "Special 'keyCode' property exists" );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment