PDA

View Full Version : dbkclick Opera problems



armaghedon
15 Nov 2007, 6:43 AM
Hy all,
I recently got into a problem and I thought I have to share it with you :) .
For example if you have a
<span id="test1">aaaaaaa<span><span id="test2" ondblclick="alert('bbb');" >start&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;stop</span> and you want to attach it a double click event strange things happen on Opera browser.


Ext.onReady(function(){
Ext.get('test1').on('dblclick',function(){alert('test1 was dbl clicked');});
Ext.get('test2').on('dblclick',function(){alert('test2 was dbl clicked');})
});

this won't help you. When you double click on the test1 span the browser will select the 'aaaaaaa' content but the dblclick doesn't fire.
But if you double click between start and stop from the second span (test2) exactly on the &nbsp; dblclick is fired. I found this strange.
Of course I tried a lot of work around like


window.addEventListener('dblclick', function(e) {
e.preventDefault(); //prevent popu context menu.
}, false);

and some other things but it didn't work.
My temporary solution was:


Ext.onready(function(){new Ext.dd.DragSource("test1", {scroll:false});new Ext.dd.DragSource("test2", {scroll:false});});
Ext.override(Ext.dd.DragSource, {
onBeforeDrag : function(data, e) {
//console.info(this);
if(this.getEl().id.lastIndexOf("test")!== -1){
//don't show the proxy if is one of these two spans
Ext.get(this.proxy.id).setDisplayed(false);
} else {
Ext.get(this.proxy.id).setDisplayed(true);
}
return true;
}
});

because I had in my page some DragSources with dblclick event attached and it worked fine for those.
I guess i should do something to preventDefault on mousedown event (at the first look on the DragSource.js) ...but i don't know yet...
I'm using Opera v 9.24 and Windows Vista Ultimate and of course extjs 1.1 :).
I'll post more details or the solution when I find one if it's possible to help somebody.

tryanDLS
15 Nov 2007, 7:51 AM
Why are mixing inline handlers with Ext handlers? This is likely to cause weird issues that will be very difficult to track down. Stick with just Ext handlers.

armaghedon
15 Nov 2007, 10:57 PM
Sorry. I didn't (in my script). It was a test to see if it is an extjs bug or an Opera one, and I forgot to delete it. It turned out to be an Opera's problem. :)