Skip to content

Instantly share code, notes, and snippets.

@nolanlawson
Created July 6, 2017 17:21
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save nolanlawson/ac4a0afae1dfd9fc260ac1930239b971 to your computer and use it in GitHub Desktop.
nodeValue unchanged
<html>
<body>
<table>
<tr><td>
<div id="box" style="width:200px;height:200px;background:blue">hello</div></td></tr>
</table>
<br/>
<div onclick="clickme()" style="background:grey">press me</div>
</body>
<script>
function clickme()
{
var box = document.getElementById('box');
var textnode = box.firstChild;
textnode.nodeValue = textnode.nodeValue;
}
</script>
</html><html>
<body>
<table>
<tr><td>
<div id="box" style="width:200px;height:200px;background:blue">hello</div></td></tr>
</table>
<br/>
<div onclick="clickme()" style="background:grey">press me</div>
</body>
<script>
var box = document.getElementById('box');
var textnode = box.firstChild;
function clickme() {
performance.mark('start');
textnode.nodeValue = textnode.nodeValue;
performance.mark('end');
performance.measure('total', 'start', 'end');
}
</script>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment