¿Cómo capturar el evento currentTarget on click con mootools en IE?

I created a simple code for handle click event, but IE as I expected returns NULL currentTarget. I am interested in recovering the tag 'a'.

Aquí está el código: http://jsfiddle.net/PUjHf/12/

<div id="features_menu">
    <a id="design_bt">
        <div class="not-selected"><span>DESIGN</span></div>
        <div class="selected"><span>DESIGN</span></div>
    </a>
</div>
window.addEvent( 'domready' , function(event){
      $$('#features_menu a').each(function(item, index){
          item.addEvent('click', function(event){
              console.log($(event.target));
              console.log($(event.event.currentTarget));
          })
      })  
})

For now I have not found any clean solution, someone can help me?

preguntado el 08 de noviembre de 11 a las 11:11

2 Respuestas

MooTools no ampliar DOMEvent para incluir currentTarget (I did not know what it was before you mentioned it).

Pero no es currentTarget exactamente this in the context of an event callback? See r21.

respondido 08 nov., 11:16

incidentally, this was highlighted by my earlier answer, not sure it warranted a new one to say that the domevent does not get normalised by mootools - Dimitar Christoff

Dear @DimitarChristoff, I understand you might have felt disappointed if my answer looked like a duplicate of yours to you. However, I had started redacting my answer before yours was posted and, when I read yours, I did not understand what you meant. Re-reading it now, I still don't find it clear. You don't explain the currentTarget the OP is talking about, but only reference the OP's item; to me, your answer really isn't one to the question "How to catch currentTarget on click event with mootools in IE?". If you are still annoyed, please tell me what you would like me to do about it :) - MattiSG

the OP had a simple question: > I am interested in recovering the tag 'a'.. the answer: it's this or item. there's no need to go into event and explanations on that as it's the wrong API use here. anyway, I totally don't mind. - Dimitar Christoff

While your solution solves this particular problem it does not really help to get to the currentTarget in more convulted scenarios. For example, I want to override stopPropagation() method of Event, so that I can measure some click statistics in my app. Inside this stopPropagation method, I have no way to determine the currentTarget on older IE :( - qbolec

@qbolec If you want to open a new question with more details, then perhaps we can help you ;) - MattiSG

porque no solo console.log(this); // a or console.log(item); //a -> this == item; // true;

http://jsfiddle.net/PUjHf/20/

respondido 08 nov., 11:16

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.