Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
Changed event.js to add "code" property to keyboard event object #3998
Added the "code" property to the Event object passed to keyboard-triggered event handlers, as suggested on #3978.
Not all properties that we lazy-copy are on all events that the browser can generate, and (at least last I checked) not all the properties are supported by all browsers. We'd need a matrix of event names and valid properties for the event by browser that could cover at least most of them.
To ensure we copy correctly from a native event we would need to dispatch a native event, and the mechanism to do that is browser-dependent as well right now--some support the newer event constructors and some only support the DOM2
@dmethvin My main worry is that some future refactor that will move this code to a different place will lose one of the properties and we won't notice. To prevent that we don't really need to test with real event objects, just mocking it would suffice.
Obviously, that would amount to just duplicating the event name list in tests without testing the substance but it still seems a little bit more secure than what we have now.