I am facing an issue with the Locker Service. I have a simple piece of code which reads HTML table rows. I have attached the code here. The issue is that if the Locker Service is disabled, I am able to read the HTML table row using "role" attribute and the console output is as shown in the screenshot. Whereas, if it is enabled, I am unable to read the HTML table row using "role" attribute. I have attached both screenshots as well as the code. Winter 17 - Salesforce
DemoTestApp.app
<aura:application >
<c:testJqueryComponent />
</aura:application>
DemoTest.cmp
<aura:component >
<ltng:require scripts="{!join(',',
$Resource.jQuery + '/jquery/js/jquery-2.2.4.min.js',
$Resource.jQuery + '/jquery/js/jquery-migrate-1.3.0.min.js')}"
afterScriptsLoaded='{!c.doResult}'/>
<div id="divTest"></div>
<button id="btnView" onclick="{!c.readTR}">Read TR</button>
</aura:component>
DemoTestController.js
({
doResult : function(component, event, helper) {
$("#divTest").html('<table><tr role="row">'
+'<td role="cell" aria-describedby="1">value 1</td>'
+'<td role="cell" aria-describedby="2">value 2</td>'
+'</tr></table>');
},
readTR:function(component, event, helper) {
console.log('*** No of rows ****')
console.log($('tr[role=row]').length);
}
})
Elements output: Locker service is disabled
Elements output: Locker service is enabled
Console log output: Locker service is disabled
Console log output: Locker service is enabled