- Provide an accessible base-line experience for everyone using semantic HTML and CSS
The original test was developed by the BBC team to distinguish between HTML5 browsers and non-HTML5 browsers. That test was fairly straight forward:
This works really well! The enhancements being looked for are all functions that hang off of
window and can looked for using checks, so we use these tests even in browsers that don’t support that functionality! Our progressive enhancement life is wonderful!
Let’s get straight to the code, then we’ll explain it:
<script> tags, and the
We can also “test” for the opposite by including the
nomodule attribute. In all browsers that support
type="module" (except Safari 10.1 and iOS Safari 10.3), adding the
nomodule attribute to out
<script> tags will have that JavaScdipt ignored in module-supporting browsers while it’ll load and run as expected in all other browsers! While it’s not absolutely perfect coverage (less than 1% of browsers globally will fall in to this category at the time of this writing), it’s likely good enough for most production work.
- Promises and async functions
- Arrow functions
- Rest parameters
- Template Literals