cgross / grunt-dom-munger

Grunt task to read and manipulate HTML with CSS selectors.
MIT License
93 stars 40 forks source link

Avoid calling done() too early/repeatedly #11

Closed meodai closed 10 years ago

meodai commented 10 years ago

forEach is synchronous so you can just call done() once it's done.

The current logic was kinda broken since it increments countdown to 1 then decrements it to 0 then if it's 0 it calls done, and it does that at every iteration so it calls done too many times and breaks any following async task in the grunt pipeline.

cgross commented 10 years ago

Thanks for the PR. Looks like I wasn't paying enough attention to a refactoring. That area of code was asynchronous when dom-munger used jsdom.

Thanks!