Search code examples
javascriptinternet-explorerprototypepreventdefault

Is it a bad idea to modify Event.prototype for cross-browser event.preventDefault();?


Pretty straightforward question. < IE8 doesn't support event.preventDefault(), so I'd like to modify Event.prototype for IE to add my own preventDefault method utilizing event.returnValue. Simple task, but is it a bad idea?


Solution

  • So far, in my opinion, the best answer to this question is that it's not a bad idea. That doesn't mean screwing around with prototype in general or even with other methods of Event is a good idea, but normalizing event.preventDefault() seems entirely harmless– no, helpful.

    Please do chime in if you can provide a better answer.