[wp-trac] [WordPress Trac] #62396: HTML API: serialize should include doctype when present
WordPress Trac
noreply at wordpress.org
Thu Nov 14 15:28:55 UTC 2024
#62396: HTML API: serialize should include doctype when present
-------------------------------------------------+-------------------------
Reporter: jonsurrell | Owner: jonsurrell
Type: defect (bug) | Status: reopened
Priority: normal | Milestone: 6.7.1
Component: HTML API | Version: 6.7
Severity: normal | Resolution:
Keywords: has-patch has-unit-tests dev- | Focuses:
feedback fixed-major |
-------------------------------------------------+-------------------------
Comment (by jonsurrell):
Replying to [comment:7 dmsnell]:
> The change to recreate the original doctype I believe might be a
mistake. It more faithfully recreates the input document, but that's not
the goal of `serialize()`, which is to //fully normalize// the input into
a form that's going to be consistent and predictable.
I want to make clarify that the change landed in [59399] //does fully
normalize// the document. The DOCTYPE is not repeated verbatim, it is
normalized into a standard DOCTYPE form. Some examples:
{{{
// Input (fun fact, this is a no-quirks mode doctype!)
<!dOcTyPehtml PublIC"pub-id"'fooo"bar"bazzzzzzz' 😛>
// Normalized
<!DOCTYPE html PUBLIC "pub-id" 'fooo"bar"bazzzzzzz'>
// Input
<!doctype DORKtype>
// Normalized
<!DOCTYPE dorktype>
}}}
These DOCTYPES are not equal byte-for-byte, but their parsed values are
equivalent and the result is indistinguishable in the document while using
normalized HTML text.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/62396#comment:15>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list