Dojo port of https://github.com/filamentgroup/AppendAround/blob/master/appendAround.js