[wp-trac] [WordPress Trac] #62396: HTML API: serialize should include doctype when present

WordPress Trac noreply at wordpress.org
Wed Nov 13 17:06:50 UTC 2024


#62396: HTML API: serialize should include doctype when present
-------------------------------------------------+-------------------------
 Reporter:  jonsurrell                           |       Owner:  jonsurrell
     Type:  defect (bug)                         |      Status:  closed
 Priority:  normal                               |   Milestone:  6.7.1
Component:  HTML API                             |     Version:  6.7
 Severity:  normal                               |  Resolution:  fixed
 Keywords:  has-patch has-unit-tests dev-        |     Focuses:
  feedback fixed-major                           |
-------------------------------------------------+-------------------------

Comment (by jonsurrell):

 Replying to [comment:7 dmsnell]:
 > Thanks for addressing this point, but I would ask we reconsider this
 change.
 >
 > …
 >
 > //We ought to preserve the mode of the input document// but I don't
 think we should preserve the PUBLIC and SYSTEM identifiers. That is,
 **only return one of two predefined DOCTYPE declarations**.
 >
 > If we have a standards document input, we return `<!DOCTYPE html>`. If
 we get a quirks-mode document input, we return something like `<!DOCTYPE
 html PUBLIC "-//WordPress/HTML/quirks-mode">` to fully identify the
 document as such.


 Those are good thoughts, I think agree. The essential thing is to maintain
 whether the document is in quirks or no-quirks mode.

 For no-quirks, the standard HTML5 doctype is good.
 For quirks mode, omitting the doctype is fine.

 I've prepared a PR with those changes for consideration:
 https://github.com/WordPress/wordpress-develop/pull/7793

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/62396#comment:9>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list