Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Event parameter

 
Sen George
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The following code works but with one error. Error is that the argument "ev" is undefined. Please advise.

 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64623
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
IE does not follow the W3C standards for event handling. It makes the Event instance available at window.event instead of passing it to the listener.

So you could add code to the listener such as:to deal with this egregious behavior.

Also be aware that IE also populates the Event instance with non-standard properties. So you need to deal with that too!

Or (highly recommended!) use a library like jQuery for your event handling which hides these (and other) browser differences.

P.S. "ev"? What's wrong with "event"? Much more readable.
[ November 02, 2008: Message edited by: Bear Bibeault ]
 
Sen George
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you for the clarification.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic