template ref should check treeScope.getElementById

R=arv
BUG=

Review URL: https://codereview.appspot.com/9519043