Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doctype check misses some quirky doctypes #10030

Closed
zcorpan opened this issue Nov 26, 2019 · 3 comments
Closed

Doctype check misses some quirky doctypes #10030

zcorpan opened this issue Nov 26, 2019 · 3 comments

Comments

@zcorpan
Copy link

zcorpan commented Nov 26, 2019

#5274 introduced a check for the doctype.

Page has the HTML doctype
Specifying a doctype prevents the browser from switching to quirks-mode. Read more on the MDN Web Docs page

https://doctype-html-foo.glitch.me/ is a test page that uses <!DOCTYPE html foo>, which triggers quirks mode but passes the Lighthouse check.

While that exact doctype is maybe unlikely to happen, there are other variants that are more likely, such as <!DOCTYPE html /> or <!DOCTYPE html PUBILC "-//W3C//DTD HTML 4.01//EN"> (note the typo) or <!DOCTYPE html PUBLIC ”-//W3C//DTD HTML 4.01//EN”> (smart quotes).

Provide the steps to reproduce

  1. Run LH on https://doctype-html-foo.glitch.me/

What is the current behavior?

"Page has the HTML doctype" passes.

What is the expected behavior?

"Page has the HTML doctype" should fail when document.compatMode is BackCompat.

Environment Information

  • Affected Channels: tested DevTools
  • Lighthouse version:
  • Chrome version: 78.0.3904.97 (Official Build) (64-bit)
  • Node.js version:
  • Operating System:

Related issues

@connorjclark
Copy link
Collaborator

I'm interested in this for correctness-sake, and I want to learn more, but I think this is likely a low-impact change.

@k99sharma
Copy link
Contributor

k99sharma commented Aug 19, 2021

Hey! I read about it and I tried the lighthouse test on the above example and it passed the audit for Page has HTML doctype but the document is rendered in BackCompat mode i.e quirks mode. So I got that we need to perform a check for this condition.
So, If this issue is still open I would like to solve it!

@k99sharma
Copy link
Contributor

Hey! I was just checking my PR and found there were a lot of problems with it. So this time I ran tests and fixed everything. I hope this one works out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants