In Android mobile browser, compiling a dust.js template caused the error p.substr [undefined]. It worked fine in desktop browsers. The reason for the error was the closing of tag <input class="xyz" /> elements. Same in the case of img tag as well. So writing the element like below works fine.

<input type="hidden" name="someName" value="123">
<img src="pic.png" >