fix error reporting for attaching; support notClosed elements in HTML