2

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 enter image description here

Elements output: Locker service is enabledenter image description here Console log output: Locker service is disabled enter image description here Console log output: Locker service is enabledenter image description here

2 Answers 2

0

As stated in this similar question:

The fix for this is scheduled to be released in the Spring '17 major release.

Until then please try to move your HTML in to your markup file. Or you can try a dynamically created component solution like this answer suggests, though that is a bit of extra overhead.

5

Role is not currently supported - not a security issue though just an oversight on support for Aria. Easily corrected on the Salesforce end if you could please open a support case and post the case ID here.

You can always see what is supported on various elements here http://documentation.auraframework.org/lockerApiTest/secureElement.app?aura.mode=DEV

1
  • 1
    Thanks for the replay. we opened the case for this issue and the case number is #15188595 Nov 24, 2016 at 5:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.