I just updated jQuery from 1.8.3 to 1.9, and it started crashing all of a sudden.
This is my template:
I guess your template is starting with a space or a tab.
You can use jQuery like that:
$($.parseHtml(modal_template_html)[1]);
or parse the string to remove spaces of the beginning:
$(modal_template_html.replace(/^[ \t]+/gm, ''));