innerHTML vs innerText vs nodeValue
JavaScript performance comparison
Preparation code
<div id="divinputme">
</div>
<span id="spaninputme">
</span>
<script>
var a = document.getElementById('divinputme'),
b = document.getElementById('spaninputme');
s = '1,2,3,4';
</script>
Preparation code output
<div id="divinputme">
</div>
<span id="spaninputme">
</span>
Test runner
Warning! For accurate results, please disable Firebug before running the tests. (Why?)
Java applet disabled.
Test | Ops/sec | |
---|---|---|
innerText - div
|
|
pending… |
innerText - span
|
|
pending… |
innerHTML - div
|
|
pending… |
innerHTML - span
|
|
pending… |
nodeValue - div
|
|
pending… |
nodeValue - span
|
|
pending… |
Compare results of other browsers
Revisions
You can edit these tests or add even more tests to this page by appending /edit
to the URL.
- Revision 1: published lx
- Revision 4: published David Calhoun
- Revision 7: published Nikolay Frantsev
- Revision 8: published vamp
- Revision 9: published
- Revision 10: published
- Revision 11: published
- Revision 12: published
- Revision 13: published
- Revision 14: published
- Revision 17: published NAIF
- Revision 18: published
- Revision 19: published
- Revision 20: published
- Revision 21: published
- Revision 22: published
- Revision 23: published
- Revision 24: published
- Revision 25: published
- Revision 26: published
- Revision 27: published *andy
- Revision 28: published Ojle Nenpleto
- Revision 29: published
- Revision 31: published
- Revision 32: published
- Revision 33: published
- Revision 34: published
- Revision 35: published
- Revision 36: published
- Revision 37: published
- Revision 38: published
- Revision 39: published mark
- Revision 40: published
- Revision 41: published
- Revision 42: published Sam
- Revision 45: published
- Revision 46: published
- Revision 47: published
- Revision 48: published Peter
- Revision 49: published
- Revision 50: published Andrew
- Revision 52: published Gilles Piou
- Revision 53: published Gilles Piou
0 Comments