Search code examples
firefoxfirefox-addonfirefox-addon-restartless

Is it possible to get the window object from the event in handleEvent?


As in the question... how to get the window object from an event fired in the window scope for example:

handleEvent: function(event) {

  // is window object available here and can we get it from event
}

I can get the window object from other APIs. I was wondering if it was possible to get it from the fired event.

Reference:
handleEvent
Code Snippet using handleEvent


Solution

  • I found out the answer ... any of these will get the window object from the event

    event.view event.view
    event.target.ownerDocument.defaultView event.target
    event.originalTarget.ownerGlobal event.originalTarget (Non-standard)