Closed ddayguerrero closed 6 years ago
I actually don't mind the idea of creating a synthetic event to normalize the property access, maybe we could just return a re-created event object from _eventNormalize
?
In addition to target
and which
, it looks like we also call prevent default in some of the listeners so we'd need to also add that to the mocked event.
Fixed @ 1.2.5
What is the issue?
Validation and formatting are not triggered because of uncaught errors thrown in the
_eventNormalize
function on keyboard and input events. There is an attempt to assign values to readonly properties.This occurs on latest Chrome, Firefox, and Safari.
Error Log:
How to reproduce the issue?
payform.js
fileimport
(e.g.import payform from '../vendor/payform.js';
)Discussion
This behaviour only occurs when vendoring the distribution file. No errors are thrown if we install the package via npm and use
require
.From what I understand, the
_eventNormalize
function was introduced to modify the event for legacy browser support (e.g. IE8).According to MDN, the
keyCode
attribute is deprecated and should not be used when handling the keyboard event types (e.g.keydown
) handled in payform.Here is what I suggest to allow users to vendor payform: 1- Recreate a new event and assign
target
andwhich
attributes 2- Drop support for legacy browsers?What do you think? 🙂