shim for firefox innertext

JavaScript performance comparison

Test case created by Josh Vermaire


shim for firefox innertext

Preparation code

Benchmark.prototype.setup = function() {
    span = document.getElementsByTagName('span')[0]
    ff = /Firefox/.test(navigator.userAgent)
    innerText = ff ? function(el, text) {
      return el.textContent = text;
    } : function(el, text) {
      return el.innerText = text;

Preparation code output

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
innerText(span, 'hi')
span.innerText = 'hi'

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

Compare results of other browsers

1 comment

Josh Vermaire (revision owner) commented :

Of course, Firefox isn't supporting innerText (thus the reason for this). Although it has the method on each element, which is why it's shown as blazing fast.

Comment form temporarily disabled.

Add a comment