Changeset 6414
- Timestamp:
- 02/29/08 02:30:34 (10 months ago)
- Files:
-
- trunk/openlayers/lib/OpenLayers/Handler/Click.js (modified) (1 diff)
- trunk/openlayers/lib/OpenLayers/Handler/Hover.js (modified) (1 diff)
- trunk/openlayers/tests/Handler/test_Click.html (modified) (2 diffs)
- trunk/openlayers/tests/Handler/test_Hover.html (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/openlayers/lib/OpenLayers/Handler/Click.js
r6131 r6414 160 160 } else { 161 161 // set the timer, send evt only if single is true 162 var clickEvent = this.single ? evt : null; 162 //use a clone of the event object because it will no longer 163 //be a valid event object in IE in the timer callback 164 var clickEvent = this.single ? 165 OpenLayers.Util.extend({}, evt) : null; 163 166 this.timerId = window.setTimeout( 164 167 OpenLayers.Function.bind(this.delayedCall, this, clickEvent), trunk/openlayers/lib/OpenLayers/Handler/Hover.js
r6131 r6414 87 87 this.callback('move', [evt]); 88 88 this.px = evt.xy; 89 // clone the evt so original properties can be accessed even 90 // if the browser deletes them during the delay 91 evt = OpenLayers.Util.extend({}, evt); 89 92 this.timerId = window.setTimeout( 90 93 OpenLayers.Function.bind(this.delayedCall, this, evt), trunk/openlayers/tests/Handler/test_Click.html
r6131 r6414 130 130 } 131 131 } 132 var testEvt = Math.random();133 handler.callbacks = { 134 "click": function(evt) { 135 t.eq(evt , testEvt,132 var testEvt = {id: Math.random()}; 133 handler.callbacks = { 134 "click": function(evt) { 135 t.eq(evt.id, testEvt.id, 136 136 "(click w/ single true) click callback called with correct evt"); 137 137 }, … … 204 204 handler.callbacks = { 205 205 "click": function(evt) { 206 t.ok(evt == clickEvt, "(pixelTolerance met) click called");206 t.ok(evt.xy == clickEvt.xy, "(pixelTolerance met) click called"); 207 207 } 208 208 }; trunk/openlayers/tests/Handler/test_Hover.html
r6131 r6414 79 79 80 80 // test pause and move callbacks - four tests here (2 from setTimeout above) 81 testEvt = Math.random();81 testEvt = {id: Math.random()}; 82 82 handler.callbacks = { 83 83 "pause": function(evt) { 84 t.eq(evt , testEvt,84 t.eq(evt.id, testEvt.id, 85 85 "pause callback called with correct evt"); 86 },87 "move": function(evt) {88 t.eq(evt, testEvt,89 "move callback called with correct evt");90 }86 }, 87 "move": function(evt) { 88 t.eq(evt.id, testEvt.id, 89 "move callback called with correct evt"); 90 } 91 91 }; 92 92 map.events.triggerEvent("mousemove", testEvt); … … 117 117 handler.callbacks = { 118 118 "pause": function(evt) { 119 t.ok(evt == testEvt, "(pixelTolerance unmet) pause callback called");119 t.ok(evt.xy == testEvt.xy, "(pixelTolerance unmet) pause callback called"); 120 120 }, 121 121 "move": function(evt) {
