fix root element selection
add template select unit test (JS)