Re: [whatwg/dom] Consider more name validation loosening (Issue #1373)

josepharhar left a comment (whatwg/dom#1373)

> tl;dr I think it's fine for document.createProcessingInstruction to be XML only and as such maintain the XML name rules. But `createDocumentType` is used for HTML parsing and as such should allow the HTML character set.

Thanks for the analysis! This sounds good to me, I'm happy to leave createProcessingInstruction as-is.



> From what I can tell reading https://html.spec.whatwg.org/#doctype-state a definition of "valid doctype name" that matches the HTML parser would be something like:
> 
> * If _name_ contains NUL, ASCII whitespace, or >, then return false.
> * Otherwise, return true.
> 
> Some [testing](https://jsbin.com/piveqimida/1/edit?html,js,console) seems to bear this out.
> 
> Should we roll that into [#1079](https://github.com/whatwg/dom/pull/1079) too?

So instead of using the new qualified name parsing for attributes, we would just check for those 3 things in the qualified name passed to createDocumentType? That sounds ok to me.

There's also the "publicId" and "systemId" parameters to that method which don't currently have any validation/parsing. Can those stay unvalidated?

-- 
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/dom/issues/1373#issuecomment-2895283002
You are receiving this because you are subscribed to this thread.

Message ID: <whatwg/dom/issues/1373/2895283002@github.com>

Received on Tuesday, 20 May 2025 17:31:42 UTC