html5.js: add main-element support