Mostly the lineheight. After a few quick tests it looked like setting line-height to the font size + 3pt was a correct estimation. But it might not hold true for all sizes and font-family. Also, if the wrapping in the div did not occur exactly the same as in the canvas rendering, everything's going to be off.
edit: After a few more hacking around, I noticed that upon rendering, text instances have a javascript property called "lines" that get filled with an array of objects representing the wrapped lines. I used this array to create the div instead of the text property and it seems to work better as it creates a consistent wrapping. The only drawback is that the text object has to be rendered at least once before you can use the lines array.
Try redownloading the file to see for yourself.