innerText vs textContent (v6)

Revision 6 of this benchmark created on


Preparation HTML

<table>
 <tr>
  <td>empty</td>
 </tr>
</table>
<div class="grid" style="text-rendering:optimizeSpeed;">
 <div>
  <div style="display:table-cell;">empty</div>
 </div>
</div>

Setup

var table = document.querySelector('table'), x, y, rows, grid = document.querySelector('.grid');

Test runner

Ready to run.

Testing in
TestOps/sec
innerText
//for (x = 0; x < 10; x ++) {
    rows = table.rows[0].cells[0].firstChild.data = 'table';
    //for (y = 0; y < 5; y ++) {
        //rows[y].firstChild.data = 'innerText';
    //};
//};
ready
textNode
//for (x = 0; x < 10; x ++) {
    rows = grid.firstElementChild.firstElementChild.firstChild.data = 'grid';
    //for (y = 0; y < 5; y ++) {
       // rows[y].firstChild.data = 'textNode';  
    //};
//};
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.