PDA

View Full Version : IE6, dom or event bug ? It round me crasy



etiennesamson
5 Aug 2007, 3:33 AM
Hi, thanks a lot for your fantastic Ext framework,

I use Ext in standalone, I include Ext in my header html document with the folowing order :
- ext-base.js
- ext-core.js
- ext-all.js

I have a set of "a"

BernardChhun
5 Aug 2007, 4:04 AM
hmm install MS Script Editor (http://extjs.com/learn/Manual:Resources#MS_Script_Editor) or IE Web Developper (http://extjs.com/learn/Manual:Resources#IE_Web_Developper) and before the


var myClass=el.dom.getAttribute('class');

line, add


console.log(el);

to check out what is returned in the el variable.

ohh and don't add an onClick event on each A tags that way. Imagine if you have 100 li elements. That would also make 100 onClick listeners for each A elements...and that will kill your app.

use event delegation:


Ext.select("ul#ul-id").on("click",
function(e){
var el = Ext.fly(e.getTarget());
alert(el.dom.tagName);
}, this, true
);

as you can see, there's not much differences with what you have coded until now. The main thing is that there's only one click handler for all the nodes under the UL element.

etiennesamson
5 Aug 2007, 4:35 AM
Thank you very much for your support.

with event delegation I'll find a easyest and much optimiser way to do my stuff.

It works fine with IE6.

Thank's again.

Etienne