Closed zcorpan closed 8 years ago
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
Why would this be useful? What does it reveal?
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/
I'm not sure how mainstream this is - how much it would actually be used. Can you give me a specific example?
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.
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.
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.
(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"))')
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