Run details:
Mozilla/5.0 (iPhone; CPU iPhone OS 10_1_1 like Mac OS X) AppleWebKit/602.2.14 (KHTML, like Gecko) Version/10.0 Mobile/14B100 Safari/602.1
Mobile Safari 10
iOS 10.1.1
iPhone
7 years ago
Test name Executions per second
Pure JS .innerText 243440.6 Ops/sec
Pure JS .innerHTML 1100395.0 Ops/sec
Pure JS .textContent 1573204.0 Ops/sec
jQuery .text() 484887.0 Ops/sec
jQuery .html() 381301.3 Ops/sec
HTML Preparation code:
Tests:
  • Vanilla JS .innerText

  • Vanilla JS .innerHTML

  • Vanilla JS .textContent

  • Vanilla JS (querySelector) .innerText

  • Vanilla JS (querySelector) .innerHTML

  • Vanilla JS (querySelector) .textContent

  • Vanilla JS (querySelectorAll) .innerText

  • Vanilla JS (querySelectorAll) .innerHTML

  • Vanilla JS (querySelectorAll) .textContent

  • Cash .text

  • Cash .html

  • jQuery .text()

  • jQuery .html()

  • jQuery .find() .text()

  • jQuery .find() .html()