Created
July 11, 2014 22:09
-
-
Save jcmoore/44b117ce6cd6ab4630f3 to your computer and use it in GitHub Desktop.
Polymer DOM selection over many divs (hangs on FFv30)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html class="no-js -webkit-" lang="en"><!--<![endif]--> | |
<!-- Problem avoided if platform.js is not loaded --> | |
<script language="javascript" src="http://cdnjs.cloudflare.com/ajax/libs/polymer/0.3.3/platform.js"></script> | |
<script type="text/javascript"> | |
// version of platform.js does not seem to matter (in Firefox -- v30 for instance) | |
document.addEventListener('DOMContentLoaded', attempt); | |
function attempt () { | |
setTimeout(function () { | |
console.log("("+Date.now()+") hang starts in 3 seconds -- scroll around to see effects"); | |
setTimeout(function () { | |
console.log("("+Date.now()+") hanging very soon"); | |
setTimeout(function () { | |
var count = 50, | |
index = 0; | |
console.log("("+Date.now()+") hang up"); | |
for (index = 0; index < count; index++) { | |
// any of the following | |
// will take a long time | |
//document.getElementsByTagName("notatag"); | |
//document.getElementsByClassName("notaclass"); | |
//document.getElementsByName("notaname"); | |
document.querySelectorAll("notaselector"); | |
} | |
console.log("("+Date.now()+") hang over"); | |
}, 200); | |
}, 3000); | |
}, 0); | |
} | |
// static m&m screen below | |
// list campaigns | |
</script> | |
<body> | |
<script type="text/javascript"> | |
(function () { | |
var count = 9001, | |
index = 0, | |
child = null; | |
for (index = 0; index < count; index++) { | |
child = document.createElement("DIV"); | |
child.innerHTML = Date.now() + "" + Math.random(); | |
//child.setAttribute("id", Date.now() + "" + Math.random()); | |
document.body.appendChild(child); | |
} | |
}) (); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment