Functor-based approach for abstracting Html5 implementation