Opened 16 years ago

Closed 16 years ago

Last modified 15 years ago

#365 closed defect (fixed)

dojo.html.getEventTarget acts differently in Safari

Reported by: [email protected] Owned by: sjmiles
Priority: high Milestone:
Component: General Version: 0.2
Keywords: getEventTarget safari Cc:
Blocked By: Blocking:


In Moz & IE, clicking on a plaintext node sends the click event to the containing element (for instance a <div> or <span>). In Safari the event goes to the text node itself. This causes the dojo.html.getEventTarget() function to give different results in the different browsers.

I have a simple HTML file that displays this behavior, but I can't figure out how to attach it. Please email me if you want it, [email protected]… or [email protected]

In order to equalize the results, getEventTarget() should check the nodeType of event.srcElement. If the nodeType == 3, then event.srcElement.parentNode should be returned instead. Example code:

function getEventTargetSafariSafe(evt){
	if(!evt) { evt = window.event || {} };
	if(evt.srcElement) {
		return (evt.srcElement.nodeType == 3 ? evt.srcElement.parentNode : evt.srcElement);
	} else if( {
	return null;

Attachments (1)

safari.html (1.3 KB) - added by [email protected] 16 years ago.
Example html which displays the problem described in the ticket

Download all attachments as: .zip

Change History (5)

Changed 16 years ago by [email protected]

Attachment: safari.html added

Example html which displays the problem described in the ticket

comment:1 Changed 16 years ago by alex

Milestone: 0.2.2release0.3release

targeting to correct milestone

comment:2 Changed 16 years ago by alex

Owner: changed from anonymous to sjmiles

comment:3 Changed 16 years ago by sjmiles

Resolution: fixed
Status: newclosed

rev #3677

comment:4 Changed 15 years ago by (none)

Milestone: 0.3release

Milestone 0.3release deleted

Note: See TracTickets for help on using tickets.