I am facing an issue with the Locker Service. I have a simple piece of code. I have attached the code here. The issue is that if the Locker Service is deactivated, I am able to get the value using “colindex” attribute the element output is as shown in the screenshot. Whereas, if it is activated, I am unable to get the value using “colindex” attribute. I have attached both screenshots as well as the code.

Spring 17 - Salesforce


<aura:application >
   <c:testJqueryComponent />
</aura:application >


<aura:component >
<ltng:require scripts="{!join(',',
                       $Resource.jQuery + '/jquery/lightning/js/jquery-2.2.4.min.js',
                       $Resource.jQuery + '/jquery/lightning/js/jquery-migrate-1.3.0.min.js')}" 
<div id="divTest"></div>
<h1 id="pvalue" style="font-size:20px;"></h1>


doResult : function(component, event, helper) {
                       +'<td colindex="1" >value 1</td>'
                       +'<td colindex="2" >value 2</td>'
    $('#pvalue').html('first td colindex value: '+$('tr td:first').attr('colindex'));

Elements output: Locker service is deactivatedenter image description here

Elements output: Locker service is activated enter image description here


HTMLTableDataCellElement https://developer.mozilla.org/en-US/docs/Web/HTML/Element/td does not appear to support colindex (or colIndex) and locker has a very specific whitelist for attributes, methods, classes, etc that are supported based on standards specifications.

Doing a quick google search also yields very few hits on support for colindex in browsers.

HTMLTableRowElement.rowIndex and HTMLTableCellElement.cellIndex do exist and are already supported in locker.

Custom attributes are also fully supported, e.g. data-colindex

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.