Skip to content
This repository has been archived by the owner on Jan 4, 2023. It is now read-only.

Collect quirks mode #40

Closed
zcorpan opened this issue Dec 9, 2014 · 9 comments
Closed

Collect quirks mode #40

zcorpan opened this issue Dec 9, 2014 · 9 comments

Comments

@zcorpan
Copy link
Contributor

zcorpan commented Dec 9, 2014

It would be useful to store which rendering mode was used for the top-level document. There is a doctype field but it is not obvious how to map that to quirkyness and it will not be quite correct.

document.compatMode === 'BackCompat' // quirks mode
document.compatMode === 'CSS1Compat' // standards mode or almost standards mode

@andydavies
Copy link
Contributor

This would be easy to do using a WPT custom metric e.g.

[compat-mode]
return document.compatMode;

Here's a test I just did with it in - http://www.webpagetest.org/custom_metrics.php?test=141209_VX_91e6174f5596adc66ef6aaa019aa9eb4&run=1&cached=0

@stevesouders
Copy link
Contributor

Why would this be useful? What does it reveal?

@zcorpan
Copy link
Contributor Author

zcorpan commented Aug 21, 2015

Why would this be useful? What does it reveal?

It is useful to research how many pages rely on a specific quirk to inform whether the quirk can be dropped from browsers, or to study pages that use a specific quirk to inform which browser's implementation is most compatible, or compatible enough, for the others to adopt. I maintain a
spec for quirks at https://quirks.spec.whatwg.org/

@stevesouders
Copy link
Contributor

I'm not sure how mainstream this is - how much it would actually be used. Can you give me a specific example?

@zcorpan
Copy link
Contributor Author

zcorpan commented Feb 18, 2016

I can say that I've wanted this many times. Most recently checking if the -webkit-text CSS value could be removed from chromium, which only affects pages in quirks mode. That particular example gave few enough hits that it wasn't so time consuming to just manually inspect the doctype of each result, but that's not always the case.

Browsers still have many quirks that may not be necessary for web compat, so would be nice to remove, but the lack of collecting document.compatMode makes it take more time to analyse.

@zcorpan
Copy link
Contributor Author

zcorpan commented Feb 18, 2016

I can imagine that this isn't mainstream at all; possibly it's just me who wants this. I can whip up a PR for this if I get some guidance.

@pmeenan
Copy link
Member

pmeenan commented Feb 18, 2016

Sounds like it could easily be implemented as a custom metric (JS that runs at the end of a test). The custom metrics for HA are here.

zcorpan added a commit to zcorpan/httparchive that referenced this issue Feb 18, 2016
@zcorpan
Copy link
Contributor Author

zcorpan commented Feb 18, 2016

Thx, PR at #58

@zcorpan
Copy link
Contributor Author

zcorpan commented Feb 22, 2016

(Documenting a workaround here...)

Query to collect pages that most likely are quirks mode (the regexp isn't as exact as the spec).

SELECT url, doctype FROM (
  SELECT
    url,
    JSON_EXTRACT(payload, '$._doctype') AS doctype,
  FROM [httparchive:har.chrome_jan_15_2016_pages]
)
WHERE doctype = '""'
OR LOWER(doctype) != '"html"'
AND REGEXP_MATCH(LOWER(doctype), r'^"([^h]|h[^t]|ht[^m]|htm[^l]|html\S|html\s+(-\/\/w3o\/\/dtd w3 html strict 3\.0\/\/en\/\/|-\/w3c\/dtd html 4\.0 transitional\/en|html|-\/\/as\/\/dtd html 3\.0 aswedit \+ extensions\/\/|-\/\/advasoft ltd\/\/dtd html 3\.0 aswedit \+ extensions\/\/|-\/\/ietf\/\/dtd html|-\/\/metrius\/\/dtd metrius presentational\/\/|-\/\/microsoft\/\/dtd internet explorer|-\/\/netscape comm\. corp\.\/\/dtd|-\/\/o\'reilly and associates\/\/dtd html|-\/\/sq\/\/dtd html 2\.0 hotmetal \+ extensions\/\/|-\/\/softquad|-\/\/spyglass\/\/dtd html 2\.0 extended\/\/|-\/\/sun microsystems corp\.\/\/dtd hotjava|-\/\/w3c\/\/dtd html 3|-\/\/w3c\/\/dtd html 4\.0 frameset\/\/|-\/\/w3c\/\/dtd html 4\.0 transitional\/\/|-\/\/w3c\/\/dtd html experimental 19960712\/\/|-\/\/w3c\/\/dtd html experimental 970421\/\/|-\/\/w3c\/\/dtd w3 html\/\/|-\/\/w3o\/\/dtd w3 html 3\.0\/\/|-\/\/webtechs\/\/dtd mozilla html|-\/\/w3c\/\/dtd html 4\.01 (frameset|transitional)\/\/\S*"|.*http:\/\/www\.ibm\.com\/data\/dtd\/v11\/ibmxhtml1-transitional\.dtd"))')

pmeenan added a commit that referenced this issue Feb 22, 2016
Fix #40: Add custom metric for document.compatMode
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants