Factored out DOM-specific state from the core template mechanism