Permalink
Browse files

Patching local processing.js for bug #1740 with nodelist infinite loo…

…p bug.
  • Loading branch information...
1 parent 98996df commit 8e6f7b7a457c02a648c306d9ff072ebb7c809562 David Humphrey committed Oct 26, 2011
Showing with 11 additions and 3 deletions.
  1. +11 −3 processing.js
View
@@ -19746,10 +19746,18 @@
loadSketchFromSources(canvas[i], filenames);
}
}
-
+//dh: custom patch for this processing.js, see https://processing-js.lighthouseapp.com/projects/41284-processingjs/tickets/1740-processinginit-uses-a-nodelist-as-if-its-an-array-which-can-cause-race-conditions#ticket-1740-2
// also process all <script>-indicated sketches, if there are any
- var scripts = document.getElementsByTagName('script');
- var s, source, instance;
+ var s, last, source, instance,
+ nodelist = document.getElementsByTagName('script'),
+ scripts = [];
+
+ // snapshoot the DOM, as the nodelist is only a DOM view, and
+ // always up to date
+ for (var s=nodelist.length-1; s>=0; s--) {
+ scripts.push(nodelist[s]);
+ }
+
for (s = 0; s < scripts.length; s++) {
var script = scripts[s];
if (!script.getAttribute) {

0 comments on commit 8e6f7b7

Please sign in to comment.