Add custom element validation and import cleanup in HTML worker