applyTemplate fix to let it manage an HTMLElement graciously

Signed-off-by: mrgamer <mister.gamer@gmail.com>