Change the compiler to use template elements instead of comments for view ports

DON'T MERGE

Using template elements makes viewports queryable, so we don't have to walk the DOM ourselves and rely on querySelectAll.  It looks like the change causes a 10% performance degradation. This requires some investigation.  

all 3 conditions could be aligned, no need for external ()