🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: pl.comp.lang.javascript
3 messages
3 total messages Started by Exe Very Cute Thu, 29 May 2014 07:51
Event target w Chrome
#51424
Author: Exe Very Cute
Date: Thu, 29 May 2014 07:51
28 lines
1739 bytes
Czy grupa żyje? ;-]

Zauważyłem dziwne(?, w każdym razie inne) zachowanie Chrome.
Podpinam sobie pod click buttona np. taką funkcję:

se = document.createElement('input');
se.setAttribute('type', 'text');
se.setAttribute('name', e.target.getAttribute('name'));
se.setAttribute('value', e.target.getAttribute('value'));
e.target.parentNode.appendChild(se);

i co ważne button wgląda tak:

<button type="submit" name="active" value="1">
<img alt="" src="x.gif">
</button>

W każdej innej przeglądarce e.target wskazuje na element button (do 
niego przypinam event) a w Chrome e.target wskazuje na img...

Ktoś coś jakaś podpowiedź? To jest poprawne zachowanie a reszta świata 
się myli? To nie jest jakoś standaryzowane?

Mało tego, czasem e.target w Chrome wskazuje mi na button, ale zupełnie 
inny (kolejny w dokumencie HTML).

Pozdr
Exe Very Cute
Re: Event target w Chrome
#51425
Author: Cezary Tomczyk
Date: Fri, 30 May 2014 18:09
26 lines
1852 bytes
W dniu 2014-05-29 09:51, Exe Very Cute pisze:
> Czy grupa żyje? ;-]

Jeszcze tak :-)

> Zauważyłem dziwne(?, w każdym razie inne) zachowanie Chrome.
> Podpinam sobie pod click buttona np. taką funkcję:
[...]

> W każdej innej przeglądarce e.target wskazuje na element button (do
> niego przypinam event) a w Chrome e.target wskazuje na img...
>
> Ktoś coś jakaś podpowiedź? To jest poprawne zachowanie a reszta świata
> się myli? To nie jest jakoś standaryzowane?
>
> Mało tego, czasem e.target w Chrome wskazuje mi na button, ale zupełnie
> inny (kolejny w dokumencie HTML).

Uzyj https://developer.mozilla.org/en-US/docs/Web/API/event.currentTarget

A jeśli musisz wspierać IE < 9 to może to pomoże 
https://gist.github.com/eirikbacker/2864711

-- 
Cezary Tomczyk
http://www.ctomczyk.pl/
Re: Event target w Chrome
#51426
Author: Exe Very Cute
Date: Sun, 01 Jun 2014 20:56
12 lines
1419 bytes
W dniu 2014-05-30 20:09, Cezary Tomczyk pisze:

>> Mało tego, czasem e.target w Chrome wskazuje mi na button, ale zupełnie
>> inny (kolejny w dokumencie HTML).
>
> Uzyj https://developer.mozilla.org/en-US/docs/Web/API/event.currentTarget

A no widzisz, czegoś takiego szukałem, coś mi dzwoniło o 
"oryginalTarget" ;-] Dzięki.

Pozdr
Exe Very Cute
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads