Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Apr 2003
    Atlanta, GA
    Thanked 0 Times in 0 Posts

    keypress event in DOM?

    DOM2 does not provide a key event module. That's fine. I'm down with that.

    According to the DOM3 Events spec (in last call), there's no keyPress event, only keyDown and keyUp. Instead (I guess) they've defined a new interface for text events, which provides one event type: textInput.

    Should I not code event handlers for keyPress events if I wish to write DOM-compliant scripts? IE & Moz both register a keyPress; I'm sure that it won't be outphased. I worry instead about a new and better browser appearing and balking on my script because it's coded exactly to spec.

    Thoughts? Opinions?

  2. #2
    Senior Coder jkd's Avatar
    Join Date
    May 2002
    metro DC
    Thanked 18 Times in 18 Posts
    Well, you're going to have to keep using keypress for a while. And then would "Uberbrowser 1.0" (when released) support non-DOM3 events? I'd say so. Mozilla supports quite a few non-DOM2 Events, and even has it's own, entirely proprietary, KeyEvent interface to make up for DOM2's lack of one.

    And if not, it shouldn't take more than 10 minutes to update a script already friendly to the DOM to use the textInput event. It looks as though it should simplify most of them anyway, cutting that keyCode/charCode crap.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts