gregersrygg / crapLoader

Asynchronous script loader/runner for ads, widgets and other third-party content
71 stars 10 forks source link

traverseForElById: Fix for buggy DFS #9

Closed steffenweber closed 12 years ago

steffenweber commented 12 years ago

The depth-first search in traverseForElById has a bug: If a node has children then its siblings are never considered.

A test-case that fails without this bugfix: 

document.write('<div><img/></div><div id="myDIV"></div>');
document.getElementById('myDIV').innerHTML = 'Works';
gregersrygg commented 12 years ago

Thanks! :)