[SalesForce] Locker Service: How to get the event target

Greetings great people of the Salesforce Stackexchange,

We are having some trouble with Salesforce Locker Service update in the custom Lightning Components we're developing.

This works without Locker Service enabled, but breaks with it turned on.


<aura:iteration items="{!v.results}" var="result">
    <li class="slds-dropdown__item">
        <a onclick="{!c.select}" data-object="{!result.stringified}">{!result.Name}</a>


select: function(component, event, helper){

    var valueObject = JSON.parse(event.target.getAttribute('data-object'));


With LockerService enabled, valueObject is null.

The event object looks like this: Preview of the event object in the console

event.target outputs as an empty object in the console: {}

We've tried event.getTarget(), event.getSource(), event.currentTarget and tons more examples we found throughout official Salesforce documentation, but without result.

How can we know what the user has clicked on with Locker Service?

Please liberate me from my ignorance. 🙂

Best Answer

I believe the issue here is at the intersection of aura:iteration and Locker resulting in a sort of custody battle over ownership of the resulting DOM. Opened bug W-3458193 to track this.