SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    padawan silver trophybronze trophy markbrown4's Avatar
    Join Date
    Jul 2006
    Location
    Victoria, Australia
    Posts
    4,108
    Mentioned
    28 Post(s)
    Tagged
    2 Thread(s)

    registering key event on iframe - Opera

    Hi,

    linky linky

    I haven't figured out how to register the keyup events on the iframe in Opera, You need to register the event on the iframe's window for Firefox and the iframe's document for Safari. I haven't yet tamed Opera.
    Code javascript:
    this.contentWindow = this.iframe.contentWindow;
    // FF
    Event.observe(this.contentWindow, 'keyup', this.editorKeyUpHandler.bind(this));
    // Safari
    Event.observe(this.contentWindow.document, 'keyup', this.editorKeyUpHandler.bind(this));
    The editorKeyUpHandler function is used for cleaning up the formatting - defaults elements to paragraphs - like IE does by default when you press enter.

    Thanks,

  2. #2
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,713
    Mentioned
    102 Post(s)
    Tagged
    4 Thread(s)
    Great minds have been working on a cross-browser solution for adding events and have come up with the following.

    http://www.dustindiaz.com/rock-solid-addevent/

  3. #3
    padawan silver trophybronze trophy markbrown4's Avatar
    Join Date
    Jul 2006
    Location
    Victoria, Australia
    Posts
    4,108
    Mentioned
    28 Post(s)
    Tagged
    2 Thread(s)
    Are you saying that prototype's observe method doesn't account for this situation in Opera?

  4. #4
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,713
    Mentioned
    102 Post(s)
    Tagged
    4 Thread(s)

  5. #5
    padawan silver trophybronze trophy markbrown4's Avatar
    Join Date
    Jul 2006
    Location
    Victoria, Australia
    Posts
    4,108
    Mentioned
    28 Post(s)
    Tagged
    2 Thread(s)
    It's not that I don't believe you, but why would it only be for the iframe?

    I'm adding events to the buttons and the drop down menu's and they work fine in opera as everything else.. It's just this one element that is struggling.

  6. #6
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,713
    Mentioned
    102 Post(s)
    Tagged
    4 Thread(s)
    That sounds like a good test case for the developers of Prototype to debug.

    You can get started on reporting the bug from the following page

    http://www.prototypejs.org/contribute

  7. #7
    padawan silver trophybronze trophy markbrown4's Avatar
    Join Date
    Jul 2006
    Location
    Victoria, Australia
    Posts
    4,108
    Mentioned
    28 Post(s)
    Tagged
    2 Thread(s)
    I'll make sure it's a bug with the observe method in Prototype before submitting it - I submitted a bug the other week and it was just that the js was cached in Safari - I'll try registering the event using another method and see if I can get something working.

    Thanks,


Bookmarks

Posting Permissions

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