[OpenLayers-Trac] Re: [OpenLayers] #3262: OpenLayers Event objects in Firefox have unstable 'getPreventDefault' methods.

OpenLayers trac-20090302 at openlayers.org
Tue Apr 26 02:57:16 EDT 2011


#3262: OpenLayers Event objects in Firefox have unstable 'getPreventDefault'
methods.
----------------------------+-----------------------------------------------
  Reporter:  mgleahy        |       Owner:              
      Type:  feature        |      Status:  reopened    
  Priority:  minor          |   Milestone:  2.12 Release
 Component:  Handler.Click  |     Version:  2.10        
Resolution:                 |    Keywords:              
     State:                 |  
----------------------------+-----------------------------------------------
Changes (by erilem):

  * component:  general => Handler.Click
  * milestone:  2.11 Release => 2.12 Release


Comment:

 Thanks for following up.

 In fact the issue is specific to the click handler. The click handler
 sends a clone of the event object to the "click" callback. This is because
 the click handler runs the "click" callback in a timer callback—at a time
 when the actual event object may no longer be valid.

 The "click" callback running outside the actual event handling "thread"
 makes calling functions like preventDefault not applicable. So I think we
 should document (a) that the event object isn't a real one, and (b) what
 properties of that object can be read.

 "getDefaultProperty" (or "defaultPrevented") could be of one these
 properties. But that would not convert this object into a real event
 object, so passing it to {{{jQuery.event.fix()}}} or similar would still
 be unsafe.

 As a last note, people who do need an actual "click" event should not use
 the click handler. Instead they should rely on
 {{{OpenLayers.Event.observe}}} or other functions from other libs.

 I hope it makes sense.

-- 
Ticket URL: <http://trac.openlayers.org/ticket/3262#comment:4>
OpenLayers <http://openlayers.org/>
A free AJAX map viewer


More information about the Trac mailing list