Changed to be correct for HTML5
Changes based on UiElement