I’d like to parse
<img/>'s and grab their original
height as I set that as attributes on my image nodes. The best way to do this is by using the
Image.onload() callback. This means that I’ll have the computed node attributes asynchronously.
Thoughts on how this could be implemented? Is it possible for the calling mechanism of
getAttrs() to pass a
done handler? Maybe
Since parsing is synchronous, no, that’s not really something that can be done. If you’re doing the parsing yourself, you can to do something like do a second pass over the parsed document to asynchronously resolve and replace nodes like this. If you want this to happen in paste handlers and such, it’s more complicated (but making paste asynchronous seems like a rather bad idea anyway).
Ah thanks for the response, I figured it was a long shot.