Skip to Content
  • Website
Codsen
  • Home
  • Open Source
  • Articles
  • About

backOpen Source→detect-is-it-html-or-xhtml→Examples

Table of Contents

  • Quick Take
  • Detect HTML from its doctype
  • Prefer HTML when self-closing and open single tags are tied
  • Return null when the source contains no decisive markup
  • Infer XHTML when most single tags are self-closing
  • Detect XHTML from its doctype
↑ back to top

Quick Take

↑ back to top

Detect HTML from its doctype

↑ back to top

Prefer HTML when self-closing and open single tags are tied

↑ back to top

Return null when the source contains no decisive markup

↑ back to top

Infer XHTML when most single tags are self-closing

↑ back to top

Detect XHTML from its doctype

↑ back to top
back 

Copyright

All rights reserved © Roy Revelt 2026
All our open source packages are under MIT licenceopens in a new tab

Activities

🐛 See a bug? Raise an issueopens in a new tab
💘 Check out the Indiewebopens in a new tab and Libera manifestoopens in a new tab