Modify event variable in JavaScript
Is there a way to modify the event variable (IE: window.event, others: e) in JavaScript? I know you can easily clone it, using a quick loop copy. However, the bro开发者_开发问答wser won't let you do that for methods like e.preventDefault() and such. So, I'm looking for another way to do it.
(Yes, I know it probably isn't a good idea. But I want to do it anyways.)
Well (keeping in the back of your mind RobG's comment), you can add methods to the prototype of Event
, and you can overwrite native methods in the Event.prototype
.
Like in this jsfiddle. Is that what you meant?
精彩评论