Doctype declaration handling is case sensitive

As seen here the html doctype is not recognized when lowercased. It works properly with DOCTYPE though.

Given that the doctype should be case insensitive I wonder if this is refernce implementation bug I’m facing.