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 rows and the console output is as shown in the screenshot. Whereas, if it is enabled, the HTML table rows is displayed as undefiend on the console output. I have attached both screenshots as well as the code. Summer 16 - Salesforce

DemoTestApp.app

<aura:application >
   <c:DemoTest />
</aura:application>

DemoTest.cmp

<aura:component >
   <ui:button class="btn" label="Create Table" press="{!c.createTable}"/>
   <ui:button class="btn" label="Read Table" press="{!c.readTable}"/>
   <div id="divTest">
   </div>
</aura:component>

DemoTestController.js

({
createTable : function(component, event, helper) {
    var staticTable,table,tablehead,tablebody,tr,th,td;
    staticTable=document.getElementById("divTest");
    table = document.createElement("table");
    tablehead = document.createElement("thead");
    tablebody = document.createElement("tbody");
    //Appending Table Header
    tr = document.createElement("tr"); 
    th = document.createElement("th");
    th.textContent = "slNo";
    tr.appendChild(th);
    th = document.createElement("th");
    th.textContent = "Name";
    tr.appendChild(th);
    tablehead.appendChild(tr);
    table.appendChild(tablehead);
    //Appending Table Body
    tr = document.createElement("tr");
    td = document.createElement("td");
    td.textContent = "1";
    tr.appendChild(td);
    td = document.createElement("td");
    td.textContent = "Demo 1";
    tr.appendChild(td);
    tablebody.appendChild(tr);
    table.appendChild(tablebody);
    //Appending Table to Div
    staticTable.appendChild(table);
},
readTable : function(component, event, helper) {
    //Read table rows
    var staticTableDOM=document.getElementById('divTest').getElementsByTagName('table')[0]; 
    console.log('*** Table ***');
    console.log(staticTableDOM);
    console.log('*** Table Rows ***');
    console.log(staticTableDOM.rows);
    console.log('*** Table 1st Row cells ***');
    console.log(staticTableDOM.rows[0].cells);
}
})

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

Console log output: Locker service is enabled enter image description here

1

Known issue with a fix scheduled to deploy to Winter'17 later this month.

  • Hi Doug Chasman we have checked this issue in sandbox with winter '17 release it working there but in the developer edition(Winter '17) it's not working. Should we assume that the fixed is not deployed in developer edition ? is there any way to check that fixed is deployed in our org or not ? – Gopalakrishna Boddepalli Oct 18 '16 at 14:09
  • Hi @Doug Chasman we still do not have a resolution for this issue. Do you know if the relevant fix has been deployed or when it will be deployed? Please let me know. – Gopalakrishna Boddepalli Oct 24 '16 at 11:54

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.