Why not just add word-break: break-word; to the CSS of the HTML element container? Much simpler.
word-break: break-word;