{"id":113,"date":"2025-08-06T18:20:25","date_gmt":"2025-08-06T18:20:25","guid":{"rendered":"http:\/\/www.bacondrivencoding.com\/2008\/?p=113"},"modified":"2026-02-10T22:00:41","modified_gmt":"2026-02-10T22:00:41","slug":"incompetent-browsers-dijon-mustard","status":"publish","type":"post","link":"https:\/\/www.bacondrivencoding.com\/2008\/2025\/08\/incompetent-browsers-dijon-mustard\/","title":{"rendered":"Incompetent Browsers: Dijon mustard"},"content":{"rendered":"<p>Previously: <a href=\"https:\/\/www.bacondrivencoding.com\/2008\/2025\/07\/incompetent-browsers-browser-grading\/\">Browser Grading<\/a>, <a href=\"https:\/\/www.bacondrivencoding.com\/2008\/2025\/07\/incompetent-browsers-browser-detection\/\">Historical Browser Detection<\/a>, <a href=\"https:\/\/www.bacondrivencoding.com\/2008\/2025\/07\/incompetent-browsers-towards-a-complete-modern-solution-part-i\/\">Requirements and Loaders<\/a>, <a href=\"https:\/\/www.bacondrivencoding.com\/2008\/2025\/08\/incompetent-browsers-towards-a-complete-modern-solution-part-ii\/\">Detection and Fallback<\/a>, <a href=\"https:\/\/www.bacondrivencoding.com\/2008\/2025\/08\/incompetent-browsers-a-complete-modern-solution\/\">The Complete Solution<\/a>, <a href=\"https:\/\/www.bacondrivencoding.com\/2008\/2025\/08\/incompetent-browsers-gold-plating-the-css-loader\/\">Goldplating<\/a>.<\/p>\n<p>Right now, we&#8217;re using the presence of <a href=\"https:\/\/caniuse.com\/es6-module-dynamic-import\" rel=\"noopener\" target=\"_blank\">dynamic imports<\/a> to determine if our browser is good enough. But those became available in 2019! Maybe we&#8217;re using something newer than that, like <a href=\"https:\/\/caniuse.com\/css-container-query-units\" rel=\"noopener\" target=\"_blank\">container queries<\/a>, which only became available in 2023. Let&#8217;s be honest, none of us test against Chrome 63, when dynamic imports appeared. We should really have a much stronger test.<\/p>\n<p>Well, good news. Our test is just JavaScript, so we can place our cutoff wherever we want.<\/p>\n<h3>2021<\/h3>\n<p>In 2021, Chrome and Firefox added support for using <a href=\"https:\/\/caniuse.com\/css-not-sel-list\" rel=\"noopener\" target=\"_blank\">a list of css selectors inside <tt>:not()<\/tt><\/a>. Safari had supported it for years. Meanwhile, in 2020, Chrome and Safari added support for <a href=\"https:\/\/caniuse.com\/css-image-orientation\" rel=\"noopener\" target=\"_blank\">CSS3 Image Orientation<\/a>, which Firefox had supported for years. If we test both of these, we&#8217;ll get a test that only passes browsers with both features, leaving us with a browser that was relatively modern in 2021.<\/p>\n<p>Let&#8217;s add this CSS to our <tt>head<\/tt><\/p>\n<pre>\r\n<code>\r\n&lt;head&gt;\r\n  &lt;style&gt;\r\n    head:not(a, p, b, i) {\r\n      image-orientation: from-image;\r\n    }\r\n  &lt;\/style&gt;\r\n  &lt;script&gt;&lt;\/script&gt;\r\n&lt;\/head&gt;\r\n<\/code>\r\n<\/pre>\n<p>This won&#8217;t actually change any styles. It only styles the head tag itself. Then we can check if it worked correctly with a simple line of JavaScript:<\/p>\n<pre>\r\n<code>\r\nif (getComputedStyle(document.head).imageOrientation == 'from-image') {\r\n}\r\n<\/code>\r\n<\/pre>\n<h3>2022<\/h3>\n<p>For 2022, we&#8217;ll use the same technique, but with <a href=\"https:\/\/caniuse.com\/mdn-css_properties_border-start-start-radius\" rel=\"noopener\" target=\"_blank\"><tt>border-start-start-radius<\/tt><\/a>, which became supported in 2021 in Chrome and Safari, but in 2019 for Firefox, and <a href=\"https:\/\/caniuse.com\/font-family-system-ui\" rel=\"noopener\" target=\"_blank\"><tt>system-ui<\/tt> as a font<\/a>, which only started working correctly in Firefox in 2021.<\/p>\n<pre>\r\n<code>\r\nhead {\r\n    border-start-start-radius: 12px;\r\n    font-family: system-ui;\r\n}\r\n<\/code>\r\n<\/pre>\n<pre>\r\n<code>\r\nvar cs = getComputedStyle(document.head);\r\nif (cs.borderStartStartRadius === \"12px\" && cs.fontFamily === \"system-ui\") {\r\n}\r\n<\/code>\r\n<\/pre>\n<h3>2023<\/h3>\n<p>In 2022 and 2023, container queries came online pretty quickly in all browsers.<\/p>\n<pre>\r\n<code>\r\n&lt;head style=\"font-size: 1cqw;\"&gt;\r\n<\/code>\r\n<\/pre>\n<pre>\r\n<code>\r\nif (document.head.style.fontSize === \"1cqw\") {\r\n}\r\n<\/code>\r\n<\/pre>\n<h3>2023, but picky<\/h3>\n<p>For some reason in 2023, I also prepared an alternate test that only allowed browsers updated in 2023, not just recently. It used <a href=\"https:\/\/caniuse.com\/mdn-css_properties_font-variant_historical-forms\" rel=\"noopener\" target=\"_blank\">historical font forms<\/a>, <a href=\"https:\/\/caniuse.com\/mdn-api_htmlelement_attachinternals\" rel=\"noopener\" target=\"_blank\"><tt>attachInternals<\/tt><\/a>, and <a href=\"https:\/\/caniuse.com\/import-maps\" rel=\"noopener\" target=\"_blank\">import map<\/a> support to make sure all three major engines had updated. And it still tested for container queries. I&#8217;m not sure why I did this one, to be honest.<\/p>\n<pre>\r\n<code>\r\n&lt;head style=\"font-size: 1cqw\"&gt;\r\n  &lt;meta charset=\"utf-8\" \/&gt;\r\n  &lt;style&gt;\r\n    head {\r\n      font-variant-alternates: historical-forms;\r\n    }\r\n  &lt;\/style&gt;\r\n  &lt;script&gt;&lt;\/script&gt;\r\n&lt;\/head&gt;\r\n<\/code>\r\n<\/pre>\n<pre>\r\n<code>\r\nvar cs = getComputedStyle(document.head);\r\n\/\/ Safari Test: import maps 16.4+\r\n\/\/ var im = HTMLScriptElement.supports && HTMLScriptElement.supports('importmap');\r\nvar ai = !!document.head.attachInternals;\r\n\/\/ Firefox Test: Container query Units 110+\r\nvar cq = document.head.style.fontSize === \"1cqw\";\r\n\/\/ Chrome Test: fontVariantAlternates 111+\r\nvar fva = cs.fontVariantAlternates == \"historical-forms\";\r\n\r\nif (ai && cq && fva) {\r\n}\r\n<\/code>\r\n<\/pre>\n<p>Looks like I decided not to use the import maps test after all. Whatever.<\/p>\n<h3>2024<\/h3>\n<p>In 2024, Chrome 120 added <a href=\"https:\/\/caniuse.com\/css-dir-pseudo\" rel=\"noopener\" target=\"_blank\"><tt>CSS :dir()<\/tt><\/a> support, Firefox 126 added <a href=\"https:\/\/caniuse.com\/css-zoom\" rel=\"noopener\" target=\"_blank\">zoom<\/a> support, and Safari 17.0 added support for <a href=\"https:\/\/caniuse.com\/link-rel-modulepreload\" rel=\"noopener\" target=\"_blank\">modulepreload hints<\/a>. Safari 17.5 added support for <a href=\"https:\/\/caniuse.com\/css-text-wrap-balance\" rel=\"noopener\" target=\"_blank\">balanced text wrapping<\/a>.<\/p>\n<p>Note that these are all still <a href=\"https:\/\/web-platform-dx.github.io\/web-features\/\" rel=\"noopener\" target=\"_blank\">Baseline Newly Available<\/a>, so this is probably a little too new to rely on.<\/p>\n<pre>\r\n<code>\r\n&lt;head dir=\"rtl\" style=\"zoom: 150%; text-wrap:balance;\"&gt;\r\n<\/code>\r\n<\/pre>\n<pre>\r\n<code>\r\nvar dir;\r\ntry {\r\n  dir = document.querySelectorAll(\":dir(rtl)\");\r\n} catch {\r\n  dir = [];\r\n}\r\nvar link = document.createElement(\"link\");\r\nlink.relList.supports(\"modulepreload\");\r\n\r\nif (\r\n  document.head.style.zoom === \"150%\" && \/\/ FF 126+\r\n  \/\/ && document.head.style.textWrap === 'balance' \/\/Safari 17.5+\r\n  dir.length && \/\/ Chrome 120+\r\n  link.relList.supports(\"modulepreload\")  \/\/ Safari 17.0+\r\n) {\r\n}\r\n<\/code>\r\n<\/pre>\n<h3>2024 &#8211; What We Do in the Shadows<\/h3>\n<p>In 2023 and 2024, <a href=\"https:\/\/caniuse.com\/mdn-html_elements_template_shadowrootmode\" rel=\"noopener\" target=\"_blank\">declarative Shadow DOM<\/a> came online. At the time we decided it wasn&#8217;t ripe enough to rely on.<\/p>\n<pre>\r\n<code>\r\n\/\/ Declarative Shadow DOM\r\n\/\/ Chrome 111+, Safari 16.4+, FF 123+\r\nif (HTMLTemplateElement.prototype.hasOwnProperty(\"shadowRootMode\")) {\r\n}\r\n<\/code>\r\n<\/pre>\n<p>Real nice test though. Especially if you&#8217;re using Web Components and Declarative Shadow DOM and need to send non-supporting browsers to the fallback experience anyway.<\/p>\n<link rel=\"stylesheet\" href=\"https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/highlight.js\/11.11.1\/styles\/default.min.css\">\n<script src=\"https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/highlight.js\/11.11.1\/highlight.min.js\"><\/script><br \/>\n<script>hljs.highlightAll();<\/script><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Previously: Browser Grading, Historical Browser Detection, Requirements and Loaders, Detection and Fallback, The Complete Solution, Goldplating. Right now, we&#8217;re using the presence of dynamic imports to determine if our browser is good enough. But those became available in 2019! Maybe we&#8217;re using something newer than that, like container queries, which only became available in 2023. [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-113","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/www.bacondrivencoding.com\/2008\/wp-json\/wp\/v2\/posts\/113","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.bacondrivencoding.com\/2008\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.bacondrivencoding.com\/2008\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.bacondrivencoding.com\/2008\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.bacondrivencoding.com\/2008\/wp-json\/wp\/v2\/comments?post=113"}],"version-history":[{"count":5,"href":"https:\/\/www.bacondrivencoding.com\/2008\/wp-json\/wp\/v2\/posts\/113\/revisions"}],"predecessor-version":[{"id":145,"href":"https:\/\/www.bacondrivencoding.com\/2008\/wp-json\/wp\/v2\/posts\/113\/revisions\/145"}],"wp:attachment":[{"href":"https:\/\/www.bacondrivencoding.com\/2008\/wp-json\/wp\/v2\/media?parent=113"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.bacondrivencoding.com\/2008\/wp-json\/wp\/v2\/categories?post=113"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.bacondrivencoding.com\/2008\/wp-json\/wp\/v2\/tags?post=113"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}